Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / DirectX procedural programming? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
vonvader

April 15, 2005, 08:55 PM

I am a inexperienced C++ programmer, still a lot of learning ahead, but I decided to learn graphics programming while still learning C++. I don't know much about DirectX or OpenGL apart that DirectX is COM based (OOP) and OpenGL procedural. While I am still a very new programmer I really don't like the OOP part of C++. Maybe I'm still "too new" to really appreciate OOP, but from what I know till now is that I definently preffer procedural programming to OOP. You might wonder why I then choose to learn C++, but there are quite a few things in C that IMO C++ makes better (apart from the OOP thing) even in procedural programming and it also provides some usefull things not found in C.

The question I ask is, I know DirectX is COM based, but I don't know much about COM either, so is it possible to program for DirectX in a procedural way. Or at least stay away from OOP as much as possible (as there are some things in OOP that I actually do like). I know OpenGL is procedural but I belive you can program with it either way (OOP or proc.) but I made me decicion for DirectX after reading quite some stuff about them. What I would really like to know if DX is somewhat similar to Win32 (or OpenGL) where you can choose which way to program.

 
Reedbeta

April 15, 2005, 09:32 PM

DirectX is COM-based, but using it mainly entails making a lot of function calls that look like "lpD3DDevice->SomeFunc(foo, blah)". The interface is not too different from that of OpenGL. Calling both APIs is done is a pretty much procedural way.

The value of OOP will become clearer to you as you gain experience - I too disliked OOP for awhile after first learning about it. However, OOP is basically another way to organize your own code. Using or not using OOP will in no way affect how you call your 3D API of choice.

 
glWizardry

April 15, 2005, 10:35 PM

You can do COM programming from C. I haven't done it in a long time though, I forget how it was done now. You don't need C++ to use COM, the interface is in C and was designed to be language neutral. But it fits into C++ easily.

But go for C++ anyways and learn OO, it is far superior to straight C when it comes to being able to modify and extend your code. It is a bit overwhelming at first, as C++ has evolved alot over years, but you don't need to know the entire language to effectively use OOP. C++ also has a very large and impressive ADT library (STL) which provides almost all the fundamental data structures you use from day to day.



 
vonvader

April 16, 2005, 10:04 PM

Thanks to both of you. Yeah, glWizardry as a novice it seems to me that there are just to many things in C++ to remember, but I guess you learn them with experience.

 
Erik Faye-Lund

April 17, 2005, 12:12 PM

IDirect3DDevice9_SetTexture(device, 0, some_texture);

 
This thread contains 5 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.