Jump to content

  • Log In with Google      Sign In   
  • Create Account


DirectX


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
31 replies to this topic

#1 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 29 May 2014 - 07:17 AM

Hello! My name is Dawood Rehman and I am 18 years old. I have been programming in C++ for an entire year. Now we are going to have a project in school which we get a whole year to complete so I thought of doing some thing in DirectX with 3D graphics.

Now, I know that there is a whole ocean to discover but everybody has to start somewhere right? However I was messing around a little bit with my Visual Studio 2013 Ultimate and I saw that you can make "DirectX App" and "Xaml DirectX App" and theese both were for windows store. Now first of all, what is the difference between theese two and do I really have to make the application for window store? I just want to make a normal windows desktop application.

For the ones that are wondering, I am focusing on making a FPS game, now remember, I am trying to make one, not complete one, making just a room with a single gun to fire with would be hell of an achievement because I know nothing really.

So now when all that is cleared, is there some kind soul out there to help me out on my way that knows something about DirectX programming?

 

I am willing to make a few 2D games before I jump into the 3D one but then it must be in C++/DirectX because that is what I am aiming for later on. I don´t have the time to learn another language.

 

Please write your ideas, any help or comment is appreciated!

Regards!



Sponsor:

#2 kunos   Crossbones+   -  Reputation: 2203

Like
4Likes
Like

Posted 29 May 2014 - 07:33 AM

Xaml is a way to define GUI in Windows Store Apps. The Xaml application will create you a template application with a Xaml controls in which you will write with DirectX. It might be useful if you need buttons or any other Windows Store GUI element while you play.

The DirectX app will just give you a blank app and you'll be responsible to draw into it completely with no GUI support from Xaml.


Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#3 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 29 May 2014 - 12:50 PM

Guys, I am not looking for any kind of solution, just ideas and some useful tips, that is all. Please feel free to comment, they are appreciated.



#4 Vexal   Members   -  Reputation: 416

Like
0Likes
Like

Posted 29 May 2014 - 01:34 PM

It depends what you want to do.  I used to work for Microsoft at the time they were developing the framework for Windows 8 applications.  I wasn't on the team that handled Direct3D implementation, but I've been to talks by the head of those divisions.  

 

I believe XAML apps incur a performance overhead of managing the XAML framework.  But I could be wrong.  However, there is absolutely no performance overhead of creating a blank Direct3D application.  In either case, the code generated is intended for the Windows 8.1 store.

 

Creating a new application with the Direct3D (non-xaml) will give you the starter code for creating a simple rotating cube in the Windows 8.1 store, and the performance of this application will be identical to a desktop application. 

 

If you don't know much about Direct3D yet, it's easier to begin with a Windows 8.1 app because it will generate the initialization code and some very basic shaders for you.  If you would rather make a desktop application like most 3D games currently, it's very easy to convert the code in the Windows 8.1 app to run on desktop.  All of the Direct3D code is the same on desktop as it is for the windows store.  You can set up two separate projects in the same solution and point both projects to compile from the same source files.  The only code you will need to change is the code for initializing the program window.  You will also need a new winmain() function, I believe.

 

