#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 ();
}
glDrawRangeElements' was not declared in this scope
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:
Btw, is there a way of getting a newer OpenGL API for mingw gcc?
Thanks!
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!
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
Popular Topics
Advertisement