Jump to content
  • Advertisement


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


How come I can export fine but ogl drawing messes up?!?

This topic is 5869 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I can build a mesh fine, first by drawing a grid of points, then connecting the dots via 1,2,4,3 (quads).. When I export it as an .OBJ it imports fine into a 3D modeller with correct number of points,faces,etc (cept maybe the normals, haven''t gotten to that part yet. When I have opengl draw it, it looks all messed up. Rendered either in GL_LINES, SOLID, or QUADS it looks like it is drawing across a face to get to the next vertex. Below is the code, going in face order of 1,2,4,3. On a 16x16, the faces point as such: 1,2,18,17 2,3,19,18 .. 15,16,32,31 31,32,48,47 < moves to the next column of rows, drawing backwards 30,31,47,46 .. Here is the code I use to draw with:
            glPushMatrix ();
            for (e=0; e<225; e++) {

                glColor3f(D3P[D3F[e].f1].y, 255, 255);
                glVertex3f(D3P[D3F[e].f1].x, D3P[D3F[e].f1].y, D3P[D3F[e].f1].z);
                glColor3f(D3P[D3F[e].f2].y, 255, 255);
                glVertex3f(D3P[D3F[e].f2].x, D3P[D3F[e].f2].y, D3P[D3F[e].f2].z);
                glColor3f(D3P[D3F[e].f4].y, 255, 255);
                glVertex3f(D3P[D3F[e].f4].x, D3P[D3F[e].f4].y, D3P[D3F[e].f4].z);
                glColor3f(D3P[D3F[e].f3].y, 255, 255);
                glVertex3f(D3P[D3F[e].f3].x, D3P[D3F[e].f3].y, D3P[D3F[e].f3].z);

blah blah blah...
I fseek, therefore I fam.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
that code looks fine..it has to be either the face indices or the vertex data that is screwed.

Share this post

Link to post
Share on other sites
I feels like such an ideeot now.. I didn''t build the vertices the same way I am building the faces now. I didn''t even glance back at my function to build the vertexes cause I am thinking all I need is a grid of points. But the coordinates need to match up to the lines.. Doh! What do they say about playing with forces you don''t understand?

Thank you very much for sparking my opengl numbed brain

I fseek, therefore I fam.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!