Archived

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

Lionheartadi

How to get rid of managed DirectX? and is it wise to do so?

Recommended Posts

Lionheartadi    154
Hi Well I just spended about one hour find out what the heck is the difference between managed and unmanaged DirectX. Now I have a fair understandment about managed and unmanaged mode. What I read about managed code didn''t inspire me to use it. I mean sure I sounds cool that when you use managed vertexbuffers you don''t have to worry about locking and releasing, but I find such things... well wrong. I don''t know I just feels like soon a programmer doesn''t have to know anything about anything. Ok I may over react. Well anyway I don''t want to use managed DirectX I doesn''t feel like coding when the compiler, DirectX or clr what ever does it all for you. Sure I cool to have an API that like DirectX that offers you alot of functionalities, but if you don''t know the basics whats the point of doing anything. I want to learn the hardway . I want to be able to manage the code myself and so on. So how do I make sure that I don''t acidently use managed code in DirectX? Is such thing wise? Thinking some years back, managed code stuff is for me atleast an strange concept. I am actually buying a book about graphics programming published in 1995 to learn how things where done in the old days. I am still at the learning stage so correct and englight me with knowledge . I want to learn as much as possible to manage the code and not let the code manage how do I program. Well feel free to give any comment on the subject. Knowledge is goooood. Thanks for any advice and help.

Share this post


Link to post
Share on other sites
MichaelBartman    122
I'm using DX9, and I'm not using managed DX so buying an old book isn't really what you have to do to not use managed code. Of course, I am using C++ and I don't know if managed DX is a C#/VB.net only thing and I don't know what language you are using.

Michael Bartman
CEO, Lead Programmer
Dark Omen Studios
http://www.darkomenstudios.com/


[edited by - MichaelBartman on July 7, 2003 3:04:20 AM]

Share this post


Link to post
Share on other sites
Lionheartadi    154
quote:
Original post by MichaelBartman
I''m using DX9, and I''m not using managed DX so buying an old book isn''t really what you have to do to not use managed code. Of course, I am using C++ and I don''t know if managed DX is a C#/VB.net only thing and I don''t know what language you are using.

Michael Bartman
CEO, Lead Programmer
Dark Omen Studios
http://www.darkomenstudios.com/


[edited by - MichaelBartman on July 7, 2003 3:04:20 AM]


Ouh jeah I forgot to tell what language C++. I haven''t seen any reason why I should use VB.NET or C#. So it''s C++

Share this post


Link to post
Share on other sites
MichaelBartman    122
As far as I know, you don''t have to do anything special in C++ and DX9 to not use managed DX. Just don''t do anything to enable it, i.e. pragma any managed libraries in or include any headers for managed DX.

Michael Bartman
CEO, Lead Programmer
Dark Omen Studios
http://www.darkomenstudios.com/

Share this post


Link to post
Share on other sites
Lionheartadi    154
quote:
Original post by MichaelBartman
As far as I know, you don''t have to do anything special in C++ and DX9 to not use managed DX. Just don''t do anything to enable it, i.e. pragma any managed libraries in or include any headers for managed DX.

Michael Bartman
CEO, Lead Programmer
Dark Omen Studios
http://www.darkomenstudios.com/


Hmm... Ok. I''ll have to check the SDK and my code. Thx I''ll look into this.

Share this post


Link to post
Share on other sites
Lionheartadi    154
quote:
Original post by Bunnz
I think Assembler would be the best language for you. Cause C++ manages already a lot for you.

Have fun
Bunnz
www.bunnz.com

[edited by - Bunnz on July 7, 2003 3:38:53 AM]


Heh... yeah I plan to use assembler as an optimization method, but writing an full assembler based 3d engine eh... to hard perhaps or at very least time consuming. I mean for me.

Share this post


Link to post
Share on other sites
Wavewash    202
If I understand correctly you want to take care of loading and unloading of resources from system memory to hardware memory? Hrm.. It seems you may be taking on more then you can handle. Direct3d does ALOT for you on handling memory. Your textures are loaded in such a way that only the most recent used ones are loaded in memory, and also makes sure that you don''t lose your resources when lose the state of your devices. From where I''m looking at it, you''re complaining about a very good thing.

~Wave

Share this post


Link to post
Share on other sites
quote:
So how do I make sure that I don''t acidently use managed code in DirectX?

Well, what language are you programming in? If it''s called C# or Visual Basic.NET, you are almost certainly accidentally using managed DirectX. If it''s called C++, there''s a very teeny tiny remote possibility that you''re accidentally using managed DirectX. Seek assistance immediately and try to avoid contact with other people until a proper diagnosis has been made.

Your desire to control every minute detail of what you''re doing is commendable. And in fact if you want to really dig deep, look into assembly programming. Every programmer should do this, IMO, almost like an initiation rite. In fact I don''t know of a single programmer whom I consider top-notch who is not fluent in assembly language. (For that matter you could also learn how logic gates work, and transistors, and the physics behind them...)

But don''t be surprised if, as you gain experience and become more comfortable with what''s going on under the hood, you also become more comfortable with the idea of letting code manage things for you that tend to be tedious and error prone.

Share this post


Link to post
Share on other sites
Lionheartadi    154
quote:
Original post by Donavon Keithley
quote:
So how do I make sure that I don't acidently use managed code in DirectX?

Well, what language are you programming in? If it's called C# or Visual Basic.NET, you are almost certainly accidentally using managed DirectX. If it's called C++, there's a very teeny tiny remote possibility that you're accidentally using managed DirectX. Seek assistance immediately and try to avoid contact with other people until a proper diagnosis has been made.

