problem with reading zBuffer on ATI

Hi,

I have a strange problem with reading values from zBuffer. When i start my application everything works fine untill I enlarge size of the window.

When I get resize event I set up new viewport values (by calling glViewport)
After that, when I call:

glReadPixels(x, y, 1, 1, GL_DEPTH_BUFFER_BIT, GL_FLOAT, floatPtr);

with x,y outside the previous viewport it doesn’t set anything in floatPtr or it sets incorrect values.

I’m running Windows XP [Version 5.1.2600]
My graphics card: ATI Radeon X300/X550/X1050 Series
Drivers: Catalyst: 09.03 OpenGL Version: 6.14.10.8543
My project is in c# and I’m using tao wrapper.

Has anyone experienced similar problems with ATI cards? My program works fine with nVidia.

Should I do something more than just setting viewport and then render my scene like always after I get resize event?

Thanks for any help.

MORE INFO:

After resize I also call gluPerspective with new apsect ratio, clear all buffers and then do actual render…

Make sure you’re setting everything up the same way, and in the same order. Have a function/method that sets up your viewport (something like vpSetup(width, height, blah blah)) and then call that for both the initial setup and for resize events.

Also, welcome to the wonderful world of OpenGL on ATI hardware :frowning:

Hey, thanks. Repeating initial opengl initialization after resizing really helped. Resizeing windows is not so smooth anymore but my application is working correctly.

I’ve never seen any sample code doing initial open setup more than once - at the beginning of an application so this idea wasnt really obvious for me…