Hey guys
i have few simple question which aren’t quite clear to me.
- when i use glTexSubImage2D , the last param is a pointer to my points… since im using cuda, my points
are allocated over the device , hence i can’t use the traditional way of attaching the “pointer”
because it’s pointing at an “unknown” place…
is the answer is to forword NULL param instead of the pointer and before that command use glbindbuffer
to load the allocated device over the cuda like so :
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, MAXX, MAXY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
the following example works … but im not sure if it’s the right and correct way .
2.i saw the following code to init a buffer
glGenBuffers(1, buffer);
glBindBuffer(GL_PIXEL_PACK_BUFFER, *buffer);
glBufferData(GL_PIXEL_PACK_BUFFER, MAXX*MAXY*4, NULL, GL_DYNAMIC_DRAW);
a MAXXMAXY4 uninitialized points buffer was declared , my guess that the 4 stands for X Y Z W coords…
now for printing the following lines were used :
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, MAXX, MAXY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
my question is , how does the cpu knows that im using 4 cords system? (maybe i want to use only x,y which is only 2 cords system)
thanks!