Ok, WTF? (more of render to texture)

Ok, one using a pbuffer/glcopyteximage2d, and one using glreadpixels/glteximage2d, which one should be faster? you’d think the pbuffer/glcopyteximage2d one would be faster, but NO! The glreadpixels/glteximage2d one is faster (even though it’s passing the pixel data through the system memory).

try for your self!

pbuffer/glcopyteximage2d: http://mwill.hypermart.net/rendertexture.zip

glreadpixels/glteximage2d: http://mwill.hypermart.net/rendertextureoldcard.zip

Note: The pbuffer one only wants to run on a Radeon (it seems that nVidia doesn’t seem to support it, even though they say that they do).

Why would you use glreadpixels and teximage2d instead of glcopytexsubimage2d?

Did you do this just to show how slow your pbuffer copy is for whatever reason?

– Zeno

Originally posted by Zeno:
[b]Why would you use glreadpixels and teximage2d instead of glcopytexsubimage2d?

Did you do this just to show how slow your pbuffer copy is for whatever reason?

– Zeno[/b]

Because I wanted to try either one, see which one worked better

Hmm, I get a pure white window when I run both of them.

GeForce3 (12.40 detonators)
Athlon 900

Originally posted by jra101:
[b]Hmm, I get a pure white window when I run both of them.

GeForce3 (12.40 detonators)
Athlon 900[/b]

Yeah, for some REALLY stupid reason, it nither one of those programs work on any nVidia chips (I don’t see why not?)

Are you using any odd extensions?

Originally posted by jra101:
Are you using any odd extensions?

On the pbuffer one, the only extensions are wgl_arb_pixel_format and wgl_arb_pbuffer, but on the other one, no extension is used (it should even work with software opengl)

do you have any source code I could run to pinpoint the problem?

Originally posted by jra101:
do you have any source code I could run to pinpoint the problem?

Sure
http://mwill.hypermart.net/r2t.zip

Okay, I found your problem. When you generate the Base texture object you also need to set its texture settings like so:

glGenTextures(1, &Base);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Base);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

In your Init routine.

After I modified both the pbuffer and the noext programs I get these framerates:

noext: ~160fps
pbuffer: ~420fps

So on a GeForce3, pbuffers are indeed a lot faster.

Hope this helps you out,

Jason A.
DelphiGL (http://delphigl.cfxweb.net)

I just make those mods, and it’s still runs at the same speed.

Do you have a Radeon? I think that glCopyTexImage2D still copies data to system memory and then back to the video card. Only the GeForce card has keeps it in video memory, as far as i know anyways.

One thing you might try with pbuffers and glCopyTexImage2D is to only use glCopyTexImage2D the first time you capture from the frame buffer (this initializes the texture object) and then from then on use glCopyTexSubImage2D to update your existing texture object.

Jason A.
DelphiGL (http://delphigl.cfxweb.net)

Also, those mods I made aren’t meant to speed it up, just to get it to work on a GeForce video card.

Jason A.
DelphiGL (http://delphigl.cfxweb.net)

Originally posted by jra101:
[b]Do you have a Radeon? I think that glCopyTexImage2D still copies data to system memory and then back to the video card. Only the GeForce card has keeps it in video memory, as far as i know anyways.

One thing you might try with pbuffers and glCopyTexImage2D is to only use glCopyTexImage2D the first time you capture from the frame buffer (this initializes the texture object) and then from then on use glCopyTexSubImage2D to update your existing texture object.

Jason A.
DelphiGL (http://delphigl.cfxweb.net)[/b]

Yeah, Radeon… I’m sure in next driver sets, it might keep it local…

Your sample of texture rendering gives also a nice white screen on my Athlon 1GHz + TNT2 Ultra + Win2k

Don’t you have any working solution for my platform ?
I’d like to use Texture rendering even on software openGL implementations. is it possible ?

In fact i’d like to simulate environement mapped bump mapping on any openGL hardware.
I’d need texture rendering for this.

Originally posted by FirEdge:
[b]Your sample of texture rendering gives also a nice white screen on my Athlon 1GHz + TNT2 Ultra + Win2k

Don’t you have any working solution for my platform ?
I’d like to use Texture rendering even on software openGL implementations. is it possible ?

In fact i’d like to simulate environement mapped bump mapping on any openGL hardware.
I’d need texture rendering for this.[/b]

You must have a Release10 driver for pbuffers to work

Chris