🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Could someone please translate this C code to Delphi??
#include
#include
#include
// 8 Verticies
// 12 Triangles
static BYTE face_indicies[12][3] = {
// Object: Box01
{0,1,2 }, {1,3,2 }, {2,3,4 }, {3,5,4 }, {4,5,6 }, {5,7,6 }, {6,7,0 },
{7,1,0 }, {6,0,4 }, {0,2,4 }, {1,7,3 }, {7,5,3 }
};
static GLfloat verticies [8][3] = {
{-0.5f,0.341584f,0.5f},{-0.5f,-0.341584f,0.5f},{0.5f,0.341584f,0.5f},
{0.5f,-0.341584f,0.5f},{0.5f,0.341584f,-0.5f},{0.5f,-0.341584f,-0.5f},
{-0.5f,0.341584f,-0.5f},{-0.5f,-0.341584f,-0.5f}
};
GLint Gen3DObjectList()
{
int i;
int j;
GLint lid=glGenLists(1);
glNewList(lid, GL_COMPILE);
glBegin (GL_TRIANGLES);
for(i=0;i[j];
int ni=face_indicies[j+3];
//int ti=face_indicies[j+6];
glNormal3f (normals[ni][0],normals[ni][1],normals[ni][2]);
//glTexCoord2f(textures[ti][0],textures[ti][1]);
glVertex3f (verticies[vi][0],verticies[vi][1],verticies[vi][2]);
}
}
glEnd ();
glEndList();
return lid;
} </i>
const
face_indices : Array [0..11, 0..2] of Byte = ((0,1,2),(1,3,2), (2,3,4), (3,5,4), (4,5,6), (5,7,6), (6,7,0), (7,1,0), (6,0,4), (0,2,4), (1,7,3), (7,5,3));
vertices : Array [0..7, 0..2] of GLfloat = ((-0.5,0.341584,0.5),(-0.5,-0.341584,0.5),(0.5,0.341584f,0.5),
(0.5,-0.341584,0.5),(0.5,0.341584,-0.5),(0.5,-0.341584,-0.5),
(-0.5,0.341584,-0.5),(-0.5,-0.341584,-0.5));
function Gen3DObjectList() : GLint;
var
I, J : Integer;
lid : GLint;
vi : Integer;
ni : Integer;
ti : Integer;
begin
lid := glGenLists(1);
glNewList(lid, GL_COMPILE);
glBegin(GL_TRIANGLES);
for I := 0 to ? do begin
for J := 0 to 2 do begin
vi := face_vertices[j];
ni := face_vertices[j+3];
// ti := face_vertices[j+6];<br> glNormal3f(normals[ni][0], normals[ni][1], normals[ni][2]);<br> // glTexCoord2f(textures[ti][0], textures[ti][1]);<br> glVertex3f(vertices[vi][0], vertices[vi][1], vertices[vi][2]);<br> end;<br> end;<br> glEnd();<br> result := lid;<br>end;<br> </i> <br><br>—<br>I write code.
face_indices : Array [0..11, 0..2] of Byte = ((0,1,2),(1,3,2), (2,3,4), (3,5,4), (4,5,6), (5,7,6), (6,7,0), (7,1,0), (6,0,4), (0,2,4), (1,7,3), (7,5,3));
vertices : Array [0..7, 0..2] of GLfloat = ((-0.5,0.341584,0.5),(-0.5,-0.341584,0.5),(0.5,0.341584f,0.5),
(0.5,-0.341584,0.5),(0.5,0.341584,-0.5),(0.5,-0.341584,-0.5),
(-0.5,0.341584,-0.5),(-0.5,-0.341584,-0.5));
function Gen3DObjectList() : GLint;
var
I, J : Integer;
lid : GLint;
vi : Integer;
ni : Integer;
ti : Integer;
begin
lid := glGenLists(1);
glNewList(lid, GL_COMPILE);
glBegin(GL_TRIANGLES);
for I := 0 to ? do begin
for J := 0 to 2 do begin
vi := face_vertices[j];
ni := face_vertices[j+3];
// ti := face_vertices[j+6];<br> glNormal3f(normals[ni][0], normals[ni][1], normals[ni][2]);<br> // glTexCoord2f(textures[ti][0], textures[ti][1]);<br> glVertex3f(vertices[vi][0], vertices[vi][1], vertices[vi][2]);<br> end;<br> end;<br> glEnd();<br> result := lid;<br>end;<br> </i> <br><br>—<br>I write code.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement