Archived

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

Novalis

OpenGL hanging...?

Recommended Posts

I have this really simple app which allows you to control (in 3rd person) a character running around in a tile based maze. The character is a half life model, and the maze is composed of Lightwave objects. The problem occurs when I draw the Lightwave objects. What happens is that after some apperantly random amount of time the entire computer (with the exception of the trusty mouse) hangs and I have to reboot. I''m pretty confident it''s not my code, as the code is super trivial, but just in case here is the heart of the Lightwave object rendering code... void DrawTile(int x, int y, int tile) { unsigned int pt; LWFACE *face; glPushMatrix(); glTranslated(x * 120.0, y * 120.0, 0.0); glFrontFace(GL_CW); face = m_tiles[tile]->faces; while(face) { glBegin(GL_POLYGON); glColor4ubv(m_tiles[tile]->surfaces[face->surface].rgba); glNormal3fv(face->normal); if(face->normal[2] != 0) glColor3f(1, 0, 0); for(pt=0; ptptnum; pt++) glVertex3fv(m_tiles[tile]->points[face->points[pt]]); glEnd(); face = face->next; } glFrontFace(GL_CCW); glPopMatrix(); } Super simple as you can see. What really convinces me it''s not a problem in my code though, is that Lightwave Modeler occasionally hangs the computer in the exact same fashion when showing the models I''m using. Now, you''re probably thinking it''s the models that are bad? Well, these same models seem to work fine on other computers. The only computer which exhibits this problem is an NT workstation with an ATI Rage Fury in it. I just installed the latest drivers this morning, and the problem still exists. Last but not least, I actually "hand examined" the data for one of the objects and it looks very typical to me. So, has anyone else experienced this or a similar problem? How did you solve it? Any suggestions as to further tests I can do to eliminate the possibility of bugs in my own code? It happens so sporadically that I can''t just step through it with a debugger... I just don''t know where to go next!

Share this post


Link to post
Share on other sites
Some additional information:

Everything seems to work fine with the SGI implementation of OpenGL. So this leads me to believe it''s a bug in the MS OpenGL libraries...

wolfman8k: Modeler doesn''t crash when I load the model. It loads the model just fine, and will display it without any visible problems for a while. However, if I spin the model around a lot in the OpenGL rendered view of the model, eventually the whole computer will abruptly hang. Similarly, my program works "for a while", but as I move around in the maze all of a sudden the whole computer hangs. This is saying a lot since we''re talking NT, which usually catches programs before they kill the whole OS.

So for now I will continue development using the SGI libraries, but I''d like to go back to the MS libraries (I believe they offer better support for hardware rendering?). So to re-iterate my question, what should my next step be to work around this problem in my software?

Share this post


Link to post
Share on other sites
Well, it seems I was too quick to vindicate the SGI implementation. It hangs too...

However, I did cheat a little bit... In my post above I use "glBegin(GL_POLYGON);", in fact when I do that, everything works fine... The only time GL seems to hang is when I replace that with GL_LINE_LOOP or GL_LINES.

The final project will use the GL_POLYGON version, but for testing I''d like to be able to use line loops... Any thoughts?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It must be a bug in the opengl driver of your 3d card.

Share this post


Link to post
Share on other sites