Archived

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

Help me please!.

This topic is 5703 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

Well, DirectX is C++ COM oriented, but yes you can use C to access all of the functions. Doesn''t really matter, might look a bit uglier, but it does work. I''d recommend to try adopting C++ eventually, though.

"I am governed by none other than the Laws of the Universe."

Share this post


Link to post
Share on other sites
DirectX is a bit hard in C because you have to call a virtual function table eatch time you call a DirectX function.
So in C++:
lpd3dDevice->SetRenderState(...);
would be fine, but in C, you would need to call it like this:
lpd3dDevice->lpvft->SetRenderState(...);


... yeh, sux, i know.

[ my engine ][ my game ][ my email ]
SPAM


[edited by - aftermath on May 3, 2002 2:54:32 AM]

Share this post


Link to post
Share on other sites
Hello! Congratulations on starting your career as a C programmer!

Be certain to check out the "For Beginners" link above as well as the "Books & Software" and "Articles & Resources" links. You might also want to take a look at the comp.lang.c faq for additional references.

Yes C is good for Direct X - others might say no, use C++ instead, but the two languages are very closely related (C++ is directly derived from C). Once you get the hang of C, you''ll most likely want to move on to C++.

At any rate, here are some samples of using Direct X in C

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Depends on your level of mathiness really

Considering that you mentioned directX, I''m going to assume that you want to do something that has to do with 3D graphics. What you should be aiming for is understanding linear algebra - with emphasis on vectors and transformation matrices. For that, you''ll need basic geometry (from Math 12 or 1st year univ)

Because these are fundamentals, listing specific books is rather hard to do. I suggest going down to your local university bookstore and going through their text-book section for these two topics. Both will easily be in the first year math section. Just look through and hopefully you''ll find one that is easy to understand for you. Perhaps you can try asking friends and relatives that might have some exposure to this to lend you their old text books.

Once you have those fundamentals down, I suggest Numerical Receipes for C. It contains oft-used code that does a variety of topics, like integration, line intersections, etc. It has C-code that you can copy directly, but without understanding the fundamentals, debugging is a pain. I think you understand this hence the request for math books.

Anyway, regarding whether C is good for DirectX, yes it is. I suggest learning at least a tiny bit about C++ though so you can use the Xtended library set (D3DX) that comes with DirectX. It supplies a great many helper functions and interfaces.

Hope that helps and good luck. It might seem daunting at first, but just take it one step at a time. And the cool part is that each of these things you''ll learn now, will provide a good foundation for a lot of other things (directX/C related or not).


TLC

Share this post


Link to post
Share on other sites