//----------------------------------------------------------------// void MOAIGfxDevice::SetViewport () { float width = ( float )this->mWidth; float height = ( float )this->mHeight; MOAIViewport viewport; viewport.Init ( 0.0f, 0.0f, width, height ); viewport.SetScale ( width, -height ); viewport.SetOffset ( -1.0f, 1.0f ); this->SetViewport ( viewport ); }
//----------------------------------------------------------------// void MOAIGfxDevice::BeginLayer () { float width = ( float )this->mWidth; float height = ( float )this->mHeight; MOAIViewport viewport; viewport.Init ( 0.0f, 0.0f, width, height ); viewport.SetScale ( width, -height ); viewport.SetOffset ( -1.0f, 1.0f ); this->SetViewport ( viewport ); for ( u32 i = 0; i < TOTAL_VTX_TRANSFORMS; ++i ) { this->mVertexTransforms [ i ].Ident (); } this->mUVTransform.Ident (); this->mCpuVertexTransformMtx.Ident (); this->mVertexMtxInput = VTX_STAGE_MODEL; this->mVertexMtxOutput = VTX_STAGE_MODEL; USMatrix4x4 projMtx; projMtx.Init ( viewport.GetProjMtx ()); this->mVertexTransforms [ VTX_PROJ_TRANSFORM ] = projMtx; // fixed function reset #if USE_OPENGLES1 if ( !this->IsProgrammable ()) { // load identity matrix glMatrixMode ( GL_MODELVIEW ); glLoadIdentity (); glMatrixMode ( GL_PROJECTION ); this->GpuLoadMatrix ( projMtx ); glMatrixMode ( GL_TEXTURE ); glLoadIdentity (); // reset the current vertex color glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ); // reset the point size glPointSize (( GLfloat )this->mPointSize ); } #endif }