PDA

View Full Version : OpenGL -> Direct3D (directx using GL syntaxis dxRotatef dxTranslatef)



Georgy
10-07-2010, 10:11 AM
Updated:
- dxRotatef
- dxTranslatef
- dxuLookAt
- dxMatrixMode
- dxLoadIdentity
- dxuPerspective
- dxClearColor
- dxClear
- dxDisable
- dxEnable
- dxBegin
- dxTexCoord2f
- dxVertex3f
- dxEnd
- dxPushMatrix
- dxPopMatrix
- dxBindTexture

new version http://igrodel.ru/opengl_to_directx_01.zip




Hello!
I fixed my old D3D example to be more OGL-like:



glRotatef(gettickcount/10,0,1,0);
glTranslatef(-10,0,0);

becomes


dxRotatef(gettickcount/10,0,1,0);
dxTranslatef(-10,0,0);

and this too


dxuLookAt(0, 0, 30,
0, 0, 0,
0, 1, 0);

based on MESA3D source code

Very basic at the moment. DX and OGL render must be 99..100% identically (http://www.igrodel.ru/tdg3d/OGL-D3D.zip).

Georgy.

virtual
10-07-2010, 11:40 AM
thanx for shearing

while ago i tried to implement gl(Pop/Push)Matrix in Dx but i couldn't

Georgy
11-07-2010, 06:23 AM
thanx for shearing

while ago i tried to implement gl(Pop/Push)Matrix in Dx but i couldn't


check new version: dxPushMatrix, dxPopMatrix
http://igrodel.ru/opengl_to_directx_01.zip

chronozphere
11-07-2010, 09:30 AM
Nice work. :)

Allthough I'm not sure how usefull this is. Are there many OpenGL people who want to use DirectX but don't want to learn the API?

Also, wrapping DirectX up like this is going to affect performance. I'd rather use the API directly to make sure that my game runs as fast as possible.

Still, I like to see where this is going.

Georgy
11-07-2010, 11:42 AM
you are certainly right. Code can help quickly understand how to make d3d program. full wrapper will be too difficult to implement. So i have an idea making Direct3D opengl friendly. Also it does not depend on too much code, and can be easily copy'n'pasted by someone to get quick results :)



Nice work. :)

Allthough I'm not sure how usefull this is. Are there many OpenGL people who want to use DirectX but don't want to learn the API?

Also, wrapping DirectX up like this is going to affect performance. I'd rather use the API directly to make sure that my game runs as fast as possible.

Still, I like to see where this is going.

virtual
11-07-2010, 05:56 PM
Excellent , the transformation gose easier with dx now

Georgy
12-07-2010, 12:56 AM
Anybody interested in this project let me know.

I have a question about what technology for vertex fetching used more in GL and D3D. Then i can decide using "A" D3D technology to emulate "B" OGL technology. At the moment it is old-known glBegin/glEnd and it's D3D analogue =)

noeska
12-07-2010, 01:37 PM
Have a look at google's attempt: http://code.google.com/p/angleproject/
They write a lib that works like opengles 2.0 but that calls directx in the background.