Skip to main content
gamedev.net
🔒 Locked

Multiple rendering API?

Started by Dunge Jan 6, 2001 at 11:29 AM 2 replies 400+ views
Original Post
Dunge
Dunge
I know we can''t mix DirectDraw and OpenGL at the same time in a application and that''s not what I want to know. I want to know how to create a game that we can select our rendering API in the options (like Half-Life, Quake3, Hitman, etc). This is impossible that they make all the game in 3 different mode... I think they created a code that all 3 can render (ex: HL_triangle() call an glBegin(GL_TRIANGLES) in OpenGL if this mode is selected or call another command if another rendering mode is selected? Anyway i''m not sure soo please help me... that''s sound hard to do!
crazy-vasey
crazy-vasey
Its pretty easy to do just have D3D functions in one dll and GL functions in another then load the relevant dll.
Dunge
Dunge
hue?
smidge_tech
smidge_tech
I did something like that, but it was a bit limited:

I had a CRender class with functions such as DrawTriangle(), DrawShadedTri(), DrawTexturedTri() etc. you get the idea. And I had functions which enabled certain features, much like the glEnable and glDisable funcs.

There was a ptr to the render class lpRender, but it couldn''t do anything by itself. Instead there was a function called SetRenderAPI(), which then pointed this ptr to a derived class with virtual functions written specifically for Direct3D, or OpenGL, or Glide, or software.

That''s one way.

Another way (which u shouldn''t ask me about coz I''ve never used DLL''s before) is to have your API-specific functions all under the same name, (like DrawTri etc.) in a DLL, then make a different DLL for each API. Then of course you can load whatever one you choose.

Easy as pi



========
Smidge
www.smidge-tech.co.uk
========
--Mr Smidge

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.