MyScene::MyScene(Window& window) : Scene(window) { if (init == true) {} init = InitialiseGL(); UpdateWorldMatrices(m_RootGameObject, Matrix4()); GOM = new GameObjectMag(); //initialize the GOM PhysicsEngine::Instance()->SetUpdateTimestep(1.0f / 60.0f); //60 Updates per second }
MyScene::MyScene(Window& window) : Scene(window) { if (init == true) init = InitialiseGL(); UpdateWorldMatrices(m_RootGameObject, Matrix4()); //PhysicsEngine::Instance()->SetUpdateTimestep(1.0f / 1.0f); //1 Update per second //PhysicsEngine::Instance()->SetUpdateTimestep(1.0f / 5.0f); //5 Updates per second PhysicsEngine::Instance()->SetUpdateTimestep(1.0f / 60.0f); //60 Updates per second }
void Init(){ InitialiseGL(SCREEN_WIDTH, SCREEN_HEIGHT); // CreateTexture(gl_Texture,"Earth2.bmp",0); //lighting r,b,g,alpha (alpha is for blending) glClearColor(1.,1.,1.,1.); //background colour white // glClearColor(0.,0.,0.,1.); //background colour black std::cout << " Max Number of Lights=" << GL_MAX_LIGHTS << endl; //To specifiy a light we need to name them as follows // from GL_LIGHT0, GL_LIGHT1,GL_LIGHT2,... GL_LIGHTN. /* Second Argument can be GL_AMBIENT, GL_DIFFUSE,GL_SPECULAR,GL_POSITION, GL_SPOT_CUTTOFF, GL_SPOT_DIRECTION, GL_SPOT_EXPONENT, GL_CONSTANT_ATTENIATION, GL_LINEAR_ATTENUATION, GL_QUADRATIC_ATTENUATION */ // //colour of the ambient and diffuse light float ambient[4]={0.7, 0.7, 0.7, 0.2}; // light from all over float diffuse[4]={1.0, 1.0, 1.0, 1.0}; // light component reflecting diffusely float specular[4]={1.0, 1.0, 1.0, 1.0}; //light reflecting specularly glLightfv(GL_LIGHT0,GL_AMBIENT, ambient); glLightfv(GL_LIGHT0,GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT0,GL_SPECULAR, specular); float gLightPosition[4]={-1000.,-1000.,-1000.,0.0}; // float gLightPosition[4]={10000.,0.,0., 1.0}; //The last number tells OpenGL that it's // a light position if it is non zero. // The first three numbers are the coordinates. If this last entry is zero // OpenGL will treat it as a direction, and will work out // direction cosines from the first three numbers. glLightfv(GL_LIGHT0,GL_POSITION,gLightPosition); glEnable( GL_LIGHT0 ); glEnable( GL_LIGHTING); QuadSphere=gluNewQuadric(); }