View Full Version : extensions
08-28-2001, 11:53 PM
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?
08-29-2001, 01:09 AM
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.
08-29-2001, 03:15 AM
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)?
08-29-2001, 04:00 AM
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 http://www.opengl.org/discussion_boards/ubb/wink.gif 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).]
08-29-2001, 04:40 AM
Thanks for your help, ffish!
I've already worked with extensions http://www.opengl.org/discussion_boards/ubb/wink.gif, 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:
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... http://www.opengl.org/discussion_boards/ubb/smile.gif
But if it doesn't exist, I'll go with glh_init_extensions.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.