This topic is now archived and is closed to further replies.


API abstraction reference. D3D and OGL gurus must read

Recommended Posts

IFooBar    906
I''ve seen a lot of posts asking how to design for API abstraction. How to do this because painfully obvious when you think of inheritance. The real problem is how to implement it. Most people get good with one API, namely D3D or OGL. So for example I would know what methods to include in the render system base class if it was only supporting D3D. If I choose to support OGL as well then I wouldnt know how to structure the base class becuase I dont how things are done in OGL. So here''s the solution. Everyone who dosnt know D3D can read up on OGL and vice versa. Now this takes a lot of time. This post is here to make life easier. If everyone could just post one post (or more if they want) on how to do the same thing using both OGL and D3D, then we would end up with a huge reference which will help design our redndering system much more efficiently. you do not have to include actual code in your posts, just make it understandable and make it so that it gives the user some idea of how thigns are done in OGL and D3D. Ill start off with how to generally initialize the rendering device. You can/should metion a few function names as well so that it will help the user further. D3D - Get an IDirect3D interface with Direct3DCreate() - Set up a D3DPRESENT_PARAMETERS structure - Get an IDirect3DDevice interface with IDirect3D::CreateDevice() OGL - Get a valid HDC with GetDC() - Fill out a PIXELFORMATDESCRIPTOR - Set a pixel format using ChoosePixelFormat() and SetPixelFormat() - Get and HGLRC using wglMakeCurrent() PS: To a moderator: I realize cross posting is forbidden, so I had to choose this forum. This topic though is one that at least the DirectX and OpenGL forum regulars should know about. So if possible could you post about this over at those forums as well?

:::: [ Triple Buffer ] ::::

Share this post

Link to post
Share on other sites