Convert DirectX 9.0 to OpenGL

Dear Experts,

I am looking for a way to convert an application that uses DirectX 9.0 to render its graphics, to use OpenGL instead. This means I need to change the DirectX 9.0 API calls with OpenGL ones.
I am aware of the HLSL2GLSL from ATI but that is only for shaders? I am looking for a documentation (?) or a resource that can help me with the porting.

Any help is appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jose ParrotGraphics ExpertCommented:
There is no FROM-TO between OpenGL and DirectX, despite their similiarities. Their environments aren't equally described, althought the concepts are the same. The better approach to port is to classify the called functions in your program such that you see them in blocks, thus allowing you to port blocks, instead to try port from one API call to the other in a function by function basis
For example, a simple initialization of an empty window in DX9 will call the following functions:
Direct3DCreate9, GetAdapterDisplayMode, CheckDeviceFormat, GetDeviceCaps, CreateDevice, Clear, BeginScene, EndScene, Present, Release, D3D_SDK_VERSION, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D16, D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DSWAPEFFECT_DISCARD, D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE, BackBufferFormat, SwapEffect, Windowed, EnableAutoDepthStencil, and AutoDepthStencilFormat.
The "same" initialization io OpenGL will call:
GetDC, ChoosePixelFormat, DescribePixelFormat, SetPixelFormat, GetLastError, wglCreateContext, wglMakeCurrent, wglDeleteContext, ReleaseDC, glClearColor, SwapBuffers, PIXELFORMATDESCRIPTOR, PFD_DRAW_TO_WINDOW, PFD_SUPPORT_OPENGL, PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, nSize, nVersion, dwFlags, iPixelType, cColorBits, cDepthBits, GL_COLOR_BUFFER_BIT, and GL_DEPTH_BUFFER_BIT.
So you can define the INITIALIZATION block as a high level programming function.
I can suggest you to walk at the Kevin Harris' site, where you'll find good equivalent sample codes in both DX and GL, at There you'll find the way.
Jose Parrot

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChoklanderAuthor Commented:
Thanks. That helps.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.