Login  Register

Copying pixel data to texture faster than glTexSubImage2D?

Posted by Jesse on Oct 21, 2013; 6:00pm
URL: https://forum.jogamp.org/Copying-pixel-data-to-texture-faster-than-glTexSubImage2D-tp4030321.html

Hello,

What I am trying to do is render the contents of a Java bufferedimage to the screen overtop of an OpenGL canvas.  The BufferedImage has its pixel data completely changed each frame.

To do this, I copy the contents of the buffered image to a texture using

gl.glBindTexture(GL.GL_TEXTURE_2D, textureId);
gl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, textureSize, textureSize, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, IntBuffer.wrap(pRawData));

then this quad is drawn in screen space. It works, but takes about 7ms on my PC with a 2048x2048 texture.  The performance bottleneck is the glTexSubImage2D call.

Any suggestions for improving this speed?

Thanks,

Jesse