Skip to main content
gamedev.net
🔒 Locked

Developing a DLL based rendering system

Started by Remnex Apr 8, 2001 at 3:55 PM 2 replies 300+ views
Original Post
Remnex
Remnex
For my next game I want to seperate all the graphics code from the engine code itself and store it in a seperate DLL. The main reason is I want to support different API''s for the game (will be 2d), without having to code special functions for each type of API I want to support. I have run into a problem, and I am not sure about the solution. It is quite clear that DirectDraw, Direct3d and OpenGL are quite different. My question is this, what is the best way to make generic functions that I can call from the engine to draw stuff, for each API? One of my friends said that my solution lies in a "bridge" design between the engnie and the rendering DLL. I was fooling around a couple nights ago and I made simple DLL for DirectDraw and OpenGL, that had three simple functions.
  
ApiStart(char szName[], int iWidth, int iHeight, bool bFullscreen, int iBitDepth);
ApiUpdate();
ApiDisplay();
  
I was able to get the DirectDraw DLL as well as the OpenGL renderer to work, but it was sloppy and I didn''t see how to allow passing certain parameters to each function. For example, I have a DirectDraw lib that has a class, SurfaceObject, that has a bunch of funcitons that allow me to manipulate that direct draw surface and such, but if I made a function that had a SurfaceObject parameter, how would I do this for the OpenGL renderer? Sorry for the long babble, but I am curious if any of you have a solution to this, know of any tutorials that explain this, or can offer some suggestions. Thanks ------------------------------ "I''m a decorated astronaut, I don''t make those kind of mistakes." "Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''." -Rem
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software
Shannon Barber
Shannon Barber
Pretend like you''re designing a new drawing API.

Instead of focusing on pixel twiddling, focus on the task you need to accomplish to draw your graphics. Things to handle loading & scrolling the background, moving sprites around, and maybe loading tiles?


Magmai Kai Holmlor
- The disgruntled & disillusioned
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
ludemann8
ludemann8
I think it is easier to seperate the game code in a seperate dll (instead of the rendering code)... provides the separation from the rendering code like you want. However, this is a problem for multiple api''s... and so doesn''t really help you.
Remnex
Remnex
I figured it out. My answer was hidden although
Thanks anyway.

btw, I will be seperating the game code from the engine, as well as the rendering stuff.



------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."

-Rem
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software

Topic Locked

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

Sign in to reply to this topic.