Hello Caroline, today I read Apple’s document and would u please tell me how to use setFragmentBuffer(:: function
setFragmentBuffer
is equivalent to setVertexBuffer
, but used with the fragment function instead of the vertex function.
For the vertex function, we used setVertexBytes
wherever we could, in order not to have to create a vertex buffer. When the data was too big for setVertexBytes
, then we used setVertexBuffer
and sent a buffer to the GPU.
Similarly, until chapter 14, we were able to use setFragmentBytes
to send data to the fragment function. But in chapter 14, the number of lights became too many to send using setFragmentBytes
, so we switched the data to be held in a buffer and used setFragmentBuffer
.