glDrawRangeElements' was not declared in this scope

Started by
1 comment, last by Thirthe 15 years, 10 months ago
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" {
#endif
#include <windows.h>
#include <GL/glut.h>
#include <stdlib.h>
#ifdef __cplusplus
}
#endif

void display(void)
{
   glClear (GL_COLOR_BUFFER_BIT);

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);

//glBegin(GL_POLYGON);	
//        for( int i = 0; i < 4; ++i )
//            glArrayElement(i);
//glEnd();
//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!
Advertisement
The Getting Started section explains
http://www.opengl.org/wiki/index.php/Main_Page
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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:

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

thanks!

This topic is closed to new replies.

Advertisement