extensions

Hello all,

I’ve got the following problem: I want to implement NV-extensions. So I downloaded the NVSDK at nvidia. BUT: I found two files there: glext.h and glh_genext.h (or something like that, I’m at work and these files aren’t present here). Both files are incomplete, e.g. there are no vertex programs.

Probably I’m to stupid and everything is there, but aren’t outthere any complete *.h files waiting to get downlaoded?
Thanks

What’s the date on your glext.h? Mine’s 12 August - the latest SDK IIRC. Mine has everything you need for vertex programs, texture_shader2, register_combiners2, etc. AFAIK the glh_genext.h file (from memory) just provides a convenient interface for you to initialise the extensions with. Check again for a recent glext.h on nVidia’s site - it usually comes with their individual demos as well.

Hope that helps.

thanks,
you were right, they’re there…but some have the (PFNG…)typedefs and the function definition (PFNG… gl…) and some have only the (PFNG…).
I could read these names and create by myself the function definitions, but there are a bit too much. Should I try with genext.h? (I’m still at work, so I can’t try)
Or do any files exist with both declarations in (for everything)?

Have you used extensions before? It’s quite simple - you just put the following lines in your code:

// e.g. for glGenProgramsNV(GLsizei n, GLuint *programs);
const PFNGLGENPROGRAMSNVPROC glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC) wglGetProcAddress(“glGenProgramsNV”);
assert(glGenProgramsNV); // Optional.

You’re just getting a function pointer, basically. Note that you can call the pointer whatever you want, e.g. swap the first glGenProgramsNV for foo if you want, but it’s best to give it the correct name.

This isn’t done for you by glext.h for any of the functions within it. You will have to do this for every function, but the same mechanism should work for all functions that you want to use. Even easier is to use Cass’ (I think) function glh_init_extensions(char *) and it does it all for you. Just look at some SDK examples to see how.

I don’t understand what you mean by “… some have the … typedefs and the function definition … and some have only the (typedefs) …” My glext.h only has extern declarations and typedefs, no definitions. These are contained, AFAIK, in the nvOpenGL.dll. If I’m lying to you and the example code doesn’t work for the functions with only the typedefs (no extern declaration) then I know for a fact it works with glh_init_extensions but I’m 99.9% sure it should work how I demonstrated. Once again, though, glh_init_extensions is easier and that’s what I use for everything except OpenGL 1.2 functions.

<edit>BTW, I should clarify - glh_init_extensions("GL_NV_vertex_program ") for instance will setup for you all the functions relevant to vertex programs (see the spec or glext.h). If you use my code example above, you have to define each function pointer individually. Is this what you meant? If so, use glh_init_extensions. Once again, look at some simple SDK examples and you’ll see straight away how it works. You can pass it as many extension names as you like - just remember to separate your extension names with a space.</edit>

Hope that helps.

[This message has been edited by ffish (edited 08-29-2001).]

Thanks for your help, ffish!

I’ve already worked with extensions , a longer time ago…

I was irritated by different declarations in glext.h :

For some extensions it looks like this:
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
and further in the file:
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;

but for some extensions there’s only the PFNGL…-declaration, so I have to declare the function name for such declarations myself. And this is a bit a stupid work to do, if it exists elsewhere…

But if it doesn’t exist, I’ll go with glh_init_extensions.

regards