Could you please help this newbie?

I just started out doing some OpenGL programing and could use some help.
I tried using 3DWin4 to get some source code from a 3DS file. But I since I’m new to this I need someone to help me explain the source it produces.
I have managed to render some sort of wireframe but how to I make it solid and/or map textures to the object?
Posted below is the source generated from a simple box i made and if anyone could show me how to properly render this as a solid cube I would really appriciate your help.
BTW, I left out the header file because you probably know what it looks like if you are able to help.

Thanks in advance!

/*
Copyright by Thomas Baier (thomas.baier@stmuc.com)
Created by OpenGL Export Plugin 1.0 at Fri Apr 13 02:02:03 2001
OpenGL-Structure
*/

#include “scene.h”

float WorldBoundMin[3] = {-8.674699f, 3.373494f, 0.000000f};
float WorldBoundMax[3] = {-1.927711f, 10.120481f, 4.819277f};

/* BackGround /
float background[3] = { 0.000000f, 0.000000f, 0.000000f};
/
Lights /
Light_Def lights[MAX_LIGHTS] =
{
/
PointLight: def_light1*/
{{0.800000f, 0.800000f, 0.800000f},{11.672642f, 36.146552f, 20.240963f},0,{0.000000f, 0.000000f, 0.000000f},0.000000f,0.000000f},
/* PointLight: def_light2*/
{{0.700000f, 0.700000f, 0.700000f},{-39.248897f, 6.746988f, 20.240963f},0,{0.000000f, 0.000000f, 0.000000f},0.000000f,0.000000f},
/* PointLight: def_light3*/
{{0.600000f, 0.600000f, 0.600000f},{11.672642f, -22.652576f, 20.240963f},0,{0.000000f, 0.000000f, 0.000000f},0.000000f,0.000000f}
};
/* Materials /
Material_Def materials[MAX_MATERIALS] =
{
/
Material: DEFAULT*/
{{0.300000f, 0.300000f, 0.300000f},{0.600000f, 0.600000f, 0.600000f},{0.900000f, 0.900000f, 0.900000f},{0.000000f, 0.000000f, 0.000000f},1.000000f,-1}
};
/* Texture Maps*/
Map_Def texture_maps[1] =
{
0
};
/* Object: Box010*/
/* Vertices /
#define MAX_VERTICES_0 (8)
float verticies_0[MAX_VERTICES_0 * 3] =
{
-8.674699f, 3.373494f, 0.000000f ,
-1.927711f, 3.373494f, 0.000000f ,
-8.674699f, 10.120481f, 0.000000f ,
-1.927711f, 10.120481f, 0.000000f ,
-8.674699f, 3.373494f, 4.819277f ,
-1.927711f, 3.373494f, 4.819277f ,
-8.674699f, 10.120481f, 4.819277f ,
-1.927711f, 10.120481f, 4.819277f
};
/
Normals /
#define MAX_NORMALS_0 (6)
float normals_0[MAX_NORMALS_0 * 3] =
{
0.000000f, 0.000000f, -1.000000f ,
0.000000f, 0.000000f, 1.000000f ,
0.000000f, -1.000000f, 0.000000f ,
1.000000f, 0.000000f, 0.000000f ,
0.000000f, 1.000000f, 0.000000f ,
-1.000000f, 0.000000f, 0.000000f
};
/
Textures */
#define MAX_TEXTURES_0 (0)
float textures_0 = 0;
/
Faces */
#define MAX_FACE_INDICES_0 (12)
int face_indicies_0[MAX_FACE_INDICES_0 * 9] =
{
0, 2, 3 ,0, 0, 0 ,-1, -1, -1 ,
3, 1, 0 ,0, 0, 0 ,-1, -1, -1 ,
4, 5, 7 ,1, 1, 1 ,-1, -1, -1 ,
7, 6, 4 ,1, 1, 1 ,-1, -1, -1 ,
0, 1, 5 ,2, 2, 2 ,-1, -1, -1 ,
5, 4, 0 ,2, 2, 2 ,-1, -1, -1 ,
1, 3, 7 ,3, 3, 3 ,-1, -1, -1 ,
7, 5, 1 ,3, 3, 3 ,-1, -1, -1 ,
3, 2, 6 ,4, 4, 4 ,-1, -1, -1 ,
6, 7, 3 ,4, 4, 4 ,-1, -1, -1 ,
2, 0, 4 ,5, 5, 5 ,-1, -1, -1 ,
4, 6, 2 ,5, 5, 5 ,-1, -1, -1
};
#define DEF_MAT_REF_0 (0)

/* Objects */
Object_Def objects[MAX_OBJECTS] =
{
{face_indicies_0, MAX_FACE_INDICES_0, verticies_0, MAX_VERTICES_0, normals_0, MAX_NORMALS_0, textures_0, MAX_TEXTURES_0, DEF_MAT_REF_0 }
};

the quick and dirty way to get your polygons filled is to use:
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

b

OK, I don’t know how your rendering function looks but without worrying about lights, textures, etc here goes.

For a quick and easy solution using your vertices_0 values I’d use:

glBegin(GL_QUADS);
// Back face.
glVertex3f(-8.674699f, 3.373494f, 0.000000f);
glVertex3f(-8.674699f, 10.120481f, 0.000000f);
glVertex3f(-1.927711f, 10.120481f, 0.000000f);
glVertex3f(-1.927711f, 3.373494f, 0.000000f);

// Front face.
glVertex3f(-1.927711f, 3.373494f, 4.819277f);
glVertex3f(-1.927711f, 10.120481f, 4.819277f);
glVertex3f(-8.674699f, 10.120481f, 4.819277f);
glVertex3f(-8.674699f, 3.373494f, 4.819277f);

// Right face.
glVertex3f(-1.927711f, 3.373494f, 0.000000f);
glVertex3f(-1.927711f, 10.120481f, 0.000000f);
glVertex3f(-1.927711f, 10.120481f, 4.819277f);
glVertex3f(-1.927711f, 3.373494f, 4.819277f);

// Left face.
glVertex3f(-8.674699f, 3.373494f, 4.819277f);
glVertex3f(-8.674699f, 10.120481f, 4.819277f);
glVertex3f(-8.674699f, 10.120481f, 0.000000f);
glVertex3f(-8.674699f, 3.373494f, 0.000000f);

// Top face.
glVertex3f(-8.674699f, 10.120481f, 4.819277f);
glVertex3f(-1.927711f, 10.120481f, 4.819277f);
glVertex3f(-1.927711f, 10.120481f, 0.000000f);
glVertex3f(-8.674699f, 10.120481f, 0.000000f);

// Bottom face.
glVertex3f(-1.927711f, 3.373494f, 4.819277f);
glVertex3f(-8.674699f, 3.373494f, 4.819277f);
glVertex3f(-8.674699f, 3.373494f, 0.000000f);
glVertex3f(-1.927711f, 3.373494f, 0.000000f);

glEnd();

Notice that you have to specify each vertex 3 times, once for each of the quads that it is a vertex of. There are many other ways to render the vertices of a cube. This is perhaps the easiest to understand. For some good cube examples including lighting and texture mapping cubes check out http://nehe.gamedev.net/opengl.asp

Hope this helps,
Toby

[This message has been edited by ffish (edited 04-16-2001).]

Thanks for the replies m8’s.
But what I really was hoping for was a way to automate the task of rendering my objects.
I’m pretty sure that there’s a way to render these objects without modifieng any of the code produced by 3DWin.

And your’e right I’m not interested in the lighting and textures, I just want to render the mesh and understand how it’s done properly