"D3DX11CreateShaderResourceViewFromFile" Getting it to work or finding an alterative - c++

I'm pretty new to DirectX, I'm trying to get some sample code I found online to work. Apparently it needs D3DX11tex.h and D3DX11.lib, but it always says it can't open the header. I've tried using CreateWICTextureFromFile, but I don't really know what I'm doing, any help would be appreciated. I'm using Visual Studio 2017 on Windows 10 if it helps.

All of D3DX9, D3DX10, and D3DX11 are deprecated, along with a few other aspects of the legacy DirectX SDK. You can continue to use them in classic Win32 desktop apps with VS 2012 or later / Windows 8.x SDK / Windows 10 SDK but you must add the DirectX SDK include/libs appropriately and use them with care. This is covered in detail on MSDN. See also this blog post.
There are a number of options for Living without D3DX, and it's recommended that new applications minimize or avoid use of the legacy DirectX SDK as much as possible. The only cases that make sense to needing the legacy DirectX SDK are covered in detail in The Zombie DirectX SDK--other than someone learning from all the various outdated books and online tutorials for DirectX 11.
The CreateWICTextureFromFile function in the DirectX Tool Kit is a good solution that doesn't require the legacy Directx SDK at all, and is documented here. It's also covered in this tutorial series.
Keep in mind that the D3DX11 texture loaders were also "everything and the kitchen sink" implementations. The DirectXTex library supports all kinds of legacy loaders, format conversion, resizing, etc. that was supported by D3DX11. For runtime use, however, DirectX Tool Kit is a much faster, leaner, more elegant solution assuming you can do any required legacy conversions at build-time. See this post.

Related

Updating From Old DirectX 7 C++ Code... [dx7vb.dll]

Quick background: This is a large and old software project involving C# UI code and some underlying C++ code. This question pertains to the C++ code.
The C++ is responsible for creating an "efficient" (for the time) scrolling effect on a square region of the screen that displays fast moving waveforms and rapidly changing data. Apparently the "scrolling" that was built-in to our charting software [TeeChart, which we still use] just didn't cut it. (Perhaps TeeChart 2013 does have sufficient scrolling now? Not sure...)
Now apparently the assembly for DirectX 7 in C++ that is being used is "dx7vb.dll". This is a bit confusing to me, as "dx7vb.dll" implies Visual Basic.
I want to replace this DLL with some modern DirectX or OpenGL calls (or TeeChart calls if possible?). The problem is, I have no idea where to find reference on DirectX 7 so I can reverse engineer the DX7 calls and determine a suitable replacement. (I do, however, understand what needs to happen and I have a solid understanding of OpenGL, so that could perhaps be an option as well..)
So my questions are:
Where to find some sort of explanation for this "dx7vb.dll"? Is it somehow related to Visual Basic?
What is a '.TLB' file in C++? Just another type of assembly?
The core object that is used is IDirectX7Ptr which has 2 google results... Does anyone have information on this object so I can understand what the calls are accomplishing?
Do the modern TeeChart .NET libraries support REALTIME displays better than they did ~15+ years ago?
Thanks a ton for your time.
EDIT: To be clear, yes I have all of the source. I obviously do not have source for 'dx7vb.dll'.
EDIT2: After some looking around in the registry I found that it is actually registerd as "DIRECT.DirectX6.0" and most of the COM objects that are being registerd reference "DirectX 6". So in classic Microsoft fashion, 'dx7vb.dll' seems to hold information for DirectX 6 objects...
I'm having a tough time finding anything specific to DirectX 7.0, but I have found old reference material for DirectDraw, if that's the DX component you're using. You can check it out here. I'll continue digging.
Furthermore, you can check out this article that has some legacy (Windows 2000) era DirectX documentation. Under "Direct3D DDI" there's a section for DirectX 7.0 Release Notes, which makes me think there might be useful information here.
dx7vb.dll and dx8vb.dll were Visual Basic 6.0 assemblies for using DirectX 7 (1999) and DirectX 8 (2000) respectively. They are not part of DirectX any longer, and are not available for any version of Windows newer than Windows XP. This predates the legacy Managed DirectX 1.1 assemblies which were written for .NET (2002).
For .NET/C# code, the modern equivalent for accessing DirectX is SharpDX or SlimDX.
See DirectX and .NET

Can't figure out Shaders for DirectX11?

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.

OpenGL in XNA is it possible?

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

Marmalade and AppEasy

I wanted to know some general throughts about Marmalade and AppEasy. http://www.appeasymobile.com/
I've been following DrMop's tutorials on creating a game engine in Marmalade but noticed that since the tutorials he's gone on to make AppEasy(with others). I have looked at it and have a couple of immediate concerns
1) How easily I can incorporate text files/xml files with XOML.
2) What degree of control I would have over the code base.
3) How deep the engine is and whether it has any comparitable rivels which are better.
I've started the project I'm working on with the IWGame engine that DrMop was using in his tutorials but was wondering that if all my fears are unfounded if it is worth carrying on?
Cheers,
Support for IwGame is coming to a close. IwGame is being replaced by the AppEasy Core SDK, which is an open source portable engine where Marmalade is just one of the platforms that it plans to support. AppEasy Core will also be open source so others can contribute to its development, submit bug fixes etc..
XOML + Lua or XOML + C++ or all 3 used together provide a very powerful easy to use environment. You can easily integrate text files, XML files, image files, sound files etc. You should check out the official web site appeasymobile, theres plenty of documentation and a drag and drop app builder that spits out cross platform apps based on XOML + Lua.
Cocos2d-x is a good alternative, but you will need to set up each dev environment for each platform you plan to support (massive pain to do) as it doesn't cross platform compile stuff for you. Although Marmalade do now have a stable interface to Cocos2dx which enables you to use Cocos2dx cross multiple platforms.

Getting back into Windows programming

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.