The Direct3D objects I believe are wrapped in smart pointers specific to C++/CX (Microsoft's extension to C++ intended for use with windows store components).  But you can delete these pointers and use the objects directly, and the code will still compile correctly to both windows store and windows desktop.  The only time you cannot avoid these pointers are for components specific to the windows store (such as the window object), but you will have to recreate these objects anyway to use them in windows desktop mode.



#5 xenobrain   Members   -  Reputation: 616

Like
2Likes
Like

Posted 29 May 2014 - 01:56 PM

So, you saw this stuff, right?

 

http://msdn.microsoft.com/en-US/library/windows/apps/ff476345  <- Programming Guide for Direct3D 11

http://code.msdn.microsoft.com/DirectX-3D-shooting-game-ed8e56f0  <- DirectX 3D Shooting game sample

 

 

As Vexal mentioned, Windows Store apps are going to be easier to start with than Win32.

 

You say you're 18?  Have you taken Trigonometry yet?  That stuff's 100% required if you want to do 3D. 

 

This book http://www.amazon.com/Math-Primer-Graphics-Development-Edition/dp/1568817231/ref=sr_1_1?ie=UTF8&qid=1401393014&sr=8-1&keywords=3d+math+primer is awesome if you do need some help.

 

You also mention you're using Visual Studio 2013 Ultimate.  I find it unlikely an 18 year old with 1 year of programming experience acquired it legally.  There's nothing in there you need that's not available in Visual Studio Express, so stop pirating!  Or at the very least don't announce it so blatantly.  <southern drawl>Folks 'round here don't take too kindly to the piratin' kind</southern drawl> so you're limiting the amount of help you might get by doing so.



#6 Vexal   Members   -  Reputation: 416

Like
0Likes
Like

Posted 29 May 2014 - 02:03 PM

If you're a student in a university (maybe even highschools?), Microsoft will give you Visual Studio 2013 Professional for free.  It's not ultimate, but you're not really missing anything.  I think you can even use the profiler in Professional now.



#7 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 29 May 2014 - 03:15 PM

Hello and thanks for the answers!

 

Well, I have not a pirated version of Visual Studio, my school has made a deal with microsoft and we can download it for free from dreamspark, so I have not obtained the program illegally.

 

About the trigonometry part, yes I have worked with trigonometry.

 

Now, I am wondering, "vexal" sir, you said that you worked with microsoft, so I am wondering, do you have the time and patience to help me out on this one, the thing is that my teacher have no knowledge of this area so I am on my own literally, I would appreciate the help. I have created a simple window through win32 using a guide online but I wouldn´t say that I understand it all.

 

However, if I understand you correctly, you are saying that I can use DirectX library even in win32? I thought that you could only use it in DirectX App/DirectX App Xaml. And another thing that hit my mind was that you are all saying "direct3d" there is no such thing in Visual Studio 2013 Ultimate atleast. Only DirectX App/DirectX App Xaml exist, perhaps it´s the same thing?

 

Regards!


Edited by dawoodr, 29 May 2014 - 03:16 PM.


#8 xenobrain   Members   -  Reputation: 616

Like
2Likes
Like

Posted 29 May 2014 - 08:12 PM

Well there's not a template for a Win32 window with a Direct3D context, no.  You need to create a new Win32 project, link the directx libraries, include the headers, then create a Win32 window (the Win32 template may have done this for you if you ticked the checkbox) and initialize Direct3D (create a device, swap chain, render target view etc...).

 

Tutorials here: http://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef (If you're going the Win32 route, this is what you want.  Otherwise see my previous link for the Windows Store DirectX tutorials)

Good book here: http://www.amazon.com/Introduction-3D-Game-Programming-DirectX/dp/1936420228/ref=sr_1_1?ie=UTF8&qid=1401414711&sr=8-1&keywords=beginning+game+programming+with+directx

 

Regarding DirectXApp, DirectXApp XAML vs Win32, the DirectXApp Windows Store template create a Windows Store app and fills in the aforementioned boilerplate for you.  If you create an empty Windows Store app then link the libraries, include the headers, then create a window (IFrameworkView implementation),  create a d3ddevice etc.... you'd end up in the same place.  So you never *need* templates, they're just shortcuts.

 

As for the difference between the regular DirectXApp and the XAML one, the XAML one layers a GUI on top of the Direct3D content, which you can graphically edit in a designer and hook up to your app with event handlers etc...  The normal template figures you're going to draw the GUI yourself, or hook up another, third-party GUI system.

 

Also, if going the Windows Store route (which I do recommend for starting) definitely check out Visual Studio 3D Starter kit.  It even includes a content pipeline and shader designer.  Great for learning & experimentation.


Edited by xenobrain, 29 May 2014 - 08:16 PM.


#9 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 30 May 2014 - 03:03 AM

Thanks alot for the replay "xenobrain", it helped to clearify some things. However, could you be more specific about how to do this --> "(the Win32 template may have done this for you if you ticked the checkbox) and initialize Direct3D (create a device, swap chain, render target view etc...)."

 

I was also wondering, if I start with DirectX App and then eventually wanted to change to a win32 application, could I just copypaste the code after I had included the libraries in the win32 project? Except that I have to make a Winmain() function and so on to get a windows running instead of the commant prompt?

 

And btw, about making a simple 2D game before I jump into a 3D one would be a good idea I think aswell, I have heard alot about pong being good for starters. Now I wonder, can it be made with C++ using DirectX libraries?

 

More posts and ideas are welcome.

 

Regards!


Edited by dawoodr, 30 May 2014 - 03:38 AM.


#10 kunos   Crossbones+   -  Reputation: 2203

Like
0Likes
Like

Posted 30 May 2014 - 04:56 AM

ya the answer to all of your questions is yes. Now it's time to write some code.


Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#11 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 30 May 2014 - 09:45 AM

ya the answer to all of your questions is yes. Now it's time to write some code.

It is a bit hard when you don´t have any clue on how to start. I am having some difficulties to include the libraries into my win32 application. If anybody is able to help me out I would be very greatful.



#12 Hawkblood   Members   -  Reputation: 722

Like
0Likes
Like

Posted 30 May 2014 - 10:10 AM

Are you using DX9 or DX11? DX9 is easier to empliment and there are more people that know it than DX11.

#13 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 30 May 2014 - 10:34 AM

I did some research on my own and find out that if you have windows 8.1 and visual studio 2013 the sdks are already installed, however they removed D3DX or something like that from the sdk packet or whatever.

 

All this is so frustrating, All I would like to do for now is to make a "Hello World" program with DirectX, perhaps a cube that says hello world or something like that, but I can´t even do that...



#14 Vexal   Members   -  Reputation: 416

Like
0Likes
Like

Posted 30 May 2014 - 10:57 AM

You are correct.  D3DX is now removed.  However, you should have everything you need in the DirectXMath header, and that can be used on desktop and win8.  For things like loading textures, you can use the code from DirectXTex.

 

If you have a specific question about a feature in D3DX that you are unsure of the modern equivalent of, post it here and I might be able to tell you.



#15 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 30 May 2014 - 12:23 PM

Thanks alot for the answer Vexal, for now I know nothing about DirectX programming, I would really appreciate if someone could show me to make a simple program in DirectX. An example would be like a "hello world" program in win32 application, although I do understand that it won´t be that simple, but I still would appreciate if somebody could guide me through my first program.

 

I have nobody to show me this really.

 

Regards!



#16 Vexal   Members   -  Reputation: 416

Like
0Likes
Like

Posted 30 May 2014 - 12:43 PM

I strongly you suggest using the windows 8 directx app (non-xaml) template.  Once you figure out how the majority of that program works, you can work on porting it to win32 (not difficult once you understand directx).  You're not wasting time adding functionality to the windows 8 version because almost all code will compile for both platforms.

 

The template should create a rotating 3d cube and some basic shaders for you.



#17 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 31 May 2014 - 04:00 AM

I will take your advice Vexal and start out with a DirectX App, but I have a question. Where am I suposed to learn DirectX programming? It is very easy for like html and C++ and other languages because everything you need is out on the web. But how am I suposed to learn programming with DirectX as a complete beginner?

 

I can´t find anything out there that is similar to a "hello world" program in c++ for an example. The reason I am bringing up the hello world program over and over is because it´s the most simple program you can do in c++ and I want something similar to that using DirectX, however ofcourse I understand that it still won't be that simple.


Edited by dawoodr, 31 May 2014 - 04:02 AM.


#18 kunos   Crossbones+   -  Reputation: 2203

Like
1Likes
Like

Posted 31 May 2014 - 04:39 AM

Sadly 3D graphics is a huge topic and things change so quickly that's hard to keep up.

IMO the best way is the proper way: buy a book and read it. I don't think it's a subject that can be understood with internet tutorials.

Try to find the most recent book on DX11 (or OpenGL) on amazon and study it.

 

The DirectX App wizard is your "hello world" for DX, it doesn't get any simpler than that.

Also make sure your knowledge of C++ and basic operations in Visual Studio is up to the challenge... if you have problems linking and compiling with libraries it means your level of C++ is simply not high enough to adventure into 3D graphics.


Edited by kunos, 31 May 2014 - 04:45 AM.

Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#19 dawoodr   Members   -  Reputation: 179

Like
0Likes
Like

Posted 31 May 2014 - 05:53 AM

Sadly 3D graphics is a huge topic and things change so quickly that's hard to keep up.

IMO the best way is the proper way: buy a book and read it. I don't think it's a subject that can be understood with internet tutorials.

Try to find the most recent book on DX11 (or OpenGL) on amazon and study it.

 

The DirectX App wizard is your "hello world" for DX, it doesn't get any simpler than that.

Also make sure your knowledge of C++ and basic operations in Visual Studio is up to the challenge... if you have problems linking and compiling with libraries it means your level of C++ is simply not high enough to adventure into 3D graphics.

Well, I wouldn't say that my programming skills are good, I do not believe so. The best thing I have done with C++ so far is to make a 2D game using windows forms, however windows forms have been excluded from visual studio 2013 because windows forms sucks when you are working with C++.

 

And I was wondering, do you have any recommendations on the latest arrival books out there targeting DirectX? It is like you said, things change so quickly that you have to get the latest teaching aids.



#20 kunos   Crossbones+   -  Reputation: 2203

Like
0Likes
Like

Posted 31 May 2014 - 06:06 AM

sadly I am too old to know about new beginner friendly books... but I have a feeling that the best book to learn about 3D remains the OpenGL Programming Guide (aka the "Red Book").. that was the book that made me go "aha!" years ago. Of course now it has been updated to more modern OpenGL.

But I think you can get all the info you need by reading the reviews on amazon.


Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS