Jump to content
  • Advertisement
Sign in to follow this  

OpenGL glDrawRangeElements' was not declared in this scope

This topic is 3830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, i'm starting with OpenGL, so i got the red book 5th ed. and now i'm going through it, page by page. So, the first problem is that the 5th ed. includes the 1.5/2.0 features, while i'm programming in OpenGL 1.3. But so far i was good, since it said for which version a specific function was implemented. But i'm pretty sure i can use glDrawRangeElements(): "glDrawRangeElements is available only if the GL version is 1.2 or greater." i'm using winxp, Code::Blocks and compiling with mingw g++-3.4.5 also, i followed http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/ for setting up OpenGL. my main.cpp file:
#ifdef __cplusplus
extern "C" {
#include <windows.h>
#include <GL/glut.h>
#include <stdlib.h>
#ifdef __cplusplus

void display(void)

static GLfloat lol[] = {
    1.0, 1.0, 0.0, -0.5, 0.25,
    1.0, 1.0, 1.0, -0.50f, 0.f,
    1.0, 0.0, 0.0, 0.50f, -0.25f,
    0.0, 0.0, 0.0, 0.50f, 0.25f
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );

glColorPointer( 3, GL_FLOAT, 5*sizeof(GLfloat), &lol[0] );
glVertexPointer( 2, GL_FLOAT, 5*sizeof(GLfloat), &lol[3] );
static GLuint in[] = {0,1,2,3};

//glDrawElements( GL_POLYGON, 4, GL_UNSIGNED_INT, in );
glDrawRangeElements( GL_POLYGON, 0, 3, 4, GL_UNSIGNED_INT, in);

//        for( int i = 0; i < 4; ++i )
//            glArrayElement(i);
//glDisable( GL_POLYGON_STIPPLE );

glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );

   glFlush ();

Btw, is there a way of getting a newer OpenGL API for mingw gcc? Thanks!

Share this post

Link to post
Share on other sites
heh, i see this is a problem that often occurs often with us newbies.
anyway, the problem was solved by downloading the newest glext.h and putting this into the code:

glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)wglGetProcAddress("glDrawRangeElements");


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!