Don't use GLUT by default under Windows, but a Win32 App instead. All demos have to be fixed (only basic demo works now). Also on Mac OSX, we plan to use cocoa instead of Glut.
This commit is contained in:
@@ -12,24 +12,41 @@
|
||||
|
||||
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/ConvexHull
|
||||
)
|
||||
|
||||
|
||||
ADD_LIBRARY(OpenGLSupport
|
||||
GLDebugFont.cpp
|
||||
GLDebugFont.h
|
||||
GL_DialogDynamicsWorld.cpp
|
||||
GL_DialogDynamicsWorld.h
|
||||
GL_DialogWindow.cpp
|
||||
GL_DialogWindow.h
|
||||
GL_ShapeDrawer.cpp
|
||||
GL_ShapeDrawer.h
|
||||
GL_Simplex1to4.cpp
|
||||
GL_Simplex1to4.h
|
||||
GLDebugDrawer.cpp
|
||||
GlutStuff.cpp
|
||||
GLDebugDrawer.h
|
||||
|
||||
RenderTexture.cpp
|
||||
RenderTexture.h
|
||||
DemoApplication.cpp
|
||||
DemoApplication.h
|
||||
|
||||
GlutDemoApplication.cpp
|
||||
GlutDemoApplication.h
|
||||
GlutStuff.cpp
|
||||
GlutStuff.h
|
||||
|
||||
|
||||
Win32DemoApplication.cpp
|
||||
Win32DemoApplication.h
|
||||
)
|
||||
|
||||
|
||||
IF (BUILD_SHARED_LIBS)
|
||||
TARGET_LINK_LIBRARIES(OpenGLSupport BulletDynamics BulletCollision ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
ENDIF (BUILD_SHARED_LIBS)
|
||||
|
||||
@@ -24,14 +24,7 @@ void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btV
|
||||
|
||||
void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||
{
|
||||
// if (m_debugMode > 0)
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glColor4f(color.getX(), color.getY(), color.getZ(),1.f);
|
||||
glVertex3d(from.getX(), from.getY(), from.getZ());
|
||||
glVertex3d(to.getX(), to.getY(), to.getZ());
|
||||
glEnd();
|
||||
}
|
||||
drawLine(from,to,color,color);
|
||||
}
|
||||
|
||||
void GLDebugDrawer::drawSphere (const btVector3& p, btScalar radius, const btVector3& color)
|
||||
|
||||
@@ -33,11 +33,14 @@ subject to the following restrictions:
|
||||
#endif
|
||||
#else
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,11 +32,13 @@ class btCollisionObject;
|
||||
#endif
|
||||
#else
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
#ifndef _WINDOWS
|
||||
|
||||
#include "GlutDemoApplication.h"
|
||||
|
||||
@@ -81,5 +82,6 @@ void GlutDemoApplication::swapBuffers()
|
||||
|
||||
}
|
||||
|
||||
#endif //_WINDOWS
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _WINDOWS
|
||||
|
||||
#include "DemoApplication.h"
|
||||
|
||||
@@ -106,3 +107,4 @@ int glutmain(int argc, char **argv,int width,int height,const char* title,DemoAp
|
||||
}
|
||||
|
||||
|
||||
#endif //_WINDOWS
|
||||
|
||||
@@ -26,13 +26,15 @@ subject to the following restrictions:
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#endif
|
||||
#define BT_ACTIVE_ALT VK_LMENU
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
|
||||
#define BT_KEY_K 'k'
|
||||
@@ -53,7 +55,8 @@ subject to the following restrictions:
|
||||
#define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT
|
||||
#define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BT_USE_FREEGLUT
|
||||
#include "GL/freeglut_ext.h" //to be able to return from glutMainLoop()
|
||||
|
||||
@@ -37,8 +37,10 @@ DemoApplication* createDemo();
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC);
|
||||
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC);
|
||||
|
||||
|
||||
static bool sOpenGLInitialized = false;
|
||||
static int sWidth = 0;
|
||||
static int sHeight =0;
|
||||
static int quitRequest = 0;
|
||||
|
||||
// WinMain
|
||||
|
||||
@@ -181,11 +183,21 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return 0; // Return
|
||||
|
||||
case SIZE_MAXIMIZED: // Was Window Maximized?
|
||||
gDemoApplication->reshape(LOWORD (lParam), HIWORD (lParam));
|
||||
sWidth = LOWORD (lParam);
|
||||
sHeight = HIWORD (lParam);
|
||||
if (sOpenGLInitialized)
|
||||
{
|
||||
gDemoApplication->reshape(sWidth,sHeight);
|
||||
}
|
||||
return 0; // Return
|
||||
|
||||
case SIZE_RESTORED: // Was Window Restored?
|
||||
gDemoApplication->reshape(LOWORD (lParam), HIWORD (lParam));
|
||||
sWidth = LOWORD (lParam);
|
||||
sHeight = HIWORD (lParam);
|
||||
if (sOpenGLInitialized)
|
||||
{
|
||||
gDemoApplication->reshape(sWidth,sHeight);
|
||||
}
|
||||
return 0; // Return
|
||||
}
|
||||
break;
|
||||
@@ -297,8 +309,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
case WM_KEYDOWN:
|
||||
printf("bla\n");
|
||||
switch ( wParam )
|
||||
{
|
||||
case VK_CONTROL:
|
||||
case VK_PRIOR:
|
||||
case VK_NEXT:
|
||||
case VK_END:
|
||||
@@ -321,14 +335,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
case 'Q':
|
||||
case VK_ESCAPE:
|
||||
PostQuitMessage(0);
|
||||
{
|
||||
quitRequest = 1;
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_CHAR:
|
||||
gDemoApplication->keyboardCallback(wParam,0,0);
|
||||
if (!quitRequest)
|
||||
gDemoApplication->keyboardCallback(wParam,0,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -364,6 +382,8 @@ void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
|
||||
// create and enable the render context (RC)
|
||||
*hRC = wglCreateContext( *hDC );
|
||||
wglMakeCurrent( *hDC, *hRC );
|
||||
sOpenGLInitialized = true;
|
||||
gDemoApplication->reshape(sWidth,sHeight);
|
||||
|
||||
}
|
||||
|
||||
@@ -371,6 +391,8 @@ void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
|
||||
|
||||
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
|
||||
{
|
||||
sOpenGLInitialized = false;
|
||||
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
wglDeleteContext( hRC );
|
||||
ReleaseDC( hWnd, hDC );
|
||||
|
||||
Reference in New Issue
Block a user