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