Shadow mapping and extensions

Two questions, first is more generally about setting up extensions. I am currently trying to implement shadow maps using render to texture. In the past when I’ve used extensions I’ve initialised them manually, usually because there’s only been one or two extensions and it wasn’t too much hastle to write my own code. With shadow maps and render to texture there are quite a few more so I thought I’d used the standard headers (latest from along with glh_extensions.h . Looking at examples from the nvsdk it is just a case of including the headers and calling the appropriate functions to check the extensions are available. When I try and compile my code it fails to find wglBindTexImageARB and wglReleaseTexImageARB which are quite definitely in wglext.h which is included through glh_extensions.h (and tried including directly). It seems to find other calls like wglCreatePbufferARB and wglChoosePixelFormatARB fine. I expect I’ve missed something obvious, but I can’t see what.

My second problem is with the WGL_NV_render_depth_texture extension. Its in the registry, but doesn’t appear in the headers. Is it no longer used, depreciated with its functionality folded in elsewhere or AWOL? Its used in the example from this link:

which works fine, so the functionality is supported in hardware (gf4 at least).

(and before someone mentions it, I know there are a number of extension loading libraries out there, but I’m just trying to get things implemented at the moment so I can figure out how to fit things together from a design point of view. The extension loading method is a temporary measure.)

[This message has been edited by paulc (edited 04-27-2003).]

Try using these GL headers with glh_extension:

these should work fine with glh (they are the headers used by all the NVIDIA developer demos) and will definitely include the WGL_NV_render_depth_texture enums.

[This message has been edited by jra101 (edited 04-27-2003).]

Aha. I knew there were files on an Nvidia server somewhere, but couldn’t find the link from previous forum posts. Well, its fixed the the depth texture problems. Still complains about the render to texture wgl calls, easy enough to solve by getting them manually with wglGetProcAddress, but still strange. At least it all compiles, now to see if it works and when it doesn’t, figure out why. Cheers.

Looks like the glh stuff is a bit of a dead end. I suspect I’m using it wrongly somehow, but my call to glh_init_extensions fails saying the requested extensions are not supported when manually retrieving the extensions strings shows they are. If I simply ignore this the program then subsequently crashes because the wgl calls have not be initialised and all point to NULL. Looks like I’ll have to wglGetProcAddress on everything. Time consuming, but at least it’ll work.

Then again, getting the latest glh_extensions.h seems to have solved the second problem.

[This message has been edited by paulc (edited 04-27-2003).]

Which particular extension are you trying to use that is failing when you call glh_init_extensions?

It seemed to reckon that GL_ARB_depth_texture GL_ARB_shadow WGL_ARB_render_texture WGL_NV_render_depth_texture are unsupported while it picked up GL_ARB_multitexture WGL_ARB_pbuffer WGL_ARB_pixel_format fine. Strange, but I’ve managed to work around it.

Sounds like your drivers are outdated or you are getting Microsoft’s software GL renderer.

Have you tried dumping the string returned by glGetString(GL_EXTENSIONS) right before you call glh_init_extensions to see if those extensions show up in the extension string?