Archived

This topic is now archived and is closed to further replies.

Bitwise

Can anyone see anything wrong with this code?

Recommended Posts

Bitwise    122
I am trying to display all the vertexes contatined in a Q3 BSP file. I am pretty sure they are loaded correctly before this drawing code is executed. (I know the vertex data does contain numbers that should be displayed regardless of whether they are loaded properly or not) Anyways, Here is my main drawing routine which is bases off of some NeHe basecode I think: int DrawGLScene(GLvoid) // Here''s Where We Do All The Drawing { glEnable(GL_DEPTH_TEST); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(camX,camY,camZ); // Move camera bsp.DrawVertexes(); return 0; } Here is BSPFile::DrawVertexes() : BSPFile::DrawVertexes() { glColor3f(0.0f,1.0f,0.0f); for (int vCount = 0; vCount < numVertexes; vCount++) { glBegin(GL_POINTS); glVertex3f(vertex[vCount].position[0],vertex[vCount].position[1],vertex[vCount].position[2]); glEnd(); } return 0; } All I get is a blank screen whatever color glClearColor sets it to. I know it is probably something fundamental. Thanks. Bitwise

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
are you sure numvertexes is set properly? and I''m not sure on this, but I think performance would be better if you did the for loop inside the glBegin and glEnd calls.

Share this post


Link to post
Share on other sites
Bitwise    122
Oops, I missed that. I did have the for loop inside the glBegin() glEnd() but since I was having problems I was experimenting to see if that would help. I just forgot to change it back. Either way it still doesn''t work.

Bitwise

Share this post


Link to post
Share on other sites
Mezz    571
Well, I can''t claim to be an expert on BSP rendering but I do see that you''re drawing the vertices as points. I''ve done graphics code tests in the past with these and the inevitable outcome is that I always have a problem in that I can never see the bastard things when I first test the app, and I wonder what is wrong. Have you considered drawing with lines, or perhaps just scaling up the point size using glPointSize*(...) I don''t know if you''re doing that already though.
Have you tried stepping through your code with the debugger too, you may find you''ve actually missed out calling a routine somewhere (yes I do that on occasion - Why doesn''t this file load damnit!?!? oh I havent told it to...)

-Mezz

Share this post


Link to post
Share on other sites