Your desire to control every minute detail of what you're doing is commendable. And in fact if you want to really dig deep, look into assembly programming. Every programmer should do this, IMO, almost like an initiation rite. In fact I don't know of a single programmer whom I consider top-notch who is not fluent in assembly language. (For that matter you could also learn how logic gates work, and transistors, and the physics behind them...)

But don't be surprised if, as you gain experience and become more comfortable with what's going on under the hood, you also become more comfortable with the idea of letting code manage things for you that tend to be tedious and error prone.


I do infact like to have some things managed for me. Especially if I need to save time and the subject on which I'm working on is familiar to me and I really really know what I am doing, but as I said a bit earlier I am at a learning stage. In my opinion and in my experience doing something and not understanding the very basics of it you will end up scraching your head and wondering what have I done wrongly. Or perhaps you need to optimize and you don't know how to do it anymore. Well I just mean that it doesn't hurt to understand as much as possible.

I do have do some assembler language programming on intel 8 bit processor and have some knowledge how do really computer chips, transistor etc... work, but not to much. I plan to go more deeply in assembly language as soon as I have finished the first stage of my curent DX9 engine.

Anyway to sum all up I can't wait to learn more and more. I think that if you really want to be a damn good programmer is good to know the very basics as assembler. Well I love programming .



[edited by - LionheartAdi on July 7, 2003 4:20:56 AM]

Share this post


Link to post
Share on other sites
Night Elf    140
I think you''re confusing two different things: Managed DirectX and D3DPOOL_MANAGED resources.

Managed DirectX is a set of classes that wrap DirectX functionality and makes it compliant with .NET languages as Visual Basic and C#. You need to use MDX if you''re programming in one of those languages. Although it may be possible, it''s not necessary to use MDX in C++, which can handle unmanaged code (i.e. code not relying upon the .NET framework). In fact, I''ve never seen it done and if you use the DirectX interfaces and functions as described in the C++ DirectX SDK, there''s no way you''ll end up using MDX by mistake.

Quite a different thing are D3DPOOL_MANAGED resources. When you tell DirectX to use the D3DPOOL_MANAGED pool for storing resouces, it manages memory allocation for resources, which helps you, for example, when you lose your device. Now, this has nothing to do with MDX and, as far as I know, you can use D3DPOOL_MANAGED resources in both MDX and standard DirectX.

Share this post


Link to post
Share on other sites
Lionheartadi    154
quote:
Original post by Night Elf
I think you're confusing two different things: Managed DirectX and D3DPOOL_MANAGED resources.

Managed DirectX is a set of classes that wrap DirectX functionality and makes it compliant with .NET languages as Visual Basic and C#. You need to use MDX if you're programming in one of those languages. Although it may be possible, it's not necessary to use MDX in C++, which can handle unmanaged code (i.e. code not relying upon the .NET framework). In fact, I've never seen it done and if you use the DirectX interfaces and functions as described in the C++ DirectX SDK, there's no way you'll end up using MDX by mistake.

Quite a different thing are D3DPOOL_MANAGED resources. When you tell DirectX to use the D3DPOOL_MANAGED pool for storing resouces, it manages memory allocation for resources, which helps you, for example, when you lose your device. Now, this has nothing to do with MDX and, as far as I know, you can use D3DPOOL_MANAGED resources in both MDX and standard DirectX.


Hi

Hmm if what you say is true then I do have mistaken D3DPOOL_MANAGED with MDX, but I earlier this day I went through a lot of topics about code MDX and got the idea that I may have used MDX without my knowledge. Yes I do have followed DX SDK very closely I have done everything as it's said in the documentation. Well what comes for the DX stuff anyway. I just don't know, I'm really messed up. The reason I am even asking this question is because I'm going to a demo party with this DX project I'm working on and I have really no idea does the party PC have the .NET framework installed on them. It would be a damn shame if I go there with the demo and could get it to work because of the .NET and to make things worse I have just about thirty days before the competition and really don't have the time to get stucked with this kind of a problem. ah... just don't know. Well I hope you are right about what you said.




[edited by - LionheartAdi on July 7, 2003 12:08:43 PM]

Share this post


Link to post
Share on other sites
Night Elf    140
quote:

So is it possible to use completely managed code using visual c++ 6.0 with directx 9?


AFAIK, Visual C++ 6 doesn''t support the .NET framework. So you can''t.

Share this post


Link to post
Share on other sites
johnnyBravo    100
ah,

Is c# much slower to makes games in? Or are later patches going to make it just as fast as c++

also could you quote some managed, code, im kinda curious what it looks like, as im considering moving to c#.


...Hey I can't see why you would want the code un managed. As when I program, I want my development to move much faster, and the code to be less cluttered, from what I hear managed, would do this.

I believe algorithms and speed are more important over anything else. Not what makes code look more techy

[edited by - johnnyBravo on July 8, 2003 11:22:26 AM]

Share this post


Link to post
Share on other sites
Night Elf    140
Well, you don''t need to use C#. C++.NET also supports managed code.

Anyways, C# seems to be quite a nice language. I haven''t written ''real'' code in it, just some test to see what it was like.

As for if it is slower than C++ or not... it has been discussed for a long time before in this same forum, you may want to search for some of those threads. In the end, everybody sort of agreed that the speed difference is not that noticeable and that the final performance of the program depends more on your programming skills than on the language you write on. It was also pointed out that there was a speed problem with the .NET framework and floating point numbers. I don''t know if that was addressed in the 1.1 version of the framework.

A quick search on Google or a forum seach here at GameDev.net will show you many examples of C# and DirectX for you to see what it looks like.

Share this post


Link to post
Share on other sites