void XSurfaceOpenGL::DrawCoreAlpha( void ) { float memw = GetMemWidth(); float memh = GetMemHeight(); float surfacew = GetWidth(); float surfaceh = GetHeight(); float alignw = GetAlignedWidth(); float alignh = GetAlignedHeight(); float u = memw / alignw; float v = memh / alignh; float adjx = GetAdjustX(); float adjy = GetAdjustY(); GLfloat tex[8] = { 0, v, u, v, 0, 0, u, 0 }; GLfloat pos[8] = { adjx, surfaceh+adjy, surfacew+adjx, surfaceh+adjy, adjx, adjy, surfacew+adjx, adjy }; GLfloat col[16] = { 1.0f, 1.0f, 1.0f, m_fAlpha, 1.0f, 1.0f, 1.0f, m_fAlpha, 1.0f, 1.0f, 1.0f, m_fAlpha, 1.0f, 1.0f, 1.0f, m_fAlpha }; glColor4f( m_ColorR, m_ColorG, m_ColorB, 1.0f ); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glVertexPointer(2, GL_FLOAT, 0, pos); glTexCoordPointer(2, GL_FLOAT, 0, tex); glColorPointer(4, GL_FLOAT, 0, col); // bind texture glBindTexture(GL_TEXTURE_2D, m_textureID); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableClientState(GL_COLOR_ARRAY); }
float XFontDatSpr::GetFontWidth( void ) { auto pSpr = m_spDat->GetSprite( 0 ); XBREAK( pSpr == NULL ); return pSpr->GetWidth() + pSpr->GetAdjustX(); }