This is my first OpenGL. I'm using the book OpenGL
Programming Guide which uses C, but I'm using C++. I
tried to compile the following program in Dev. It
brings up hundreds of compiler errors. I believe it is
a left out include file or a missing linker switch.
Sorry if it seems obvious but this is my first try at
OpenGL. Here is the code:
#include <gl/gl.h>
#include <cstdlib>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.25, 0.25, 0.0);
glEnd();
glFlush();
};
void init()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0, 0.0, 1.0, -1.0, 1.0);
};
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Dev reports the errors in the gl.h. Many of them have
something to do with WINGDIAPI declarations. I do not
know why the cstdlib library is needed. It was in the
example of the book though. I just switched it for c++
because the book had it written for c which was
stdlib.h. Thanks in advance for your help.
__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
|