PDA

View Full Version : glut build framework



04-29-2002, 12:04 AM
hello,

where can i find an simple glut example with framework for bulding it unter linux/gcc/mesa/glut (make-file) and under windows/visualc6/glut (dsw/dsp file)

can someone send (freakdev@gmx.net) me an link ... thx

its for a porting project

ciao freakdev

nexusone
04-29-2002, 04:09 AM
Here is a piece of glut code, should work under ether windows or linux without any change. The program just open's a window, does not draw anything. Press "ESC" key to exit.




#include <GL/glut.h>
#include <stdlib.h>

void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
default:
break;
}

}

void reshape (int w, int h)
{
// Window size has changed stuff goes here.
glClearColor (0.0, 0.0, 0.0, 0.0);
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
}

void display(void)
{
//GL drawing stuff here.
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


glutSwapBuffers();
}

int main(int argc, char** argv)
{
glutInit(&amp;argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
glutSetWindowTitle("Glut window");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}





Originally posted by freakdev:
hello,

where can i find an simple glut example with framework for bulding it unter linux/gcc/mesa/glut (make-file) and under windows/visualc6/glut (dsw/dsp file)

can someone send (freakdev@gmx.net) me an link ... thx

its for a porting project

ciao freakdev