Quote (Richter @ Jun 9 2013 05:00pm)
well you have 2 variables called "trans"
the one inside the function overwrites the trans from the parameters
edit: probably it works like this:
Code
void D3DManage::Cube(D3DXMATRIX trans, float x, float y, float z)
{
D3DXMatrixTranslation(&trans, x, y, z);
device->SetTransform(D3DTS_WORLD, &(trans));
note that i deleted the first line inside the function
yes it works once, but if I'd like to draw another cube with a variable D3DMATRIX I need a new D3DMATRIX
MAYBE a solution
1. I make a class and try to draw them this way
cube1 = new Cube (D3DMATRIX, float, float, float);
cube2 = new Cube (D3DMATRIX, float, float, float);
2. Make an array:
void D3DManage::Cube(int i, float x, float y, float z)
{
D3DMATRIX trans[i];
D3DXMatrixTranslation(&trans[i], x, y, z);
device->SetTransform(D3DTS_WORLD, &(trans[i]));
This post was edited by lowxair on Jun 9 2013 11:13am