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:
@@ -8,8 +8,18 @@ IF (NOT CMAKE_BUILD_TYPE)
|
|||||||
SET(CMAKE_BUILD_TYPE "Release")
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
ENDIF (NOT CMAKE_BUILD_TYPE)
|
ENDIF (NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
# string (REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
||||||
|
|
||||||
|
IF (WIN32)
|
||||||
|
OPTION(USE_GLUT "Use Glut" OFF)
|
||||||
|
ELSE(WIN32)
|
||||||
|
OPTION(USE_GLUT "Use Glut" ON)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF (USE_GLUT)
|
||||||
|
string (REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
remove_definitions(-D_WINDOWS )
|
remove_definitions(-D_WINDOWS )
|
||||||
|
ENDIF (USE_GLUT)
|
||||||
|
|
||||||
IF(COMMAND cmake_policy)
|
IF(COMMAND cmake_policy)
|
||||||
cmake_policy(SET CMP0003 NEW)
|
cmake_policy(SET CMP0003 NEW)
|
||||||
@@ -33,6 +43,7 @@ ENDIF (OPENGL_FOUND)
|
|||||||
|
|
||||||
FIND_PACKAGE(GLU)
|
FIND_PACKAGE(GLU)
|
||||||
|
|
||||||
|
IF (USE_GLUT)
|
||||||
FIND_PACKAGE(GLUT)
|
FIND_PACKAGE(GLUT)
|
||||||
IF (GLUT_FOUND)
|
IF (GLUT_FOUND)
|
||||||
MESSAGE("GLUT FOUND")
|
MESSAGE("GLUT FOUND")
|
||||||
@@ -50,7 +61,6 @@ SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Glut/glut32.lib)
|
|||||||
ENDIF (MSVC)
|
ENDIF (MSVC)
|
||||||
ENDIF (GLUT_FOUND)
|
ENDIF (GLUT_FOUND)
|
||||||
|
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
INCLUDE_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/Glut)
|
INCLUDE_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/Glut)
|
||||||
ELSE (WIN32)
|
ELSE (WIN32)
|
||||||
@@ -58,6 +68,7 @@ ELSE (WIN32)
|
|||||||
INCLUDE_DIRECTORIES(/usr/include /usr/local/include ${GLUT_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(/usr/include /usr/local/include ${GLUT_INCLUDE_DIR})
|
||||||
ENDIF (WIN32)
|
ENDIF (WIN32)
|
||||||
|
|
||||||
|
ENDIF(USE_GLUT)
|
||||||
|
|
||||||
OPTION(BUILD_DEMOS "Set when you want to build the demos" ON)
|
OPTION(BUILD_DEMOS "Set when you want to build the demos" ON)
|
||||||
IF(BUILD_DEMOS)
|
IF(BUILD_DEMOS)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ subject to the following restrictions:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///create 125 (5x5x5) dynamic object
|
///create 125 (5x5x5) dynamic object
|
||||||
#define ARRAY_SIZE_X 5
|
#define ARRAY_SIZE_X 5
|
||||||
#define ARRAY_SIZE_Y 5
|
#define ARRAY_SIZE_Y 5
|
||||||
@@ -54,7 +55,7 @@ void BasicDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
glutSwapBuffers();
|
swapBuffers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ void BasicDemo::displayCallback(void) {
|
|||||||
m_dynamicsWorld->debugDrawWorld();
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
glutSwapBuffers();
|
swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,14 @@ subject to the following restrictions:
|
|||||||
#ifndef BASIC_DEMO_H
|
#ifndef BASIC_DEMO_H
|
||||||
#define BASIC_DEMO_H
|
#define BASIC_DEMO_H
|
||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
#include "Win32DemoApplication.h"
|
||||||
|
#define PlatformDemoApplication Win32DemoApplication
|
||||||
|
#else
|
||||||
#include "GlutDemoApplication.h"
|
#include "GlutDemoApplication.h"
|
||||||
|
#define PlatformDemoApplication GlutDemoApplication
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "LinearMath/btAlignedObjectArray.h"
|
#include "LinearMath/btAlignedObjectArray.h"
|
||||||
|
|
||||||
class btBroadphaseInterface;
|
class btBroadphaseInterface;
|
||||||
@@ -27,7 +34,8 @@ struct btCollisionAlgorithmCreateFunc;
|
|||||||
class btDefaultCollisionConfiguration;
|
class btDefaultCollisionConfiguration;
|
||||||
|
|
||||||
///BasicDemo is good starting point for learning the code base and porting.
|
///BasicDemo is good starting point for learning the code base and porting.
|
||||||
class BasicDemo : public GlutDemoApplication
|
|
||||||
|
class BasicDemo : public PlatformDemoApplication
|
||||||
{
|
{
|
||||||
|
|
||||||
//keep the collision shapes, for deletion/cleanup
|
//keep the collision shapes, for deletion/cleanup
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ INCLUDE_DIRECTORIES(
|
|||||||
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
|
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF (USE_GLUT)
|
||||||
LINK_LIBRARIES(
|
LINK_LIBRARIES(
|
||||||
OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
||||||
)
|
)
|
||||||
@@ -22,5 +25,19 @@ OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY
|
|||||||
ADD_EXECUTABLE(AppBasicDemo
|
ADD_EXECUTABLE(AppBasicDemo
|
||||||
main.cpp
|
main.cpp
|
||||||
BasicDemo.cpp
|
BasicDemo.cpp
|
||||||
|
BasicDemo.h
|
||||||
|
)
|
||||||
|
ELSE (USE_GLUT)
|
||||||
|
|
||||||
|
LINK_LIBRARIES(
|
||||||
|
OpenGLSupport BulletDynamics BulletCollision LinearMath ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(AppBasicDemo
|
||||||
|
WIN32
|
||||||
|
../OpenGL/Win32AppMain.cpp
|
||||||
|
Win32BasicDemo.cpp
|
||||||
|
BasicDemo.cpp
|
||||||
|
BasicDemo.h
|
||||||
|
)
|
||||||
|
ENDIF (USE_GLUT)
|
||||||
@@ -1,20 +1,25 @@
|
|||||||
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
SUBDIRS( OpenGL BasicDemo )
|
||||||
SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld
|
|
||||||
CcdPhysicsDemo ConstraintDemo SliderConstraintDemo GenericJointDemo Raytracer
|
|
||||||
RagdollDemo ForkLiftDemo BasicDemo Box2dDemo BspDemo MovingConcaveDemo VehicleDemo
|
#todo: re-enable the rest of the demos again
|
||||||
ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo HeightFieldFluidDemo
|
|
||||||
CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo
|
#if (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
DoublePrecisionDemo ConcaveDemo CollisionDemo
|
# SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld
|
||||||
ContinuousConvexCollision ConcaveRaycastDemo GjkConvexCastDemo
|
# CcdPhysicsDemo ConstraintDemo SliderConstraintDemo GenericJointDemo Raytracer
|
||||||
MultiMaterialDemo)
|
# RagdollDemo ForkLiftDemo BasicDemo Box2dDemo BspDemo MovingConcaveDemo VehicleDemo
|
||||||
else (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
# ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo HeightFieldFluidDemo
|
||||||
SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld
|
# CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo
|
||||||
MultiThreadedDemo CcdPhysicsDemo ConstraintDemo SliderConstraintDemo Raytracer
|
# DoublePrecisionDemo ConcaveDemo CollisionDemo
|
||||||
GenericJointDemo RagdollDemo ForkLiftDemo BasicDemo Box2dDemo BspDemo MovingConcaveDemo
|
# ContinuousConvexCollision ConcaveRaycastDemo GjkConvexCastDemo
|
||||||
VehicleDemo ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo
|
# MultiMaterialDemo)
|
||||||
HeightFieldFluidDemo
|
#else (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo
|
# SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld
|
||||||
DoublePrecisionDemo ConcaveDemo CollisionDemo
|
# MultiThreadedDemo CcdPhysicsDemo ConstraintDemo SliderConstraintDemo Raytracer
|
||||||
ContinuousConvexCollision ConcaveRaycastDemo GjkConvexCastDemo
|
# GenericJointDemo RagdollDemo ForkLiftDemo BasicDemo Box2dDemo BspDemo MovingConcaveDemo
|
||||||
MultiMaterialDemo)
|
# VehicleDemo ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo
|
||||||
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
# HeightFieldFluidDemo
|
||||||
|
# CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo
|
||||||
|
# DoublePrecisionDemo ConcaveDemo CollisionDemo
|
||||||
|
# ContinuousConvexCollision ConcaveRaycastDemo GjkConvexCastDemo
|
||||||
|
# MultiMaterialDemo)
|
||||||
|
#endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
|
|||||||
@@ -12,24 +12,41 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/ConvexHull
|
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/ConvexHull
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
ADD_LIBRARY(OpenGLSupport
|
ADD_LIBRARY(OpenGLSupport
|
||||||
GLDebugFont.cpp
|
GLDebugFont.cpp
|
||||||
|
GLDebugFont.h
|
||||||
GL_DialogDynamicsWorld.cpp
|
GL_DialogDynamicsWorld.cpp
|
||||||
|
GL_DialogDynamicsWorld.h
|
||||||
GL_DialogWindow.cpp
|
GL_DialogWindow.cpp
|
||||||
|
GL_DialogWindow.h
|
||||||
GL_ShapeDrawer.cpp
|
GL_ShapeDrawer.cpp
|
||||||
|
GL_ShapeDrawer.h
|
||||||
GL_Simplex1to4.cpp
|
GL_Simplex1to4.cpp
|
||||||
|
GL_Simplex1to4.h
|
||||||
GLDebugDrawer.cpp
|
GLDebugDrawer.cpp
|
||||||
GlutStuff.cpp
|
GLDebugDrawer.h
|
||||||
|
|
||||||
RenderTexture.cpp
|
RenderTexture.cpp
|
||||||
|
RenderTexture.h
|
||||||
DemoApplication.cpp
|
DemoApplication.cpp
|
||||||
|
DemoApplication.h
|
||||||
|
|
||||||
GlutDemoApplication.cpp
|
GlutDemoApplication.cpp
|
||||||
|
GlutDemoApplication.h
|
||||||
|
GlutStuff.cpp
|
||||||
|
GlutStuff.h
|
||||||
|
|
||||||
|
|
||||||
|
Win32DemoApplication.cpp
|
||||||
|
Win32DemoApplication.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
IF (BUILD_SHARED_LIBS)
|
IF (BUILD_SHARED_LIBS)
|
||||||
TARGET_LINK_LIBRARIES(OpenGLSupport BulletDynamics BulletCollision ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
TARGET_LINK_LIBRARIES(OpenGLSupport BulletDynamics BulletCollision ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||||
ENDIF (BUILD_SHARED_LIBS)
|
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)
|
void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||||
{
|
{
|
||||||
// if (m_debugMode > 0)
|
drawLine(from,to,color,color);
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLDebugDrawer::drawSphere (const btVector3& p, btScalar radius, const btVector3& color)
|
void GLDebugDrawer::drawSphere (const btVector3& p, btScalar radius, const btVector3& color)
|
||||||
|
|||||||
@@ -33,11 +33,14 @@ subject to the following restrictions:
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <GL/glut.h>
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
#else
|
||||||
|
#include <GL/glut.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ class btCollisionObject;
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <GL/glut.h>
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
#else
|
||||||
|
#include <GL/glut.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
#ifndef _WINDOWS
|
||||||
|
|
||||||
#include "GlutDemoApplication.h"
|
#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.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _WINDOWS
|
||||||
|
|
||||||
#include "DemoApplication.h"
|
#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>
|
#include <GLUT/glut.h>
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <GL/glut.h>
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#endif
|
#define BT_ACTIVE_ALT VK_LMENU
|
||||||
#endif
|
#else
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BT_KEY_K 'k'
|
#define BT_KEY_K 'k'
|
||||||
@@ -53,7 +55,8 @@ subject to the following restrictions:
|
|||||||
#define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT
|
#define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT
|
||||||
#define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT
|
#define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BT_USE_FREEGLUT
|
#if BT_USE_FREEGLUT
|
||||||
#include "GL/freeglut_ext.h" //to be able to return from glutMainLoop()
|
#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);
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC);
|
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC);
|
||||||
void DisableOpenGL(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
|
// WinMain
|
||||||
|
|
||||||
@@ -181,11 +183,21 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
return 0; // Return
|
return 0; // Return
|
||||||
|
|
||||||
case SIZE_MAXIMIZED: // Was Window Maximized?
|
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
|
return 0; // Return
|
||||||
|
|
||||||
case SIZE_RESTORED: // Was Window Restored?
|
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
|
return 0; // Return
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -297,8 +309,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
|
printf("bla\n");
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
{
|
{
|
||||||
|
case VK_CONTROL:
|
||||||
case VK_PRIOR:
|
case VK_PRIOR:
|
||||||
case VK_NEXT:
|
case VK_NEXT:
|
||||||
case VK_END:
|
case VK_END:
|
||||||
@@ -321,13 +335,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case VK_ESCAPE:
|
case VK_ESCAPE:
|
||||||
|
{
|
||||||
|
quitRequest = 1;
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
|
if (!quitRequest)
|
||||||
gDemoApplication->keyboardCallback(wParam,0,0);
|
gDemoApplication->keyboardCallback(wParam,0,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -364,6 +382,8 @@ void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
|
|||||||
// create and enable the render context (RC)
|
// create and enable the render context (RC)
|
||||||
*hRC = wglCreateContext( *hDC );
|
*hRC = wglCreateContext( *hDC );
|
||||||
wglMakeCurrent( *hDC, *hRC );
|
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)
|
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
|
||||||
{
|
{
|
||||||
|
sOpenGLInitialized = false;
|
||||||
|
|
||||||
wglMakeCurrent( NULL, NULL );
|
wglMakeCurrent( NULL, NULL );
|
||||||
wglDeleteContext( hRC );
|
wglDeleteContext( hRC );
|
||||||
ReleaseDC( hWnd, hDC );
|
ReleaseDC( hWnd, hDC );
|
||||||
|
|||||||
Reference in New Issue
Block a user