• Advertisement

Archived

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

Do you wrap up opengl, directx etc or do you just make a game engine instead?

This topic is 5066 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m wondering what people rather do. That is do you wrap up directx or opengl....whatever you are using into classes and/or methods. Or do you just skip that and make a game engine instead? eg don''t use any libraries you made previously to wrap up functionality and have all the functionality built into the engine without using previous code..like templated code thanks

Share this post


Link to post
Share on other sites
Advertisement
Hello,

Most, if not all, video cards support DirectX and OpenGL instructions at the hardware level which make it just as fast (most likely faster) then any implementation that we can come up with on our own.

As to your question I just wrap my classes around the DirectX library.

Hope that helps,

Richard

Share this post


Link to post
Share on other sites
Why ask what others do?
Do you need an abstract render device class for your project?
That is the only thing that should matter.

If you don''t have a reason to wrap it up then don''t.
If you want it to be modular ... then it makes sense.

---
If nothing works the way it should ... maybe you need a break!?
Get cracking and double-check the switch statements!!
Tolop|Andyart.de

Share this post


Link to post
Share on other sites
Basicaly the only reason you would want to do that is if you are planning on using the same engine under multiple platforms. AFAIK the best supported Graphic sub-system under Windows is DirectX par none. If a PC running Windows (the majority of the market) is your only concern, then API independence makes 0% sense, and is overkill (not to mention a speed hinderance). On the other hand, if you are planning a port to any system other then microsoft windows, where directX is not used, and still want to use directX functionality in windows, its a requirement. On the other hand, you could technicaly also go with openGL and be more cross platform anyhow, LOL.

EDIT: Clueless, even if you are planning a modular design, creating an unnecessary wrapper adds more internal calls, and hence slows things down (if even a wee bit). Modularization should be only be done on things that are going to differentiate, if they are going to stay the same on all platforms its pointless.

*Modulizing for the sake of Modulerization is pointless in essence. And I say that as a person who cannot spell worth crap.

Sincerly
Richard P. Cesar

[edited by - paulcesar on June 9, 2004 3:06:01 PM]

Share this post


Link to post
Share on other sites
My reason usually is portability (as close to portable as possible)
And making it possible to alter the source easily.
If the API specific code is all over the place it is harder to port to another one later.
But organizing it properly would be possible without making it modular as well I guess.

Plus I like to play the thought that it would be possible to press one key and have the same screen rendered by a different API.

When I replied I had the article "Striving For Graphics API Independance" in mind.
http://gamedev.net/reference/articles/article1672.asp

---
If nothing works the way it should ... maybe you need a break!?
Get cracking and double-check the switch statements!!
Tolop|Andyart.de

[edited by - Clueless on June 9, 2004 4:04:28 PM]

Share this post


Link to post
Share on other sites
OpenGL and Direct3D are not exactly the same.

There are three kinds of wrapper you could make. One that looks like OpenGL, one that looks like Direct3D, and one that looks like neither.

The look-a-likes are easier to write at first, since they are literally just wrappers. But, for example, porting the OpenGL wrapper to Direct3D will not be so easy, unless you don''t mind taking a drop in efficiency.

The wrapper that doesn''t look like OpenGL or Direct3D will be a simple graphics engine.

It''ll be rather like Direct3D''s Retained Mode, but because it''ll be customised for your particular purposes it won''t suffer from the inefficiency that''s associated with generic retained mode systems.

The short answer is that you should do both.

You should make a wrapper around the underlying graphics library. This prevents the conventions of the underlying library contaminating the rest of your engine. This makes it easier to apply your coding conventions to your project, and to switch the underlying graphics library at your whim.

You should also ''just write an engine''. The the wrapper should be part of your engine. This removes extra layers of indirection, which removes a potential performance drain. It also means less code, which means less potential for bugs.

Share this post


Link to post
Share on other sites
I tend to think like Mayrel.

I program a graphic engine/wrapper, because after I''ll be done developping it, it will be easier to maintain the game I''ll build around it, since the graphic code is separated.

My reason for building "wrappers" or "engines" is this: maintainability. I have a tendancy to get lost in my code when it gets too big by itself. When it''s separated in modules, it''s cleaner and easier to understand!

Share this post


Link to post
Share on other sites
I''m implementing a scene graph, using interfaces wherever it seems like the right thing to do.

So, I guess it''s not so much a wrapper as a weak, half-baked imitation of Ogre.

"Without deviation, progress itself is impossible." -- Frank Zappa

Share this post


Link to post
Share on other sites
Well... the scene graphs and such go into more of the graphics ENGINE catagories. And yes, an interface over graphics are important if you are porting. If you noticed my post, I said that. It was mearly if windows alone is all you are interested in..... then a wrapper such as that is overkill, provided you stick with the directX API.

Share this post


Link to post
Share on other sites
These 'wrappers' you speak of are basically a simple engine in themselves. Wrappers are very useful if you want to be able to support multiple APIs. For example, you can have a wrapper function, ClearScreen(), which will clear the screen no matter what API you use. That way, you can swap APIs effortlessly.


-- Fyhuang, president, Altitude Technologies

Altitude Technologies: http://www.hytetech.com/altitude
Altitude Forums: http://s8.invisionfree.com/Altitude_Forums/

[edited by - fyhuang on June 9, 2004 8:56:38 PM]

Share this post


Link to post
Share on other sites

  • Advertisement