use freeglut by default under Windows

This commit is contained in:
ejcoumans
2007-12-14 02:48:53 +00:00
parent 38349b5af4
commit 9e25108b06
8 changed files with 44 additions and 21 deletions

View File

@@ -235,8 +235,6 @@ void DemoApplication::reshape(int w, int h)
}
void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
{
(void)x;
@@ -257,7 +255,14 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
switch (key)
{
case 'q' : exit(0); break;
case 'q' :
#if (defined (WIN32) && defined (_MSC_VER))
//return from glutMainLoop(), detect memory leaks etc.
glutLeaveMainLoop();
#else
exit();
#endif
break;
case 'l' : stepLeft(); break;
case 'r' : stepRight(); break;

View File

@@ -17,18 +17,7 @@ subject to the following restrictions:
#define DEMO_APPLICATION_H
#ifdef WIN32//for glut.h
#include <windows.h>
#endif
//think different
#if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include "GlutStuff.h"
#include <stdlib.h>
#include <stdio.h>

View File

@@ -66,7 +66,6 @@ static void glutDisplayCallback(void)
}
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp) {
gDemoApplication = demoApp;
@@ -76,7 +75,10 @@ int glutmain(int argc, char **argv,int width,int height,const char* title,DemoAp
glutInitWindowPosition(0, 0);
glutInitWindowSize(width, height);
glutCreateWindow(title);
#if (defined (WIN32) && defined (_MSC_VER))
glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif
gDemoApplication->myinit();
glutKeyboardFunc(glutKeyboardCallback);

View File

@@ -15,6 +15,24 @@ subject to the following restrictions:
#ifndef GLUT_STUFF_H
#define GLUT_STUFF_H
#ifdef WIN32//for glut.h
#include <windows.h>
#endif
//think different
#if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#if (defined (WIN32) && defined (_MSC_VER))
#include "GL/freeglut_ext.h" //to be able to return from glutMainLoop()
#endif
class DemoApplication;
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp);