DirectX + OGL games

Started by
13 comments, last by Davefromalbury 20 years, 4 months ago
Try checking this out, it''s about the question.
http://www.gamedev.net/reference/articles/article1672.asp

Stupid details.....always get in the way....it's time to write the dwim(x) function ("do what i mean to")
Advertisement
why not something simple like this:

class D3DRenderer
{
render()
loadmesh()
rotate()
}

class OGLRenderer
{
render()
loadmesh()
rotate()
}

then in the engine code....
IF Direct3D is the way to go THEN
RenderObject=D3DRenderer
ELSE
RenderObject=OGLRenderer

....later on:
RenderObject.LoadMesh();
RenderObject.Render();
etc

Why all the class derivation and fancy stuff?

cheers!
dave


quote:Davefromalbury
Why all the class derivation and fancy stuff?


Well duh! ''Cause its FANCY!!!
Humans are emotional, irrational, and illogical, thats why they need the complicated fancy stuff.

Seems more natural to me to have an interface, since both classes have exactly the same functions, the code in them is just different.

Imho pc''s are so fast today, that its an error to not use the benifits of oo programming simply because of some function overhead.

And besides,

IF Direct3D is the way to go THEN
RenderObject=D3DRenderer
ELSE
RenderObject=OGLRenderer


that would mean RenderObject is the same type for both, or at least, an object derived from the same class, which would be the interface
I also feel the oo way is the best way. I have been using the opensource Ogre graphics engine as of lately, and have foudd it to perform nicely, and it has a good community base. It uses some of the approaches already mentioned in this thread: generic base class, with derived classes for each specific render system (GL DX7, DX9). Also uses the dll thing for windows and .so on Linux. You should look at how its render systems are designed. ogre.sourceforge.net

This topic is closed to new replies.

Advertisement