glCopyPixels() & glCopyTexSubImage2D(() difference ?

Hi,

should there be a difference in pixeldata between glReadPixels() and glCopyTexSubImage2D()?
I am doing the following:

glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_tex);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, 800, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, 800, 600);
/* could do some processing here ... */
glGetTexImage( GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);

The Results in Data differ from a call to

glReadPixels(0, 0, 800, 600, GL_RGBA, GL_UNSIGNED_BYTE, Data);

When using 8xS antialiasing (or more) the differences are visible. It seems the results of glGetTexture() are not antialiased properly, but there is some difference to the non-antialiased results…

Running on 7800GTX with 81.95 driver.

This seems to be a NVidia issue. Happens on a few different cards and drivers.
Seems to work on ATI, although I could only do one test…

I should rename this thread to “glGetTexImage() Bug”. glCopySubImage2D() is not the problem.

It seems glGetTexImage() does not return the right data, for whatever reasons. The most I could find out about other peoples experiences with glGetTexImage() is “I’ve never used it” …

I sure feel like I’m talking to myself. :rolleyes:

I can’t help you, but perhaps a few images of the differences would help other people?

Good idea! :slight_smile:

http://img279.imageshack.us/img279/6960/screen9zj.jpg

This screenshot shows the strange quality I get when using glCopyTexSubImage2D(). The bottom half of the image is a screen aligned quad with the top half applied as a texture.
I used LINEAR filtering just to make sure its not a filtering issue, but NEAREST shows the same result ( texel to pixel screen aligned )

The difference is most obvious in the vertical lines but you can also see it on the pink polygons edges.

Maybe this looks familiar to someone…
Thanks

try sticking a glFinsh() before u do the read/copy
also perhaps antialaisng might be interferring somehow (i dont know much about AA) so disable it

If the driver is doing its job, the Finish() call would be redundant. Sure, it never hurts testing it, but in this case I’m almost certain it’ll not make a difference.

Instead, I think this just ties in with the recent discussion about multisample FBO (I think it was).

Although it is not recommended for SLI use I tried a glFinish(), same difference.
Without antialiasing it works just fine, but that’s not an option for me.
Actually, multisample FBOs would just be a workaround to the buggy glCopyTexSubImage2D()…