From 9b440b2d72b010d2ffbcd35c743d92f1b9180f2b Mon Sep 17 00:00:00 2001 From: flowtron Date: Sat, 8 May 2010 19:51:28 +0000 Subject: [PATCH] fixed renderhud:drawscope() buggy OpenGL code git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4823 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/renderhud.cpp | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index b0f326c1..de473087 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -95,19 +95,36 @@ void drawscope() x2 = VIRTW/2 + w/2; float s1 = VIRTW/16, s2 = VIRTH/24; glDisable(GL_BLEND); - glColor3ub(0, 0, 0); - glBegin(GL_TRIANGLE_FAN); - glVertex2f( 0, 0); glVertex2f(VIRTW, 0); glVertex2f(VIRTW, 4*s2); glVertex2f( 0, 4*s2); - glVertex2f( 0, 4*s2); glVertex2f( 3*s1, 4*s2); glVertex2f( 3*s1, 20*s2); glVertex2f( 0, 20*s2); - glVertex2f( 0, 20*s2); glVertex2f(VIRTW, 20*s2); glVertex2f(VIRTW, VIRTH); glVertex2f( 0, VIRTH); - glVertex2f(13*s1, 4*s2); glVertex2f(VIRTW, 4*s2); glVertex2f(VIRTW, 20*s2); glVertex2f(13*s1,20*s2); - glEnd(); - glBegin(GL_TRIANGLES); - glVertex2f( 3*s1, 3*s2); glVertex2f( 7*s1, 3*s2); glVertex2f( 3*s1, 9*s2); - glVertex2f( 9*s1, 3*s2); glVertex2f(14*s1, 3*s2); glVertex2f(14*s1, 9*s2); - glVertex2f(14*s1,15*s2); glVertex2f(14*s1,20*s2); glVertex2f( 9*s1,20*s2); - glVertex2f( 7*s1,20*s2); glVertex2f( 3*s1,20*s2); glVertex2f( 3*s1,15*s2); - glEnd(); + + glBegin(GL_QUADS); + glColor3ub( 0, 0, 0); + //glColor3ub(255, 0, 0); + glVertex2f( 0, 0); + glVertex2f(VIRTW, 0); + glVertex2f(VIRTW, 4*s2); + glVertex2f( 0, 4*s2); + + glVertex2f( 0, 4*s2); + glVertex2f(3*s1, 4*s2); + glVertex2f(3*s1,20*s2); + glVertex2f( 0,20*s2); + + glVertex2f( 0, 20*s2); + glVertex2f(VIRTW, 20*s2); + glVertex2f(VIRTW, VIRTH); + glVertex2f( 0, VIRTH); + + glVertex2f(13*s1, 4*s2); + glVertex2f(VIRTW, 4*s2); + glVertex2f(VIRTW,20*s2); + glVertex2f(13*s1,20*s2); + glEnd(); + glBegin(GL_TRIANGLES); + glVertex2f( 3*s1, 3*s2); glVertex2f( 7*s1, 3*s2); glVertex2f( 3*s1, 9*s2); + glVertex2f( 9*s1, 3*s2); glVertex2f(14*s1, 3*s2); glVertex2f(14*s1, 9*s2); + glVertex2f(14*s1,15*s2); glVertex2f(14*s1,20*s2); glVertex2f( 9*s1,20*s2); + glVertex2f( 7*s1,20*s2); glVertex2f( 3*s1,20*s2); glVertex2f( 3*s1,15*s2); + glEnd(); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, scopetex->id);