Hallo,
Hab das Problem schonmal im Chatroom gestellt. Ich versuche mithilfe von Direct3D ein Gitter zu zeichnen. Es wird aber nur teilweise gezeichnet.
Hier noch ein paar genaue Daten:
mein Vertexstruct:
struct SVertex {
float x;
float y;
float z;
float nx;
float ny;
float nz;
unsigned int color;
float u;
float v;
float tex3dx;
float tex3dy;
float tex3dz;
};
meine FVF-Einstellung:
format = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_NORMAL | D3DFVF_TEXCOORDSIZE3(0);
meine Einstellungen für den Vertexbuffer:
D3DDEVICE->CreateVertexBuffer(length*sizeof(SVertex),usage,D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_NORMAL | D3DFVF_TEXCOORDSIZE3(0),D3DPOOL_SYSTEMMEM,&VertexBuffer,0);
Die Vertexinformation, die pro Viereck in den Speicher geladen wird:
box *tempBox= new box;
tmpVertex=new SVertex;
tmpVertex->x=currentXPos;
tmpVertex->y=currentYPos;
tmpVertex->z=0;
tmpVertex->color=this->color;
tmpVertex->u=2; tmpVertex->v=2;
tempBox->box[0]= *tmpVertex;
vertices.push_back(*tmpVertex);
delete tmpVertex;
tmpVertex=new SVertex;
tmpVertex->x=currentXPos+this->boxWidth;
tmpVertex->y=currentYPos;
tmpVertex->z=0;
tmpVertex->color=this->color;
tmpVertex->u=0; tmpVertex->v=0;
tempBox->box[1]=*tmpVertex;
vertices.push_back(*tmpVertex);
delete tmpVertex;
tmpVertex=new SVertex;
tmpVertex->x=currentXPos+this->boxWidth;
tmpVertex->y=currentYPos+this->boxHeight;
tmpVertex->z=0;
tmpVertex->color=this->color;
tmpVertex->u=0; tmpVertex->v=2;
tempBox->box[2]=*tmpVertex;
vertices.push_back(*tmpVertex);
delete tmpVertex;
tmpVertex=new SVertex;
tmpVertex->x=currentXPos;
tmpVertex->y=currentYPos+this->boxHeight;
tmpVertex->z=0;
tmpVertex->color=this->color;
tmpVertex->u=2; tmpVertex->v=0;
tempBox->box[3]=*tmpVertex;
vertices.push_back(*tmpVertex);
delete tmpVertex;
Die Indexinformationen:
indices.push_back(indices.size()-k*4);
indices.push_back(indices.size()-k*4);
indices.push_back(indices.size()-1-k*4);
indices.push_back(indices.size()-1-k*4);
indices.push_back(indices.size()-2-k*4);
indices.push_back(indices.size()-2-k*4);
indices.push_back(indices.size()-3-k*4);
indices.push_back(indices.size()-7-k*4);
k++;
Für den, der sich das Problem nicht genau vorstellen kann lade ich eine zip-Datei mit der ausführbaren exe-Datei hoch(
http://www.file-upload.net/download-3590356/xEngine.rar.html). Für die, die Angst vor der exe-Datei haben, lade ich ein Bild hoch. Ich weiß wirklich nicht wo der Fehler liegen könnte. Ich vermute mittlerweile auch schon ein Treiberproblem oder so..
Das Gitter lässt sich über x,y und z(+) bzw. a,s und h (-) bewegen..
es sieht so aus, als ob es etwas mit der Projektionsmatrix zu tun hat oder so ... wenn das Gitter ohne setzten der Projektionsmatrix gezeichnet wird funktioniert es...
Danke schonmal im voraus......