PDA

View Full Version : OpenGL and GLUT help please!!



loganb
02-16-2009, 02:59 PM
Alright, i cant get OpenGL and GLUT working. I'm following the tutorials on http://www.lighthouse3d.com/opengl/glut/index.php?2 but when I compile I get errors.
Here's the code:
#include <GL/glut.h>


void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glFlush();
}

void main(int argc, char **argv) {
glutInit(&amp;argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
glutDisplayFunc(renderScene);
glutMainLoop();
}

And here's the errors:
`main' must return `int'

And I guess the error is referring to line 14. I've posted on lots of different forums but haven't gotten any further. Any help is greatly appreciated thanks-

enunes
02-16-2009, 04:31 PM
Hey,

What about making main return int....?

int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
glutDisplayFunc(renderScene);
glutMainLoop();

return 0;
}