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?
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!
well. If you have an array for the texture like so
int a,b;
for(a=0;a<16;a++){
for(b=0;b<16;b++){
array[a][b][0]=255;
array[a][b][1]=255;
array[a][b][2]=0;
array[a][b][3]=255;
}
}
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)