pouët.net

Programming questions yet again.

category: code [glöplog]
Ok, probably doing this the hard way, but atm I don't really care.

Right, I wanna get into C++ so i'm using Visual C++ 2008 Express edition. I'm currently running through all the tutorials to get a good idea of how the basics work. Now which would be the best way to go for 3d? D3D or OpenGL? For now, I'd be happy just doing a simple 3d object and controlling it, from there I should have enough knowledge to just piss about some and make something from scratch.
oh noes, not THAT debate again
added on the 2009-10-25 01:33:10 by havoc havoc
opengl -> in five minutes you get a smiling rotating cube. five days from now and you'll hate the entire humanity.
directx -> in five minutes you have nothing more than hundreds of angry com instances, absurd structures, nameless enumerators and so on. five days from now you'll make a demo.
added on the 2009-10-25 01:36:24 by rmeht rmeht
haha rmeht that's a great summary XD

8-bit buggery, personally i'd go with D3D seeing as how you're on windows and using devstudio and such. good luck, have fun! :)
added on the 2009-10-25 01:53:31 by blackpawn blackpawn
8-bit buggery: use OpenGL if you are new to C++. its much easier to learn. if you think you are really smart then go for d3d. you should use what api that suits you best. Nehe have some okay samplecode for OpenGL and easy to follow. you can of course make change from opengl to d3d later on.
added on the 2009-10-25 02:18:30 by rudi rudi
What havoc and rmeht said.
added on the 2009-10-25 02:19:53 by ferris ferris
It depends on .. what you wanna do !! .. But better go for D3D .. its way more confusing .. but a lot better standard .. than learning all the OGL EXT !! .. d-.-b ..
added on the 2009-10-25 02:46:58 by yumeji yumeji
It's a moral question !! .. quite a shame ..
added on the 2009-10-25 02:49:05 by yumeji yumeji
Quote:
...would be the best way to go for 3d?


Software rendering, of course! ;)
added on the 2009-10-25 03:02:18 by ham ham
Having been fighting with this decision for a long time for the Plane9 project this is my take on it

Opengl:
- Easy to get started
- portable
- harder to do advanced thing (because of extensions)
- very hard to debug
why is my render code slow?
Why does it look wrong, in what shader/state/pass do I do something bad?
- No true multimonitor support (across hardware cards)
- State based. You enable it its on. Dont forget that later on since you will be wondering, why does it look wrong? I have setup all states for this effect correcly. Yes but you forgot to disable texture x or state x. Solved with good design and only an issue for larger project.

D3D
- Might be easy to get started with some sdk template. unsure about this one.
- A lot easier to debug and performance tune
see nvidias tools where you can step though the render calls see all textures and such
- lots of nice docs

In short. Go with a OpenGL nehe tutorial just to get you quickly up and running. If you want to you can stay there or look into d3d for advanced stuff to help with debugging the neat complex shader effects. Since trying to track down errors in shader code without any tools to help is not a fun experience.

added on the 2009-10-25 09:53:03 by Xetick Xetick
Thanks for that guys. I will give the NeHe Opengl tutorials a bash today. I did try setting up the core code last night, then got completely lost setting up the gl drivers, (maybe I was just rushing through and it was late.)
the best description of d3d/ogl so far, courtesy of ferris / yup:

"Direct3D is the quiet guy at the party, in general he's nice but it's hard to break the ice with him, whereas OpenGL is friends with everybody, but often lets his friends down 'cos he's always overwhelming himself with favors and stuff."
added on the 2009-10-25 13:52:03 by Gargaj Gargaj
Be aware that most of the NeHe tutorials are horribly outdated and tend to teach you bad/obsolete stuff. This is less of a problem at the start, but you should keep it in mind.

The most recent OpenGL version ist 3.2, and if one does not use all the legacy stuff (which is clearly marked as such), the API is very different. However, how many computers have drivers with OGL 3.2 support yet :)

As for the extensions, get something like GLEW or GLee to handle them for you. It doesn't pay off to deal with this manually unless you are doing an intro. Again, in OGL 3.2 most extensions are no longer necessary, since they are part of the core spec.
added on the 2009-10-25 13:55:02 by dv dv
direct3d has a documentation telling you that 'a means a, while b means b' (ie as much as you can read from the headers yourself) while opengl has pretty detailed specification of what things should do.
And IMHO you're not very extension dependent in opengl anymore - ARB is moving fast enough so you only need to care about core and maybe a few arb extensions.
dv: 3.1 should do generally. Btw regarding 3.2 I got 4/9 (geomtry shaders, provoking vertex, seamless cubemap & bgra vertex arrays) on my hd5770 beta drivers.

I would assume especially dx10/11 is very hard to get started with (similar with 'pure' opengl 3.1/2) - on the other hand you will learn things the right, modern way from the start. Ofcourse opengl allows for a smooth transition here. In the latest incarnations the apis seems a lot more similar (buffers, shaders, nothing else).
For intros you'll apreciate the richer api of dx9 or legacy opengl. Sizewise i think it's dx9<ogl<dx10<x11 generally, but sometimes ogl<dx9.
added on the 2009-10-25 14:37:24 by Psycho Psycho
Thanks again guys.

So going by what you're telling me, it's just a matter of choice?

I've looked at the NeHe tutorials, but as "dv" said, they are outdated. So the other question would be, what would be the most up to date tutorials for both D3D and Opengl? From that I could make my mind up about what I'd rather use.
Download the d3d sdk and go through some sample code. I never understood why going through nehe's tutorials was any better way to get started.
added on the 2009-10-25 22:23:35 by Hyde Hyde
Just downloading the SDK now, didn't realise it was so big!

This whole concept is bit alien to me, but I'm sure you nice peeps will give help if needed. :)
I would recommend a good book like Introduction to 3D Game Programming with Direct X 9.0c: A Shader Approach, since it will help you with all the stuff needed to get started and provide a frame work to build upon.
added on the 2009-10-25 22:48:13 by hollowman hollowman
Hmmm, I like that book. Funny thing is, my gf's eldest is doing what they call "mechanics" and it's basically the same stuff. Not complaining, it's as interesting as hell. Thanks for the heads-up on the book! :D
Quote:

opengl -> in five minutes you get a smiling rotating cube. five days from now and you'll hate the entire humanity.
directx -> in five minutes you have nothing more than hundreds of angry com instances, absurd structures, nameless enumerators and so on. five days from now you'll make a demo.
added on the 2009-10-26 03:42:44 by iq iq
That's for OGL 2.1 and DX 9. I guess with OGL 3.2 and DX 10/11 things are not like that anymore
added on the 2009-10-26 03:44:02 by iq iq
DX11. It's been out 4 days already, about time someone made a demo with it.
added on the 2009-10-26 10:18:55 by kusma kusma
Debugging OGL: glslDevil and BuGLe
added on the 2009-10-26 10:56:20 by raer raer
Quote:
I would recommend a good book like Introduction to 3D Game Programming with Direct X 9.0c: A Shader Approach, since it will help you with all the stuff needed to get started and provide a frame work to build upon.


i would tentatively second this since I have the book and used it to figure out basic 3d graphics for both games and demomaking, and it's got a decent framework in there + some useful maths
obviously not the best choice if you want to do opengl
Grrr, this goes to show how fucking noobie I am with C++!

After noseying around some sample code, I now realise I need some header code, (or is that my imagination?) Obviously I need some real good help with this. Do I really need to go down to the brass tacks and learn C++ from the ground up and learn about headers too? And also: are the headers vital for d3d? Do they allow it to work? Yeah, I know I'm really bad at this, but I'm going mad trying to figure this out. :(

login