void MainScene::initGlobals() { // Drawing toggleDrawingMode(sceneData->drawing_mode); toggleDrawingShading(sceneData->drawing_shading); Point4d* backColor = sceneData->drawing_background; glClearColor(backColor->x, backColor->y, backColor->z, backColor->w); // Culling toggleCulling(sceneData->culling_face, sceneData->culling_order); // Lighting toggleLighting(sceneData->lighting_doublesided, sceneData->lighting_local, sceneData->lighting_enabled, sceneData->lighting_ambient->getFloatv()); // Defines a default normal glNormal3f(0,1,0); }
BOOL OpenGLRender::update(DWORD milliseconds, int mX, int mY) { mouseX = mX; mouseY = mY; if(cam->hasFocus()) cam->followFocus(); if(keys[VK_ESCAPE]) return FALSE; //Toggle lighting if key is pressed toggleLighting(keys['L']); //Toggle debug display if key is pressed toggleDebug(keys['P']); //Moves the camera around if(keys['W']) cam->strafe(3,0.0); if(keys['S']) cam->strafe(-3,0.0); if(keys['A']) cam->strafe(0.0,3); if(keys['D']) cam->strafe(0.0,-3); //Zooms the camera in or out if(keys['Q']) cam->rotate(-.05); if(keys['E']) cam->rotate(.05); if(keys[VK_SPACE]) manager->shoot(selectedID); //if (g_keys->keyDown[VK_F1]) // Is F1 Being Pressed? //ToggleFullscreen (g_window); // Toggle Fullscreen Mode //Adjust GL camera with the new frame perspective(); return TRUE; }
void processSDLEvents() { SDL_Event event; while ( SDL_PollEvent(&event) ) { switch(event.type) { case SDL_VIDEORESIZE: screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, SDL_OPENGL|SDL_RESIZABLE); if (screen) reshape(screen->w, screen->h); else { /* Uh oh, we couldn't set the new video mode?? */; } break; case SDL_QUIT: done = 1; break; case SDL_KEYDOWN: switch(event.key.keysym.sym) { case SDLK_ESCAPE: done =1; break; case SDLK_l: toggleLighting(); break; case SDLK_f: changeFilter(); break; case SDLK_b: toggleBlending(); break; case SDLK_z: theCamera->rotateLocal(3.14159/3,1.0,0.0f,0.0f); default: break; } } } }