glDrawRangeElements(), anyone?

Why can’t I get it to work? glDrawElements() and glDrawArrays() both work, but for some reason I keep getting an ‘undeclared identifier’ message in Visual C++. Can anyone help me out?
BTW, I know I set up the vector arrays right because those other two commands work. I don’t even know what ‘undeclared identifier means’ Please help!


It means that VC++ cannot find a function, variable, or other identifier named glDrawRangeElements().

First of all, it is an extension function, so did you call wglGetProcAddress to get the function pointer for it? Secondly, since it is an extension, the function is called glDrawRangeElementsEXT().

Sorry, I forgot to mention I’m using GLUT… Doesn’t it include all the reference calls necessary? I linked the GLUT libraries to VC++ and I included it as a header file. I’ll try what you said, though… thanks.

I dunno… didn’t it become standard in OpenGL 1.2?? I think that’s what the SuperBible says…

Under Linux, I just downloaded Mesa 3.5 (OpenGL 1.2 finally!) yesterday… so, i’ll try that sometime…

It’s definitely part of OpenGL 1.2 so it is called glDrawRangeElements (no EXT). You need to use wglGetProcAddress to get a pointer to it. It will also help you to use a recent version of glext.h from nVidia or SGI where the function pointer is defined, otherwise you’ll have to define your own:

// In your header (or glext.h):
typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (params go here …)
// then in your code:
const PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) wglGetProcAddress(“glDrawRangeElements”);
// then you can use it:

I use it frequently with no problems.

Hope that helps.

[This message has been edited by ffish (edited 06-28-2001).]

Just to clarify, standard MS OpenGL is 1.1, that’s why it doesn’t export 1.2 functions. However, most drivers are 1.2, so you can get the functions address manually by using wglGetProcAddress, or treating it as an extension.