• ### Announcements

#### Archived

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

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

## 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);
}

glEnd();
blah blah blah...

I fseek, therefore I fam.

##### Share on other sites
that code looks fine..it has to be either the face indices or the vertex data that is screwed.

##### 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.

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978615

• 13
• 12
• 10
• 12
• 22