summaryrefslogtreecommitdiff
path: root/common/piece.cpp
diff options
context:
space:
mode:
authorLeo2009-02-23 07:47:54 +0000
committerLeo2009-02-23 07:47:54 +0000
commit281dfd75faafc8a0806cb43649a07833d9209d07 (patch)
treebc1bd02d9df9100acb9d1aa217d1f514dc5e8e9c /common/piece.cpp
parent27815f2cce37721ae1c524669c3e19cff8a50894 (diff)
Replaced immediate mode calls with vertex buffers.
git-svn-id: http://svn.leocad.org/tags/leocad-0.75@742 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/piece.cpp')
-rw-r--r--common/piece.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/common/piece.cpp b/common/piece.cpp
index 42519e7..98e539b 100644
--- a/common/piece.cpp
+++ b/common/piece.cpp
@@ -1174,19 +1174,20 @@ void Piece::Render(bool bLighting, bool bEdges, unsigned char* nLastColor, bool*
}
glEnable(GL_TEXTURE_2D);
- glBegin(GL_QUADS);
- glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[0]);
- glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[0]);
- glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[1]);
- glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[1]);
- glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[2]);
- glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[2]);
- glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[3]);
- glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[3]);
- glEnd();
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, m_pPieceInfo->m_pTextures[sh].vertex);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(2, GL_FLOAT, 0, m_pPieceInfo->m_pTextures[sh].coords);
+
+ glDrawArrays(GL_QUADS, 0, 4);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
}
+ glEnableClientState(GL_VERTEX_ARRAY);
+
if (m_pPieceInfo->m_nFlags & LC_PIECE_LONGDATA)
{
unsigned long colors, *info = (unsigned long*)m_pDrawInfo;