Hi,
I’m currently using a PBO to draw into (from a CUDA kernel).
Once done I draw it the following way, but it use 20% of my CPU !!!
I’m looking for a more efficient way to render my PBO ?
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, _pboId);
// Disable all the stuffs we don't need here
glDisable(GL_DEPTH_TEST);
glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDisable(GL_DITHER);
glDisable(GL_MULTISAMPLE);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_STENCIL_TEST);
glDrawPixels(_width, _height, GL_RGBA, GL_UNSIGNED_BYTE, 0); // Use the CPU !!!
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
I have also try the following, but nothing appear :
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
if (_pboTextureId < 0)
{
glGenTextures(1, (GLuint*)&_pboTextureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _width, _height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
glBindTexture(GL_TEXTURE_2D, _pboTextureId); // Bind the texture
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, _pboId); // Bind the PBO
// Copy pixels from pbo to texture object
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, 0);
// Draw the texture
glBegin (GL_QUADS);
glTexCoord2f (0.0, 0.0);
glVertex3f (0.0, 1.0, 0.0);
glTexCoord2f (1.0, 0.0);
glVertex3f (1.0, 1.0, 0.0);
glTexCoord2f (1.0, 1.0);
glVertex3f (1.0, 0.0, 0.0);
glTexCoord2f (0.0, 1.0);
glVertex3f (0.0, 0.0, 0.0);
glEnd ();
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,0);
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
Does someone have an idea to solve this problem ?
Thx