PDA

View Full Version : Shadow mapping and extensions



paulc
04-27-2003, 06:41 AM
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 oss.sgi.com) 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:
developer.nvidia.com/view.asp?IO=ogl_rtt_shadow

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).]

jra101
04-27-2003, 10:10 AM
Try using these GL headers with glh_extension:

http://cvs1.nvidia.com/inc/GL/gl.h

http://cvs1.nvidia.com/inc/GL/glext.h

http://cvs1.nvidia.com/inc/GL/wglext.h

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).]

paulc
04-27-2003, 11:35 AM
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.

paulc
04-27-2003, 02:36 PM
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.

EDIT
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).]

jra101
04-27-2003, 04:02 PM
Which particular extension are you trying to use that is failing when you call glh_init_extensions?

paulc
04-28-2003, 12:37 PM
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.

jra101
04-28-2003, 01:29 PM
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?