• Create Account

### #Actualsolenoidz

Posted 11 January 2013 - 02:52 AM

Thanks again everyone.
Porting is coming along very nice and I'm happy with the results so far, as the OpenGL version runs faster than D3D, probably due to badly written D3D code on my side or the simplicity of GLSL shaders I use for now. Anyway I have another question.
I have entities which transformation is a D3DXMATRIX and I want to use that matrix for my OpenGL version of the renderer.
I did this already with my D3D view matrix, which is a D3DXMATRIX by multiplying it with a (1,1,-1) scaled matrix

D3DXMatrixScaling(&sca,1,1,-1) ;
OGLMatrix = g_Camera->view * sca ;

I load this into OpenGL and it works as a MODEL_VIEW matrix which has the MODEL part identity, so all my meshes lie in origin with no scaling and rotation factors, but I can move the camera around correctly.

Now I need to involve the meshes transform matrices from D3D so they are placed, scaled and rotated in the world, but I'm missing something probably because I get incorrect results.
This doesn't seem to work as expected :

D3DXMatrixScaling(&sca,1,1,-1) ;
for(int i = 0 ; i < pOGLMeshes.size() ; i++ )
{
OGLMatrix = pOGLMeshes[i]->d3dMatrix * g_Camera->view * sca ;
g_pOGLRenderer->RenderMesh(pOGLMeshes[i] , &OGLMatrix[0] ) ;
}
If I have a D3D model and view matrices, how am I supposed to concatenate them correctly, so I can load them in OpenGL as MODELVIEW matrix ?

Thank you.

### #2solenoidz

Posted 11 January 2013 - 02:51 AM

Thanks again everyone.
Porting is coming along very nice and I'm happy with the results so far, as the OpenGL version runs faster than D3D, probably due to badly written D3D code on my side or the simplicity of GLSL shaders I use for now. Anyway I have another question.
I have entities which transformation is a D3DXMATRIX and I want to use that matrix for my OpenGL version of the renderer.
I did this already with my D3D view matrix, which is a D3DXMATRIX by multiplying it with a (1,1,-1) scaled matrix

D3DXMatrixScaling(&sca,1,1,-1) ;  OGLMatrix = g_Camera->view * sca ;
I load this into OpenGL and it works as a MODEL_VIEW matrix which has the MODEL part identity, so all my meshes lie in origin with no scaling and rotation factors, but I can move the camera around correctly.

Now I need to involve the meshes transform matrices from D3D so they are placed, scaled and rotated in the world, but I'm missing something probably because I get incorrect results.
This doesn't seem to work as expected :

D3DXMatrixScaling(&sca,1,1,-1) ;  for(int i = 0 ; i < pOGLMeshes.size() ; i++ )   {       OGLMatrix = pOGLMeshes[i]->d3dMatrix * g_Camera->view * sca ;       g_pOGLRenderer->RenderMesh(pOGLMeshes[i] , &OGLMatrix[0] ) ;   }

If I have a D3D model and view matrices, how am I supposed to concatenate them correctly, so I can load them in OpenGL as MODELVIEW matrix ?

Thank you.

### #1solenoidz

Posted 11 January 2013 - 12:15 AM

Thanks again everyone.

Porting is coming along very nice and I'm happy with the results so far, as the OpenGL version runs faster than D3D,  probably due to badly written D3D code on my side or the simplicity of GLSL shaders I use for now. Anyway I have another question.

I have entities which transformation is a D3DXMATRIX and I want to use that matrix for my OpenGL version of the renderer.

I did this already with my D3D view matrix, which is a D3DXMATRIX by multiplying it with a (1,1,-1) scaled matrix

 D3DXMatrixScaling(&sca,1,1,-1) ;
OGLMatrix = g_Camera->view * sca ; 

I load this into OpenGL and it works as a MODEL_VIEW matrix which has the MODEL part identity, so all my meshes lie in origin with no scaling and rotation factors, but I can move the camera around correctly.

Now I need to involve the meshes transform matrices from D3D so they are placed, scaled and rotated in the world, but I'm missing something probably because I get incorrect results.

This doesn't seem to work as expected :

D3DXMatrixScaling(&sca,1,1,-1) ;
for(int i = 0 ; i < pOGLMeshes.size() ; i++ )
{
OGLMatrix = pOGLMeshes[i]->d3dMatrix * g_Camera->view * sca ;
g_pOGLRenderer->RenderMesh(pOGLMeshes[i] , &OGLMatrix[0] ) ;
}

Thank you.

PARTNERS