Make SetProjectionTransform set the projection transform.

Remove unused variable.
Add a function to draw an antialiased line loop with rounded corners.
This commit is contained in:
Glenn Maynard
2002-11-14 08:38:41 +00:00
parent f08a747182
commit 88264c3a56
2 changed files with 33 additions and 2 deletions
+32 -2
View File
@@ -47,7 +47,6 @@ GLenum g_vertMode = GL_TRIANGLES;
RageVertex g_vertQueue[MAX_NUM_VERTICIES];
RageTimer g_LastCheckTimer;
int g_iNumVerts;
float g_fLastCheckTime;
int g_iFPS, g_iVPF, g_iDPF;
int g_glVersion;
@@ -302,6 +301,37 @@ void RageDisplay::DrawStrip( const RageVertex v[], int iNumVerts )
AddVerts( v, iNumVerts );
FlushQueue();
}
void RageDisplay::DrawLoop( const RageVertex v[], int iNumVerts, float LineWidth )
{
ASSERT( iNumVerts >= 3 );
if( g_vertMode != GL_LINE_LOOP )
FlushQueue();
/* Line antialiasing is fast on most hardware, and saying "don't care"
* should turn it off if it isn't. */
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glHint(GL_POINT_SMOOTH_HINT, GL_DONT_CARE);
glLineWidth(LineWidth);
/* Draw the line loop: */
g_vertMode = GL_LINE_LOOP;
AddVerts( v, iNumVerts );
FlushQueue();
/* Round off the corners: */
glPointSize(LineWidth);
g_vertMode = GL_POINTS;
AddVerts( v, iNumVerts-1 );
FlushQueue();
glDisable(GL_LINE_SMOOTH);
glDisable(GL_POINT_SMOOTH);
}
void RageDisplay::AddVerts( const RageVertex v[], int iNumVerts )
{
for( int i=0; i<iNumVerts; i++ )
@@ -341,7 +371,7 @@ void RageDisplay::SetViewTransform( const RageMatrix* pMatrix )
void RageDisplay::SetProjectionTransform( const RageMatrix* pMatrix )
{
FlushQueue();
glMatrixMode( GL_MODELVIEW );
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (float*)pMatrix );
}
void RageDisplay::GetViewTransform( RageMatrix* pMatrixOut )
+1
View File
@@ -68,6 +68,7 @@ public:
void DrawQuads( const RageVertex v[], int iNumVerts );
void DrawFan( const RageVertex v[], int iNumVerts );
void DrawStrip( const RageVertex v[], int iNumVerts );
void DrawLoop( const RageVertex v[], int iNumVerts, float LineWidth );
void FlushQueue();
int GetMaxTextureSize() const;