void OGLRender::SetZBias(int bias) { #if defined(DEBUGGER) if( pauseAtNext == true ) DebuggerAppendMsg("Set zbias = %d", bias); #endif // set member variable and apply the setting in opengl m_dwZBias = bias; ApplyZBias(bias); }
bool OGLRender::RenderLine3D() { ApplyZBias(0); // disable z offsets glBegin(GL_TRIANGLE_FAN); glColor4f(m_line3DVtx[1].r, m_line3DVtx[1].g, m_line3DVtx[1].b, m_line3DVtx[1].a); glVertex3f(m_line3DVector[3].x, m_line3DVector[3].y, -m_line3DVtx[1].z); glVertex3f(m_line3DVector[2].x, m_line3DVector[2].y, -m_line3DVtx[0].z); glColor4ub(m_line3DVtx[0].r, m_line3DVtx[0].g, m_line3DVtx[0].b, m_line3DVtx[0].a); glVertex3f(m_line3DVector[1].x, m_line3DVector[1].y, -m_line3DVtx[1].z); glVertex3f(m_line3DVector[0].x, m_line3DVector[0].y, -m_line3DVtx[0].z); glEnd(); OPENGL_CHECK_ERRORS; ApplyZBias(m_dwZBias); // set Z offset back to previous value return true; }
// This is so weird that I can not do vertex transform by myself. I have to use // OpenGL internal transform bool OGLRender::RenderFlushTris() { if( !gRDP.bFogEnableInBlender && gRSP.bFogEnabled ) { TurnFogOnOff(false); } ApplyZBias(m_dwZBias); // set the bias factors glViewportWrapper(windowSetting.vpLeftW, windowSetting.uDisplayHeight - windowSetting.vpTopW - windowSetting.vpHeightW, windowSetting.vpWidthW, windowSetting.vpHeightW, false); //if options.bOGLVertexClipper == false ) { glDrawElements( GL_TRIANGLES, gRSP.numVertices, GL_UNSIGNED_SHORT, g_vtxIndex ); } if( !gRDP.bFogEnableInBlender && gRSP.bFogEnabled ) { TurnFogOnOff(true); } return true; }
// This is so weired that I can not do vertex transform by myself. I have to use // OpenGL internal transform bool OGLRender::RenderFlushTris() { if( !m_bSupportFogCoordExt ) SetFogFlagForNegativeW(); else { if( !gRDP.bFogEnableInBlender && gRSP.bFogEnabled ) { TurnFogOnOff(false); } } ApplyZBias(m_dwZBias); // set the bias factors glViewportWrapper(windowSetting.vpLeftW, windowSetting.uDisplayHeight-windowSetting.vpTopW-windowSetting.vpHeightW+windowSetting.statusBarHeightToUse, windowSetting.vpWidthW, windowSetting.vpHeightW, false); OPENGL_CHECK_ERRORS; //if options.bOGLVertexClipper == FALSE ) { glDrawElements( GL_TRIANGLES, gRSP.numVertices, GL_UNSIGNED_SHORT, g_vtxIndex ); OPENGL_CHECK_ERRORS; } /* else { //ClipVertexesOpenGL(); // Redo the index // Set the array glVertexPointer( 4, GL_FLOAT, sizeof(float)*5, &(g_vtxProjected5Clipped[0][0]) ); glEnableClientState( GL_VERTEX_ARRAY ); pglClientActiveTextureARB( GL_TEXTURE0_ARB ); glTexCoordPointer( 2, GL_FLOAT, sizeof( TLITVERTEX ), &(g_clippedVtxBuffer[0].tcord[0].u) ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); pglClientActiveTextureARB( GL_TEXTURE1_ARB ); glTexCoordPointer( 2, GL_FLOAT, sizeof( TLITVERTEX ), &(g_clippedVtxBuffer[0].tcord[1].u) ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glDrawElements( GL_TRIANGLES, gRSP.numVertices, GL_UNSIGNED_INT, g_vtxIndex ); // Reset the array pglClientActiveTextureARB( GL_TEXTURE0_ARB ); glTexCoordPointer( 2, GL_FLOAT, sizeof( TLITVERTEX ), &(g_vtxBuffer[0].tcord[0].u) ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); pglClientActiveTextureARB( GL_TEXTURE1_ARB ); glTexCoordPointer( 2, GL_FLOAT, sizeof( TLITVERTEX ), &(g_vtxBuffer[0].tcord[1].u) ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glVertexPointer( 4, GL_FLOAT, sizeof(float)*5, &(g_vtxProjected5[0][0]) ); glEnableClientState( GL_VERTEX_ARRAY ); } */ if( !m_bSupportFogCoordExt ) RestoreFogFlag(); else { if( !gRDP.bFogEnableInBlender && gRSP.bFogEnabled ) { TurnFogOnOff(true); } } return true; }