bool setupGL() { glfwInit(); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2); glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwOpenWindowHint( GLFW_WINDOW_NO_RESIZE, GL_TRUE ); if(!glfwOpenWindow( WIDTH, HEIGHT, 8, 8, 8, 8, 32, 0, GLFW_WINDOW)) { logError("could not create GLFW-window"); return false; } logErrorsGL(); glewExperimental = GL_TRUE; if (GLEW_OK != glewInit()) { logError("GLEW init error"); return false; } logErrorsGL(); logNote("Successfully created OpenGL-window, version %i.%i", glfwGetWindowParam(GLFW_OPENGL_VERSION_MAJOR), glfwGetWindowParam(GLFW_OPENGL_VERSION_MINOR)); logNote("GLSL-version: %s",glGetString(GL_SHADING_LANGUAGE_VERSION)); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glfwSwapInterval(0); glActiveTexture(GL_TEXTURE0); glClearColor(1.0, 1.0, 1.0, 0.0); glfwDisable(GLFW_MOUSE_CURSOR); glfwSetKeyCallback(keyCallback); return true; }
// ------------------------------------------------------------------------- CollisionsWorld::CollisionsWorld(SceneManager *scn, const AxisAlignedBox &bounds, bool init, bool set32bitsAxisSweep, unsigned int maxHandles): mScnMgr(scn), mBounds(bounds), mShowDebugShapes(false), mShowDebugContactPoints(false), mDebugContactPoints(0), mDebugDrawer(0) { mDispatcher = new btCollisionDispatcher(&mDefaultCollisionConfiguration); if (set32bitsAxisSweep) { mBroadphase = new bt32BitAxisSweep3( OgreBtConverter::to(bounds.getMinimum()), OgreBtConverter::to(bounds.getMaximum()), maxHandles); } else { if(maxHandles > USHRT_MAX) { Ogre::String logNote("Exceeded the maximum number of handles for btAxisSweep3. Max = USHRT_MAX. Resetting maxHandles to USHRT_MAX in OgreBulletCollisions::CollisionsWorld::CollisionsWorld()."); Ogre::LogManager::getSingleton().logMessage(logNote); maxHandles = USHRT_MAX; } mBroadphase = new btAxisSweep3( OgreBtConverter::to(bounds.getMinimum()), OgreBtConverter::to(bounds.getMaximum()), static_cast<unsigned short>(maxHandles)); } // if not called by a inherited class if (init) { mWorld = new btCollisionWorld(mDispatcher, mBroadphase, &mDefaultCollisionConfiguration); btCollisionDispatcher * dispatcher = static_cast<btCollisionDispatcher *>(mWorld->getDispatcher()); btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher); } }
void pause_debug(void) { logNote("pause_debug called"); fprintf(stderr, "pause\n"); }
bool Engine::init(int width, int height, bool fullscreen) { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); //int fs = fullscreen ? GLFW_FULLSCREEN : GLFW_WINDOW; window = glfwCreateWindow(width, height, "Facial", NULL, NULL); windowSize = ivec2(width, height); /* if(!glfwOpenWindow( width, height, R_BPP, G_BPP, B_BPP, A_BPP, DEPTH_BPP, STENCIL_BPP, fs)) */ if(!window) { logError("could not create GLFW-window"); return false; } /* Make the window's context current */ glfwMakeContextCurrent(window); glfwSetKeyCallback(window, Engine::keyCallback); glfwSetMouseButtonCallback(window, Engine::mouseButtonCallback); glfwSetCursorPosCallback(window, Engine::cursorPosCallback); glfwSetScrollCallback(window, scrollCallback); logErrorsGL(); //#ifndef __APPLE__ glewExperimental = GL_TRUE; if (GLEW_OK != glewInit()) { logError("GLEW init error"); return false; } //#endif logErrorsGL(); logNote("Successfully created OpenGL-window, version %i.%i", glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR), glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR)); logNote("GLSL-version: %s",glGetString(GL_SHADING_LANGUAGE_VERSION)); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glfwSwapInterval(0); return true; }