It wasn't me who downvoted, video is way too long just to show that it's not loading, not to mention you already told that in the first post. Fact that it doesn't load doesn't help to solve it, we need error messages or at least some code.
Your operating system looks like Windows Vista either Windows 7, you could use PIX from DirectX SDK to analyse whether your buffers were created, see how mesh looks like before and after vertex shader, etc.
If there's more indices loaded - does the shader need to have more bytes?
Loads index's and Vertex's
Namespace ModelManger - Class Model. Native Class code MESH. Native Class just has declarations for VertexCount and Indices.
This is part of the Loading Custom Mesh.
this loads the SGM file and sorts through everything. Making sure it's X,Y,Z, Normals, and U, Vs.
INside the converter the program loads the OBJ values and when converting sorts them out through their indices. So, there's no need to worry about figuring out the indices. This is where the Indices come into play because there's no Indices to worry about. Additionally, when converted the SGM model format is already indexed flipped and minutes Z's for texture coord, normals, and vertices.
This is the draw call inside the engine.
This function updates the matrixes.
The position and rotations are both set in the editor.
I didn't mean to get all hasty but minus a point for trying to show a video on what I'm talking about. Just doesn't make sense.
Namespace ModelManger - Class Model. Native Class code MESH. Native Class just has declarations for VertexCount and Indices.
This is part of the Loading Custom Mesh.
D3D11_BUFFER_DESC indexBufferDesc;
ZeroMemory( &indexBufferDesc, sizeof(indexBufferDesc) );
indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
indexBufferDesc.ByteWidth = sizeof(unsigned long) * MESH->IndexCount;
indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
indexBufferDesc.CPUAccessFlags = 0;
indexBufferDesc.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA iinitData;
iinitData.pSysMem = indices;
dev->CreateBuffer(&indexBufferDesc, &iinitData, &pIBuffer);
devcon->IASetIndexBuffer( pIBuffer, DXGI_FORMAT_R32_UINT, 0);
D3D11_BUFFER_DESC vertexBufferDesc;
ZeroMemory( &vertexBufferDesc, sizeof(vertexBufferDesc) );
vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
vertexBufferDesc.ByteWidth = sizeof(Mesh::VERTEX) * MESH->VertexCount;
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA vertexBufferData;
ZeroMemory( &vertexBufferData, sizeof(vertexBufferData) );
vertexBufferData.pSysMem = OBJVertices;
HR( dev->CreateBuffer( &vertexBufferDesc, &vertexBufferData, &pVBuffer));
D3DX11CreateShaderResourceViewFromFile(dev, // the Direct3D device
L"Wood.png", // load Wood.png in the local folder
NULL, // no additional information
NULL, // no multithreading
&pTexture, // address of the shader-resource-view
NULL); // no multithreading
this loads the SGM file and sorts through everything. Making sure it's X,Y,Z, Normals, and U, Vs.
bool result;
char input;
char input2;
ifstream fin;
MESH->VertexCount = 0;
MESH->IndexCount = 0;
// VertexIndex *verIndex;
unsigned long * indices;
fin.open(filename);
if(fin.fail() == true) {
return false;
}
fin.get(input);
while(input != ':') {
fin.get(input);
}
fin >> MESH->VertexCount;
MESH->IndexCount = MESH->VertexCount;
indices = new unsigned long[MESH->IndexCount];
Mesh::VERTEX *OBJVertices;
OBJVertices = new Mesh::VERTEX[MESH->VertexCount];
fin.get(input);
while(input != ':') {
fin.get(input);
}
fin.get(input);
fin.get(input);
for(int i = 0; i<MESH->VertexCount; i++) {
int normx, normy, normz;
fin >> OBJVertices.x >> OBJVertices.y >> OBJVertices.z >> normx >> normy >> normz >> OBJVertices.U >> OBJVertices.V;
OBJVertices.Normal = D3DXVECTOR3(normx,normy,normz);
indices = i;
}
fin.close();
INside the converter the program loads the OBJ values and when converting sorts them out through their indices. So, there's no need to worry about figuring out the indices. This is where the Indices come into play because there's no Indices to worry about. Additionally, when converted the SGM model format is already indexed flipped and minutes Z's for texture coord, normals, and vertices.
This is the draw call inside the engine.
void Draw() {
cBuffer.LightVector = D3DXVECTOR4(1.0f, 4.0f, -2.0f,0.0f);
cBuffer.LightColor = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
cBuffer.AmbientColor = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);
// select which vertex buffer to display
UINT stride = sizeof(Mesh::VERTEX);
UINT offset = 0;
devcon->IASetVertexBuffers(0, 1, &pVBuffer, &stride, &offset);
devcon->IASetIndexBuffer(pIBuffer, DXGI_FORMAT_R32_UINT, 0);
// select which primtive type we are using
devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
// draw the Hypercraft
devcon->UpdateSubresource(pCBuffer, 0, 0, &cBuffer, 0, 0);
devcon->PSSetShaderResources(0, 1, &pTexture);
devcon->DrawIndexed(MESH->VertexCount, 0, 0);
}
This function updates the matrixes.
void update_Matrixes() {
//--- Let's see if we need to move camera anywehere important.
MESH->worldMatrix = MESH->rotation_Matrix * MESH->translation_Matrix;
cBuffer.final = MESH->worldMatrix * viewMatrix * projectionMatrix;
cBuffer.Rotation = MESH->rotation_Matrix;
}
The position and rotations are both set in the editor.
I didn't mean to get all hasty but minus a point for trying to show a video on what I'm talking about. Just doesn't make sense.
I can't see any mistake there. Are you sure your mesh isn't simply too small or too big to see it?
As I mentioned in the last reply, you could try to use PIX to see if GPU has correct data to work with.
As I mentioned in the last reply, you could try to use PIX to see if GPU has correct data to work with.
I thought about it being too big or too small - so it's good to hear that as well. I'm checking into it now and will report shortly. Thanks Ripiz and everyone.
I just checked video again, Cross and Cone coordinates aren't much different, they should be about same size.
At this point I'd say PIX is the only your chance (unless I missed something).
At this point I'd say PIX is the only your chance (unless I missed something).
Some general debugging advice:
* Every D3D function that returns a HRESULT expects you to capture that return value and check for success. There's a lot of missing error checking in your code, where if something is going wrong, you'll continue on anyway and silently ignore the error.
* Whenever something unknown/weird is happening in D3D, change your device creation code to add in the debug-device flag -- this will print out error messages if you're doing anything suss with the API.
* If the above don't catch an error, then launch PIX and use it to capture a frame from your game. You can then inspect what's happening during the offending draw-call, such as whether there's actually any vertices in your vertex buffer, or if pixels are being rejected by back-face culling, etc...
* Every D3D function that returns a HRESULT expects you to capture that return value and check for success. There's a lot of missing error checking in your code, where if something is going wrong, you'll continue on anyway and silently ignore the error.
* Whenever something unknown/weird is happening in D3D, change your device creation code to add in the debug-device flag -- this will print out error messages if you're doing anything suss with the API.
* If the above don't catch an error, then launch PIX and use it to capture a frame from your game. You can then inspect what's happening during the offending draw-call, such as whether there's actually any vertices in your vertex buffer, or if pixels are being rejected by back-face culling, etc...
I tried to use PIX and it said Failure Creation Progress. What I did notice is that in the drawing topology when I chose to use TriangleStrip it would draw it but a stretched out triangle effect would happen. If I did TriangleList_Adj it would draw the cap part - believe of the cone. At least it's something but I'll investigate further. As of now I'm trying to get PIX working and seeing why it's saying Failure Creating Process.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement