Jump to content

  • Log In with Google      Sign In   
  • Create Account

glDrawRangeElements' was not declared in this scope


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Thirthe   Members   -  Reputation: 128

Like
0Likes
Like

Posted 16 June 2008 - 08:29 AM

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!

Sponsor:

#2 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 16 June 2008 - 08:50 AM

The Getting Started section explains
http://www.opengl.org/wiki/index.php/Main_Page

#3 Thirthe   Members   -  Reputation: 128

Like
0Likes
Like

Posted 16 June 2008 - 09:46 AM

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!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS