Tim Stirling

12-17-2000, 03:40 AM

Hi and thankyou if you can help.

Firstly:- I have found away to load half-life maps with help from flipcode but anyway I load the file which has a list of vertices and polygons that have these vertices. so a cube can be stored with just its 8 corners and a list of polygons pointing to the corners. I can load the data correctly into a structure(similar to nehe's simple world tutorial). In the drawing function I have checked all the data and seen that it is all correct however it doesn't draw anything. I have put a test triangle in that doesn't use any loaded data and this works fine. The code looks ok to me -

// test triangle that works

glBindTexture(GL_TEXTURE_2D, texture[0]);

glBegin(GL_TRIANGLES);

glTexCoord2f(0,0); glVertex3f(0,0,0);

glTexCoord2f(1,0); glVertex3f(1,0,0);

glTexCoord2f(1,1); glVertex3f(1,1,0);

glEnd();

numtriangles = sector[0].numtriangles;

int vert[4];

// Process Each Triangle

for (int loop_m = 0; loop_m < 6; loop_m++)

{

glBindTexture(GL_TEXTURE_2D, texture[0]);

glBegin(GL_POLYGON);

vert[0] = sector[0].triangle [loop_m].vertex[0];

vert[1] = sector[0].triangle[loop_m].vertex[1];

vert[2] = sector[0].triangle[loop_m].vertex[2];

vert[3] = sector[0].triangle[loop_m].vertex[3];

x_m = sector[0].point[vert[0]].x;

y_m = sector[0].point[vert[0]].y;

z_m = sector[0].point[vert[0]].z;

glTexCoord2f(0,0); glVertex3f(x_m,y_m,z_m);

x_m = sector[0].point[vert[1]].x;

y_m = sector[0].point[vert[1]].y;

z_m = sector[0].point[vert[1]].z;

glTexCoord2f(1,0); glVertex3f(x_m,y_m,z_m);

x_m = sector[0].point[vert[2]].x;

y_m = sector[0].point[vert[2]].y;

z_m = sector[0].point[vert[2]].z;

glTexCoord2f(1,1); glVertex3f(x_m,y_m,z_m);

x_m = sector[0].point[vert[3]].x;

y_m = sector[0].point[vert[3]].y;

z_m = sector[0].point[vert[3]].z;

glTexCoord2f(0,1); glVertex3f(x_m,y_m,z_m);

glEnd();

}

I know is sector[0].triangle[] etc. but that doesn't matter, it does hold the 4 points for a quad.(all the data is in quads.)

As i said all the data is correct but nothing in the for loop draws while the triangle at the top does, there is no error message or anything out of the ordinary. Can someone please help. http://www.opengl.org/discussion_boards/ubb/frown.gif

Firstly:- I have found away to load half-life maps with help from flipcode but anyway I load the file which has a list of vertices and polygons that have these vertices. so a cube can be stored with just its 8 corners and a list of polygons pointing to the corners. I can load the data correctly into a structure(similar to nehe's simple world tutorial). In the drawing function I have checked all the data and seen that it is all correct however it doesn't draw anything. I have put a test triangle in that doesn't use any loaded data and this works fine. The code looks ok to me -

// test triangle that works

glBindTexture(GL_TEXTURE_2D, texture[0]);

glBegin(GL_TRIANGLES);

glTexCoord2f(0,0); glVertex3f(0,0,0);

glTexCoord2f(1,0); glVertex3f(1,0,0);

glTexCoord2f(1,1); glVertex3f(1,1,0);

glEnd();

numtriangles = sector[0].numtriangles;

int vert[4];

// Process Each Triangle

for (int loop_m = 0; loop_m < 6; loop_m++)

{

glBindTexture(GL_TEXTURE_2D, texture[0]);

glBegin(GL_POLYGON);

vert[0] = sector[0].triangle [loop_m].vertex[0];

vert[1] = sector[0].triangle[loop_m].vertex[1];

vert[2] = sector[0].triangle[loop_m].vertex[2];

vert[3] = sector[0].triangle[loop_m].vertex[3];

x_m = sector[0].point[vert[0]].x;

y_m = sector[0].point[vert[0]].y;

z_m = sector[0].point[vert[0]].z;

glTexCoord2f(0,0); glVertex3f(x_m,y_m,z_m);

x_m = sector[0].point[vert[1]].x;

y_m = sector[0].point[vert[1]].y;

z_m = sector[0].point[vert[1]].z;

glTexCoord2f(1,0); glVertex3f(x_m,y_m,z_m);

x_m = sector[0].point[vert[2]].x;

y_m = sector[0].point[vert[2]].y;

z_m = sector[0].point[vert[2]].z;

glTexCoord2f(1,1); glVertex3f(x_m,y_m,z_m);

x_m = sector[0].point[vert[3]].x;

y_m = sector[0].point[vert[3]].y;

z_m = sector[0].point[vert[3]].z;

glTexCoord2f(0,1); glVertex3f(x_m,y_m,z_m);

glEnd();

}

I know is sector[0].triangle[] etc. but that doesn't matter, it does hold the 4 points for a quad.(all the data is in quads.)

As i said all the data is correct but nothing in the for loop draws while the triangle at the top does, there is no error message or anything out of the ordinary. Can someone please help. http://www.opengl.org/discussion_boards/ubb/frown.gif