Skip to main content
GameDev.net gamedev.net
🔒 Locked

Color precision loss in glCopyTexSubImage? SOLVED

Started by technobot Dec 23, 2004 at 12:53 PM 6 replies 2.1k views
Original Post
technobot
technobot
I render some lit cubes (grey cubes with white light; default light settings), copy the result to a texture using glCopyTexSubImage2D, and apply the texture to a non-lit colored cube, using the modulate mode. The original cubes give a smooth color gradient, as expected from lighting with gouraud shading. But on the final cube (after the texture application) I get some color aliasing, which should not be there. The color aliasing appears with flat shading as well (albeit it is harder to notice), and doesn't appear to depend on the texture filtering settings or the texture application mode (modulate/replace/etc.). Both the frame buffer and the texture are 32-bit RGBA, and the pixel store and transfer settings are the default ones. Anyone has an idea what may be causing the color aliasing? P.S.: I can post screenshots if you think that would help... [Edited by - technobot on December 24, 2004 1:24:33 PM]
Michael K.
zedzeek
zedzeek
>>P.S.: I can post screenshots if you think that would help...<<

perhaps
do u ues RGBA* for internal formats + have dithering disabled?
carb
carb
Could be dithering. My Voodoo2 seems to apply dithering whether or not I've specified glEnable(GL_DITHER). Still, that seems a little unlikely given you're using a 32-bit frame buffer. What video card and resolution is it?

- carb
Ben
mikeman
mikeman
It couldn't be dithering, he said the the aliasing appears only when he applies the texture, when he renders the scene everything looks fine.

Is you use GL_LINEAR for minifying filtering, it's logical that antialiasing happens. Have you tried using mipmaps?
carb
carb
I was referring to the [potential] dithering that takes place before the call to glCopyTexSubImage.

I think we'd all have to see a screen shot really ;)

- carb
Ben
technobot
technobot
Ok. Here are the screenshots:

Before CopyTexSubImage:


After the texture application:


To answer the questions/suggestions so far:
- Explicitly enabling/disabling dithering before the copy made no difference, so that's not it..
- It's 800x600 windowed mode on a Radeon 9000 Mobility.
- As I wrote earlier, changing the texture filtering mode has no effect. Nevertheless, I haven't tried using mipmaps yet, since I didn't want to build them manually (and I can't use gluBuild2DMipmaps since I don't have direct access to the image data, unless I want to pay the ReadPixels cost).

EDIT: Update - replacing CopyTexSubImage with ReadPixels -> TexSubImage, gives the same color aliasing, and cuts the framerate by a factor of about 7 (~430 -> ~60). Using gluBuild2DMipmaps to construct mipmaps doesn't help either, ragardless of the filtering mode (and cuts the framerate by a further factor of 2). This is actually expected, considering that the covered screen-space area is slightly larger than the texture (meaning only the 1st mipmap level is used anyway). Also, directly drawing the texture data back to the screen (i.e. ReadPixels -> WritePixels), shows no color aliasing. This means that the problem is either in the write to the texture, or in the texture application or subsequent processing...

[Edited by - technobot on December 24, 2004 9:22:17 AM]
Michael K.
technobot
technobot
My card doesn't have an AI setting. But I went over the settings, and it turns out the OpenGL texture quality setting was one notch below maximum for some reason... I have no idea how it got there, since I'm 100% sure I've set all the settings to either "maximum" or "app-select". [headshake] Well, at least it wasn't a coding error..

So anyway, that solves it. 10x AP.
Michael K.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.