added R_Mesh_Draw_ShowTris function which draws a triangle mesh as lines
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 5 Nov 2003 03:34:24 +0000 (03:34 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 5 Nov 2003 03:34:24 +0000 (03:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3622 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
gl_backend.h
glquake.h

index 7769bbc..7cc799a 100644 (file)
@@ -617,7 +617,7 @@ void GL_ScissorTest(int state)
 {
        if(gl_state.scissortest == state)
                return;
-       
+
        CHECKGLERROR
        if((gl_state.scissortest = state))
                qglEnable(GL_SCISSOR_TEST);
@@ -1003,6 +1003,19 @@ void R_Mesh_State_Texture(const rmeshstate_t *m)
        }
 }
 
+void R_Mesh_Draw_ShowTris(int numverts, int numtriangles, int *elements)
+{
+       qglBegin(GL_LINES);
+       for (;numtriangles;numtriangles--, elements += 3)
+       {
+               qglArrayElement(elements[0]);qglArrayElement(elements[1]);
+               qglArrayElement(elements[1]);qglArrayElement(elements[2]);
+               qglArrayElement(elements[2]);qglArrayElement(elements[0]);
+       }
+       qglEnd();
+       CHECKGLERROR
+}
+
 /*
 ==============================================================================
 
index 72ce432..59cb3e0 100644 (file)
@@ -25,7 +25,6 @@ void GL_ActiveTexture(int num);
 void GL_ClientActiveTexture(int num);
 void GL_Scissor(int x, int y, int width, int height); // AK for DRAWQUEUE_SETCLIP
 void GL_ScissorTest(int state);        // AK for DRAWQUEUE_(RE)SETCLIP
 
 extern cvar_t gl_lockarrays;
 extern cvar_t gl_mesh_copyarrays;
@@ -76,6 +75,8 @@ void R_Mesh_State_Texture(const rmeshstate_t *m);
 
 // renders a mesh
 void R_Mesh_Draw(int numverts, int numtriangles, const int *elements);
+// renders a mesh as lines
+void R_Mesh_Draw_ShowTris(int numverts, int numtriangles, int *elements);
 
 // saves a section of the rendered frame to a .tga or .jpg file
 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg);
index 11ccd31..d871480 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -130,7 +130,16 @@ extern int gl_support_anisotropy;
 #define GL_REPEAT                              0x2901
 #define GL_CLAMP                               0x2900
 
-#define GL_TRIANGLES                           0x0004
+#define GL_POINTS                              0x0000
+#define GL_LINES                               0x0001
+#define GL_LINE_LOOP                   0x0002
+#define GL_LINE_STRIP                  0x0003
+#define GL_TRIANGLES                   0x0004
+#define GL_TRIANGLE_STRIP              0x0005
+#define GL_TRIANGLE_FAN                        0x0006
+#define GL_QUADS                               0x0007
+#define GL_QUAD_STRIP                  0x0008
+#define GL_POLYGON                             0x0009
 
 #define GL_FALSE                               0x0
 #define GL_TRUE                                        0x1