Graphic Engines And Apis!

OdiN

Recruit
Hello,

Im trying to start off with Graphics progamming and a few recurring doubts seem to crop up -

What exactly is a Graphic Engine( 3d or 2d) or more precisely what's the difference between an Engine and an api(ie. DirectX and Opengl)?

Here's what i know, DirectX(Direct3d) and OpenGl provide an abstraction over the hardware thus eliminating the need to write hardware dependant low level code.And an engine would be an abstraction(a layer of sorts) over the api.

Clear so far? But here's my doubt- So will an engine have to be written for one particular api(ie. either DirectX or OpenGL). Are there engines that support both apis? And if so, wont the end product be too bloated?

Now, these doubts stemmed from my confusion on whether to study DirectX or OpenGL (there's enough flames on other forums about this). Thats the second doubt.DirectX was said to be extremely confusing and poorly programmed in its earlier versions but what about Dx9, its latest avatar?OpenGl on the other hand is said to be cleaner and better designed but it lacks the hardware support that microsoft money can buy.So, which one do u guys root for and why?

Also, if engines are indeed written on top of apis why not learn how to use an open source engine(like Ogre) directly instead of starting with directX/OpenGl ?

In asking these doubts, i profess that im only looking for information before i get my hands dirty studying.So please, no flames and no "You're a noob posts"

Thx and Regards,
Alex
 
Well here's the deal. There is no real answer as to what u'd want to start programming with. Most academicians advise u to start with opengl as its cleaner and the programming model is quite simple. Simple things are very easy to do and complex things are not that difficult either once u get a hang of the API. If you know the fundamentals of graphics... transformations, clipping, projections and viewing, lighting and shading then either API could be used. I'd suggest you start with GL as its easier for a newbie and also cross platform. Use a windowing toolkit such as glut initially. Later you can move over to glx or wgl and you can also learn directx. If you don't know the graphics fundamentals, i suggest u buy a good book (Computer Graphics - Principles and Practice by Foley, Van Dam etc is rather nice and cheap too (~300bux)) Later on once u are thru with the fundamentals, you can go on to directx and higher level stuff like ogre and the like and maybe even scenegraph APIs such as OpenGL Performer and Openscenegraph. (BTW I'm doing my PhD in graphics :))
 
OdiN said:
Hello,

Im trying to start off with Graphics progamming and a few recurring doubts seem to crop up -

What exactly is a Graphic Engine( 3d or 2d) or more precisely what's the difference between an Engine and an api(ie. DirectX and Opengl)?

Here's what i know, DirectX(Direct3d) and OpenGl provide an abstraction over the hardware thus eliminating the need to write hardware dependant low level code.And an engine would be an abstraction(a layer of sorts) over the api.

Clear so far? But here's my doubt- So will an engine have to be written for one particular api(ie. either DirectX or OpenGL). Are there engines that support both apis? And if so, wont the end product be too bloated?

Well, abstractions - at different levels - that's what they are ! And between the Engine and the basic API - DX or OGL - you could have the scenegraph API as another abstraction. And this scenegraph API, for example, could either talk to DX or OGL without you, as an application/engine developer/user, having to know much about the underlying details. At least not to a large extent.

The Engine can be considered as a higher level library. For example, at the fundamental level you could be interested in simulating fire/smoke using a particle system modeled using a bunch of indexed, alpha-blended, bill-boarded triangles which come to life and die over time. At the engine level and for your particular aspect of the game, you may invoke a macro hook which will simply describe the nature of fire in terms of life time, position, color, speed etc. It really depends on where you're starting from and what you intend to do. If you want to jump into game development right away and get a feel for the global scheme of things, you could try to use the engine. OTOH, though, at some point in time you may necessarily will have to get know about all the nitty-gritty underlying details, especially if you plan on a career involving Computer Graphics.

Now, these doubts stemmed from my confusion on whether to study DirectX or OpenGL (there's enough flames on other forums about this). Thats the second doubt.DirectX was said to be extremely confusing and poorly programmed in its earlier versions but what about Dx9, its latest avatar?OpenGl on the other hand is said to be cleaner and better designed but it lacks the hardware support that microsoft money can buy.So, which one do u guys root for and why?

Also, if engines are indeed written on top of apis why not learn how to use an open source engine(like Ogre) directly instead of starting with directX/OpenGl ?

In asking these doubts, i profess that im only looking for information before i get my hands dirty studying.So please, no flames and no "You're a noob posts"

Thx and Regards,
Alex

And between DX and OGL, I have more experience in developing my own OGL based software as an intense hobby. Especially in the US, at the academic scientific visualization level, I've seen OGL to be more predominant. But then I've also seen DX to be used by folks in volume rendering. For windows based games, DX may be a more appropriate choice I believe. Though the function calls may be different, at the beginner's level you could draw parallels about their basic functionalities. So, again at the beginner's level you could look at these as simply tools to get to an end and concentrate more on the 3D Graphics fundamentals with whatever tool you choose. Apart from DX and OGL considerations, even the language that the game is developed in - C/C++/Java - could be a big factor with the game publishers. What I'd suggest is not to be drawn into emotional attachment with either of the APIs, learn one thoroughly to start off with, draw parallels with the other, and keep your options open and learn to adapt all the time. And that's as much as I'd venture to say by trying to remain "politically correct" :p !

And if you are looking for books for CG, I haven't been particularly fond of Foley and Van Dam to start off with as a beginner, though I think it is a very good book for other reasons. I'd probably suggest:

1. CG by Hearn and Baker - simple
2. CG using OpenGL by T.S.Hill, Jr - intermediate but with OGL flavor

Frankly, I'm surprised why many folks seem to be scared by CG. Clearly, the math at the beginner's level, is pretty trivial - matrix concatenation, coordinate transformation, and interpolation. Quaternions, texture mapping, and shadows are slighly more complicated but mostly conceptually. Much simpler than trying to solve a bunch of nonlinear integro-differential equations ! Yes, there are complexities when you get to BTF polygon sorting for rendering transparency, or if you're into developing efficient data structures for Bounding Volume hierarchies etc. But as a beginner, you need to get your resources setup to get that first simple object on the screen. Then everything follows.

A visit to www.opengl.org and the forums within - Beginner, advanced etc - may be useful. Also look for several simple and self-contained snippets by NeHe - you could google them for NeHe OpenGL lessons or something. Play with these snippets with a book like the OGL RedBook, for example, and get the global picture.

Just my $0.02 - radically different may be :p
 
@Chaos and Jedimaster : Awesome replies! Thx guys, ten time over , for sharing your info and taking the pain to type out all that stuff especially jedimaster.

This community rocks coz of guys like you!

thx again,
Alex
Ps: I've decided to start off with some directX tuts on the basics and l8ter when ive got more free time, pick up the books u guys reco'd .
 
Last edited by a moderator:
Back
Top