I was wandering is there a way to work in XNA using OpenGL, this is not counting Xamarin products, and if it is, is there any tutorials of how to set XNA libraries or whatever it uses. I need such combination to start working on I projects until I buy MonoDroid, so the projects with effects be easily ported to Android.
Microsoft XNA is a framework built upon DirectX; you cannot just run it upon OpenGL.
Long answer to your question: you should look at MonoGame (http://monogame.codeplex.com/): it is an open source replacement for XNA, which runs on many platforms.
It is not XNA (you will need to retarget your project to MonoGame, IIRC), but it is almost a drop-in replacement (there are many success stories of porting games in minutes to hours).
XNA is DirectX only. If you want to use OpenGL on .NET, there are multiple libraries for this:
OpentTK (the most popular) or SharpGL
Related
I'm working on a project, specifically a game engine, that has support for both Windows Desktop (Win32) and Universal Windows (UWP/WinRT for Xbox One) platforms. Though I'm having trouble managing it. For Visual Studio, WinRT projects and standard C++ projects need to be compiled with different project types. So for each project I need to build I need to have two projects that build the same source code. For example, the engine needs to be compiled using two different projects. Once, for each platform I want to run on. Meaning everytime I need to run and test it on each platform I need to manually set the startup project to the project I want to launch. I hope that makes sense.
So my question is: Are there any tools, best practices or design patterns, for dealing with projects like this? Ideally I would like to just change the configuration to, say Xbox One, to launch for Xbox One, or Win32, to launch for Windows Desktop. But am open to new sugggestions.
Thanks!
I have a number of C++ libraries that build for "classic" Win32 desktop, Windows 10 desktop, UWP, and Xbox. The majority of the code is Win32 C++ or DirectX. For games, audio, and rendering, there's a pretty clear overlap of these platforms which is where I focused.
https://github.com/microsoft/DirectXTK/
https://github.com/microsoft/DirectXTK12/
https://github.com/microsoft/DirectXTex/
https://github.com/microsoft/DirectXMesh/
I have a blog series that captures much of the 'best practices' I used you may want to reference: Dual-use Coding Techniques for Games.
There are a few cases where I needed to interact with Windows Runtime APIs. In some contexts, I use the C++/CX extension guarded with __cplusplus_winrt. In some cases I used WRL via the low-level ABI (which is frankly pretty ugly, but I didn't need to do all that much). C++/CX is only supported by Microsoft Visual C++, so WRL or better yet C++/WinRT is a better choice for new projects.
Concrete examples would be:
GamePads - https://github.com/microsoft/DirectXTK/blob/master/Src/GamePad.cpp
Keyboard - https://github.com/microsoft/DirectXTK/blob/master/Src/Keyboard.cpp
Mouse - https://github.com/microsoft/DirectXTK/blob/master/Src/Mouse.cpp
XAudio2 device enumeration - https://github.com/microsoft/DirectXTK/blob/master/Audio/AudioEngine.cpp
All multi-platform engines isolate things like the 'window management, presentation loop, and swap chain'. For the Microsoft platforms, I've captured these in VS templates on GitHub.
Each platform also has it's own implementation of things like Cloud-based Storage, Store/licensing APIs, Multiplayer matching/connection, etc. so you'll need to isolate these as well if you implement them.
All that said, you should think about what your goals are for this project. If you want to create a game, use something that's readily available like UnrealEngine or Unity. If you want to learn more about graphics and games technology like Direct3D, audio, etc. then a small engine is a good idea but you should really scope your target platform to something simple. Writing a 'multi-platform' engine is a huge task, so just sticking to one to start is usually the better option.
So, I have no idea how to use shaders. Coding them is easy, but not actually using them. MSDN is really useless to me, meaning they have the worst tutorials out there. I am currently reading Frank Luna's Direct3d 11 book, and I am finally to the part where I actually get to draw stuff. Exciting, except for the fact that it doesn't work. His BoxDemo - I'm sure worked 3 years ago when the book was made, but now with all of the new DirectX stuff - omitting the DirectX SDK and now using "Windows SDK", FX being deprecated, no more D3DX libraries... So frustrating. I went ahead and downgraded to the DirectX 2010 SDK - just so I can actually use a tutorial. Almost every D3D tutorial out there uses the D3DX libraries.
Anyway... now to my question. Visual Studio has an option to make .hlsl files. But, it also has the ability make .fx files (if you just type .fx at the end of the file name it creates .fx file).
So, I could use the deprecated .fx way and learn how to use it easily with all of the tutorials teaching it - OR I can learn the new HLSL way, and have the hardest, most frustrating time trying to learn it with no tutorials.
I know they both use the HLSL language. But they both are used in the program differently. (CreateEffectFromMemory, CompileFromFile, etc).
I kind of hope to learn the new way, but if I don't that is fine. Although, I pretty much have an entire program using an .fx file. I'm sure it will work, but I just need help building and utilizing "Effects11.lib".
Sorry for the dragging on post - in fact, I am sure I will not get any replies for a while - if I do get any - due to the length. I am pretty frustrated because learning DirectX has put my programming career on a massive hiatus for the past month, 2 months. Please and thank you for any help
The file extension .hlsl vs. .fx is arbitrary. It's like the difference between .cpp and cxx. Historically .fx is used for HLSL shaders that included vertex shaders, pixel shaders, and the Effects (FX) techniques/passes, and .hlsl is a file that didn't include the Effects (FX) techniques/passes, but is just a convention. There's plenty of both used out there.
What matters is how the file is compiled. If you use fx_5_0, then it requires the Effects 11 runtime to actually use them. This itself is really nothing special. It effectively just invoke the same compiler for each combination of compile statements you provided for the Effects (FX) techniques/passes and bundles it up with some meta-data. In fact, you can often invoke the FXC compiler on a .fx file containing techniques/and passes using something like vs_5_0 or ps_4_0 and it will compile the appropriate stage-specific shader if you get the parameters just right.
RE: Effects11
The main issue with Effects 11 is that it requires the D3DCompile DLL at runtime because it uses that to extract the metadata required to wire up the state and shaders. This D3DCompile DLL is not usable with Windows Store apps in Windows 8.0 and Windows phone 8.0 when you actually deployed the app, only when you were developing the app. Thus, Effects 11 wasn't usable for those platforms.
This is no longer a technical issue for Windows Store apps for Windows 8.1 or Windows phone 8.1, but the compiler support for fx_5_0 is still deprecated. It has a few issues that are fixed for the other profiles vs_5_0, etc. A such, it's up to you if you want to use it or not as long as you understand it's limitations.
The latest version of Effects 11 is on CodePlex and I address the limitations there. There are some simple tutorials that use it, as well as a few samples. This version of Effects 11 actually doesn't need the legacy DirectX SDK at all.
In short, YMMV w.r.t. to Effects 11 but you can still use it for Win32 desktop apps, Windows Store apps for Windows 8.1, Windows phone 8.1 apps, and in theory with Xbox One apps too.
RE: D3DX
I can understand the frustration, but it's a common issue with the book publishing industry and technical books being way behind the ball in terms of changes. DirectX 11 was introduced back in 2008. The transition to the Windows 8 SDK came in 2012 and most developers much less book publishers completed missed it. I have some notes on that book on my blog.
For a complete list of 'modern' alternatives, see Living without D3DX.
For Win32 desktop apps, you can continue to use the legacy DirectX SDK. The main thing to note is that with the Windows 8.x SDK that comes with VS 2012 and VS 2013, the include and lib path orders are reversed than they were with VS 2010. See MSDN for details.
RE: Learning Direct3D 11
Have you looked at the DirectX Tool Kit?
Getting Started with Direct3D 11
Direct3D Feature Levels
HLSL, FXC, and D3DCompile
As for tutorials and samples, try DirectX SDK Samples Catalog.
I have to develop a basic inventory system, and my client wants to see all the objects in the inventory in 3D and their positions in the warehouse. The thing is that I have to develop this as soon as possible, delivery time is my priority here. So I came to the conclusion that I would need a powerful 3D graphics engine and an UI toolkit that can be easily integrated with it. I've plenty of experience with C++, Qt, OpenGL, VTK, C# and WinForms. In my experience, VTK is not so good with textures and it would involve more work to add the eye candy my client wants (like animations, visual effects, etc). I've tried Axiom with WinForms. I went through hell making a sample load and run (framework incompatibilities, rendering engines not found, codec native dependencies missing, etc).
I have been evaluating different options:
Qt + Ogre (C++)
WinForms + Axiom (.NET)
Qt + Irrlicht (C++)
Which do you think would be the best option? Could you recommend me some other possibility?
Thanks in advance!
I spent a heap of time developing with Mogre (a C# wrapper around Ogre) and WinForms. In my opinion it's a good combination because you can develop the GUI much faster in C# WinForms than any of the C++ options.
If you don't mind using a C# wrapper around the C++ Ogre library I recommend using Mogre rather than Axiom. It is very stable, has some good maintainers and keeps up with the latest version of Ogre pretty well. Any code on the Ogre forums can easily be ported to C# because most of the API is identical.
Axiom is a pure .NET port of Ogre, although it lags a few versions behind and may have some missing features. I haven't spent a lot of time with it but I believe it's main strength is that it's all managed code, if that's important to you.
There's an open source project called Glue Editor that I started a while ago. It's no longer maintained but it has a lot of code you can use to get Mogre working with WinForms. You should be able to download the repository and compile it out of the box. You're welcome to take the code and use it however you like.
https://bitbucket.org/glue/glueeditor/src
If you decide to go down the Qt + Ogre path there's a project called Ogitor you might want to check out.
https://bitbucket.org/jacmoe/ogitor/src
You might also want to check out XNA and MonoGame. XNA is Microsofts framework for making games in C#. It is fairly bare bones but it has a much lower learning curve than Ogre, Mogre or Axiom. MonoGame is an open source implementation of the XNA framework that works on non-Microsoft platforms (e.g. Android, iOS, Linux).
http://monogame.codeplex.com/
I recommend Qt + Ogre (C++), although I have to confess this is the only combination from your list I have much experience with. The good thing about Ogre is the amount of documentation and the active community. So many questions are answered and documented. The graphics itself can probably be created in all library combinations. However, I like the easy intergration of object interaction in Ogre. The standard is based on bounding boxes, however there is code available for triangle intersection as well. Wish you luck!
We have a windows mobile 6.5 gaming application which uses openGL . Now we planned to port it to WP7 (windows phone 7).
When I check the compatibility of native code C++ and openGL in WP7, they are telling that there is no support in the WP7. WP7 support only Silverlight, XNA and the .NET Framework.
So what we thought of use XNA.Is it is the right to use this?
Please let me know how to proceed with this. And which is the best way to go about it.
well I am doing exactly the same thing now.
I'm currently going through the painstaking process of just manually converting all the code to c#. there is no little saviour like the Android NDK here with winmo7, you HAVE to use c#
if I had my time I would and WILL definitely look into something that converts from c++ to c#, it is completely unrealistic to try and manage a multi platform project across multiple languages.
depending on your app: silverlight I believe is meant for the more 'Applicationy' type apps, where XNA is meant for games (or 3D apps), but I think both are coded in c#
EDIT: lol, sorry skipped over the part about how you were porting an openGL game, definitely use XNA, converting from openGL to XNA(directX like) will be the least of your worries, its fairly strait forward. its converting the code that's the pain. XNA is meant for n00bs writing stuff from scratch, and for them, it is awesome. to that end, it is good if you still have all your asset's source: hopefully still having your max or maya model files, and tga/bmp/png texture source files. if so, the content pipeline will automatically convert textures, and for models, converts .x or .fbx files exported from max or maya.
I've been out of the Microsoft stack for a while now, been focused on Linux, open source stuff and web development in PHP. I used to do some desktop app development and some DirectX stuff on Windows in Dev Studio (all C and C++).
I'd like to brush up on the MS stuff just to keep up on what's going on. I've installed MSVC++ 2008 Express but I'm looking for a little side-project to play with. Given my background in C/C++ and familiarity with MFC and STL, what would be a good way to jump back in?
I've been developing on Microsoft stack since 1997, starting with C/C++/MFC/ATL, but all of the recent projects were on .NET platform (C#), so I would recommend learning .NET/C#. C/C++ still has its place, but it loses relevance rather rapidly. If not for legacy projects, we would not even bother with C/C++. Just my 2 cents.
If you want to get back into modern Windows programming you should learn C#/WPF.
If you're looking to get back into windows programming C# ASP.NET 3.5 is a fairly common and current language and framework to start with. This is the direction that the masses of C# .NET guys have been migrating as of late and you may be able to find a wealth of communities and bloggers contributing to that scene.
From the sounds of it, however, it looks like you were doing something along the lines of game development (DirectX and C++). Although more niche and slightly dated there are still a great deal of coders using the language. One of my favorite stops is GameDev.net because of the active community and active forums.
Good luck and have fun!
You could check out the VC++2010 beta, which comes with C++0x support and some MFC updates.
Since you're experienced with Linux, you might want to check out Qt for Windows too.
I fancy wxWidgets very much. It portable, effective and easy to learn especially if you've got some experience from MFC.