View Full Version : glCopyTexImage2D() SLOW?!?

07-18-2004, 03:03 AM
Hi, my program has to do lots of frame buffer reads and texturing for each frame, I have a loop which does about 50 iterations and each iteration does a glCopyTexImage2D() call 3 times. So that's 150 of them all together, I am only getting about 1 frame per sec, surely this is REALLY slow, even with the number of frame buffer reads?? I am using a GF FX 5500.

Is there a chance it's not using the hardware? I tried the GL_RENDERER and it returns the card's details. Any advice? Comments?



07-18-2004, 03:42 AM
If you're updating existing textures, use glCopyTexSubImage instead.

07-18-2004, 04:48 AM
Thanks Bob,

Using that function does speed my program up a little, but it still won't run at more than about 2 frames per sec.

I have no idea how long a copy should take on my card, but I guessed that 150 per frame should still run quicker than 2FPS? Am I wrong?

I am using the Mesa libraries with GLUT to compile, could this have anything to do with it?

Thanks everyone!


07-18-2004, 06:24 AM
Which texture format you use? Try to change to BGR or BGRA.

Why using MESA?


07-18-2004, 08:25 AM
Yooyo, today you can be really happy in knowing that you are the man! That BGRA rather than RGBA thing worked a treat. Please can you explain why to me?

I was using Mesa as when I started out with OpenGL I was told that you had to pay for the libraries from SG, I never questioned it until recently, today I have removed Mesa. Sadly doesn't seem any faster though!

Thanks alot,


07-18-2004, 08:30 AM
Oops, forget that last post, it didn't work :-( I'm just getting a gray screen now!

07-18-2004, 11:27 AM
well. If you have an array for the texture like so
int a,b;
}You have to use GL_RGBA. If you used GL_RGB earlier you have to add all the alpha values. The reason it might be faster is because It alignes better in memory most of the time. I would assume in GL_UNSIGNED_BYTE is what Opengl Programming guide meant.

Oh and when he said to use glTexSubImage2D he didn't mean replace all of glTexImage2D with that. I doubt you eddited you code in less than a minute, so I think you misunderstood. Every time you change a part of a texture, have a different array of the changed part(doesn't have to be a power of 2) then use that function(it does have different parameters)