RobertSI
08-02-2000, 08:16 AM
//I converted a simple bent tube in 3dMax to a 3ds file and got the coordinates with Crossroads.
//and changed the array around to GLfloat Tube01[][3] = {........etc.};
//The shape renders in GL_POINTS, but is all screwed up in GL_TRIANGLES, please help.
//No lighting is used, triangles seem missing.
//I didnt use any of the OpenGL array functions because I don't know if you can get unknown nth elements with them
void display(void)
{
int i,arraySize,numVertx;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1.0,0.0,0.0);
//this finds the number of elements and vertices in n-Array
//num of bytes in array divided by size of element type 'GLfloat'
arraySize = sizeof(Tube01)/4;
//num of elements in vertex - x,y,z
numVertx = arraySize/3;
glPushMatrix();
glRotatef(rotate,1.0,0.0,0.0);
glBegin(GL_POINTS);
//step through the array vertices
for(i = 1; i <= numVertx;i++)
{
glVertex3fv(Tube01[i]);
}
glEnd();
glPopMatrix();
glutSwapBuffers();
}
//and changed the array around to GLfloat Tube01[][3] = {........etc.};
//The shape renders in GL_POINTS, but is all screwed up in GL_TRIANGLES, please help.
//No lighting is used, triangles seem missing.
//I didnt use any of the OpenGL array functions because I don't know if you can get unknown nth elements with them
void display(void)
{
int i,arraySize,numVertx;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1.0,0.0,0.0);
//this finds the number of elements and vertices in n-Array
//num of bytes in array divided by size of element type 'GLfloat'
arraySize = sizeof(Tube01)/4;
//num of elements in vertex - x,y,z
numVertx = arraySize/3;
glPushMatrix();
glRotatef(rotate,1.0,0.0,0.0);
glBegin(GL_POINTS);
//step through the array vertices
for(i = 1; i <= numVertx;i++)
{
glVertex3fv(Tube01[i]);
}
glEnd();
glPopMatrix();
glutSwapBuffers();
}