PDA

View Full Version : Rendering to depth texture on ATI card



danp60
10-18-2005, 09:29 PM
Hi,

I have some code that currently renders to a depth texture using the extension WGL_ARB_pbuffer and WGL_ARB_render_texture. Here is some sample code I am using:


Pbuffer.Activate();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glMultMatrixd(o_matv);

glViewport(0,0,TEXSIZE,TEXSIZE);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glMultMatrixd(matlookv);

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

glPolygonOffset(1.4,1);
glEnable(GL_POLYGON_OFFSET_FILL);

render_geometry(1);
glDisable(GL_POLYGON_OFFSET_FILL);
glBindTexture(GL_TEXTURE_2D,depth);
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,TEXSIZ E,TEXSIZE);
Pbuffer.Deactivate(); This code works perfectly on an Nvidia card and I can even use glGetTexImage to verify the depth texture is being created correctly. However, on an ATI card. My program does not work and glGetTexImage returns a blank texture. I've also read on other forums that ATI cards do not support direct rendering to depth texture via a pbuffer. Is this true, and if it is, does anyone know a workaround for ATI cards? I'm using a FireGL V3100, by the way, if that matters.