Hey guys,
i know, it’s not really good to come in a forum as a newby and directly ask something, but i just don’t find the answer by searching in the web.
(I’m sorry if my english is a bit bad, i hopy you can understand it though^^)
So, my problem is the following thing. Due to a school project, i write a little graphic engine using OpenGL. It works quite fine, but since I added support for using Displaylists something odd happens.
The engine should just, at the moment, show a triangle and the current fps. I have tested that on 13 PCs, but only on 7 PCs is the triangle shown. However, The fps counter is always shown.
So I gave an other version to these “Non triangle testers” to determine where the error is. Surprisingly, there is no error. All the data is the same as by the testers, who have a triangle. Even glGetError always returns 0.
I will post some code, maybe it helps you to determine the error, because i can’t see it.
The function to add an object:
void CDevice::AddSingleObject(Vertex *Vertices, int Count)
{
C3DObject *NewObject;
NewObject=new C3DObject;
NewObject->CreateMeshes(1);
NewObject->Meshes[0].CreateMesh(Vertices,Count);
NewObject->Next=NULL;
NewObject->Prev=LastObject;
LastObject->Next=NewObject;
LastObject=NewObject;
}
The function to create a mesh for an object:
void CMesh::CreateMesh(Vertex *Vertices, int Count)
{
int i;
this->Vertices=new Vertex[Count];
AmountVertices=Count;
for(i=0;i<Count;i++)
{
this->Vertices[i].X=Vertices->X;
this->Vertices[i].Y=Vertices->Y;
this->Vertices[i].Z=Vertices->Z;
Vertices++;
}
}
The function to create a displaylist:
bool CMesh::BuildDisplayList()
{
int i;
Object=glGenLists(1);
glNewList(this->Object,GL_COMPILE);
glBegin(GL_TRIANGLES);
for(i=0;i<AmountVertices;i++)
{
glVertex3f(this->Vertices[i].X,this->Vertices[i].Y,this->Vertices[i].Z);
}
glEnd();
glEndList();
return (this->Object==NULL) ? false : true;
}
And maybe a download link to the engine Link
Do you have any idea why the triangle is only shown on some pc and not on all?
Thanks in advance,
Shelling