void Framework::update() { if( bFirstFrame ) { Pad::Create(); bFirstFrame = false; g_ResourceStage = new GraphicData("data.txt"); g_ResourceRobot = new GraphicData("robo.txt"); g_Model[0] = g_ResourceRobot->CreateModel("robo"); g_Model[1] = g_ResourceRobot->CreateModel("robo"); Document doc; Element* root = doc.GetRoot(); Element* tmp = new Element("Test"); double p[3] = { 10,0,-10 }; Attribute* a = new Attribute("Pos", "1,1,1"); a->Set("Hehe",p,3); tmp->AddAttribute(a); root->AddElement(tmp); doc.Write("MyFirst.txt"); } setFrameRate( 60 ); g_cnt++; // View matrix //camera.SetPos( Vector3(sin(g_cnt)*10, 1, cos(g_cnt)*10) ); camera.SetPos( Vector3(0, 1, 10) ); camera.SetTarget( Vector3(0,0,0) ); Matrix44 matProjView; camera.CreateProjViewMatrix(&matProjView); g_ResourceStage->GetBatch("batch")->Draw(matProjView); g_Model[0]->SetPos(Vector3(2,0,0)); g_Model[0]->Draw(matProjView); g_Model[1]->SetPos(Vector3(-2,1,0)); g_Model[1]->SetScale(Vector3(2,1,2)); g_Model[1]->Draw(matProjView); enableDepthTest( true ); if ( isEndRequested() ){ SAFE_DELETE( g_ResourceStage ); SAFE_DELETE( g_ResourceRobot ); Pad::Destroy(); } }
MGLContext::MGLContext(void): m_currentFrameBuffer(0) { // version const char * version = (const char *)glGetString(GL_VERSION); if(version) { sscanf(version, "%d", &g_GLversion); printf("GL_VERSION : %s\n", version); } // init cull face (back) enableCullFace(); setCullMode(M_CULL_BACK); // normalize glEnable(GL_NORMALIZE); // fog glHint(GL_FOG_HINT, GL_NICEST); glFogf(GL_FOG_MODE, GL_LINEAR); // depth enableDepthTest(); setDepthMode(M_DEPTH_LEQUAL); glClearDepth(1.0f); // line glLineWidth(1); // stencil glClearStencil(0); // pixel pack/unpack glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1); // anisotropic filtering glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy); }
MES2Context::MES2Context(void): m_currentFrameBuffer(0) { m_matrixStep = 0; m_matrixMode = M_MATRIX_MODELVIEW; // version const char * version = (const char *)glGetString(GL_VERSION); if(version) { m_gl_version=version; sscanf(version, "%d", &g_GLversion); } // init cull face (back) enableCullFace(); setCullMode(M_CULL_BACK); // depth enableDepthTest(); setDepthMode(M_DEPTH_LEQUAL); glClearDepthf(1.0f); // line glLineWidth(1); // stencil glClearStencil(0); // pixel pack/unpack glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1); // anisotropic filtering glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy); }