DirectXTK | DirectX Tool Kit ( aka DirectXTK | Runtime Evironment library
kandi X-RAY | DirectXTK Summary
kandi X-RAY | DirectXTK Summary
The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of DirectXTK
DirectXTK Key Features
DirectXTK Examples and Code Snippets
Community Discussions
Trending Discussions on DirectXTK
QUESTION
I'm trying to apply a custom effect using the DirectXTK. The effect is supposed to be an "unlit" shader with just one texture. But for some reason, the texture is stretched across the model. I looked in renderdoc and the texturecoordinates appear to be loaded correctly so i'm not sure what's going on.
UnlitEffect.h ...ANSWER
Answered 2022-Feb-14 at 01:59Chuck Walbourn was correct. My issue was that I was normalizing my texture coordinates in the pixel shader.
The correct code is
return BaseColor.Sample(SampleType, vout.TexCoord);
QUESTION
I am working on a small-ish scale project.
...ANSWER
Answered 2022-Jan-21 at 11:49Is it possible to not generate build systems for everything whats under lib/ and instead compile and link the library directly into the Engine project?
This sounds like an XY problem. What do you really want to do?
- Are you trying to avoid CMake spending time configuring those projects? If they're really optional, then add
option()
s to disable them. - Are you spending a lot of time rebuilding everything when you only want some parts? Let me point you to the
cmake --build ... --config --target Game
command. That will build only what is needed for targetGame
. - Something else?
But this question of not "generat[ing] build systems" is ill-formed. CMake is a build system generator. How do you make a C++ compiler not compile C++?
QUESTION
I used CreateWICTextureFromFile() from DirectXTK to load an animated GIF texture.
...ANSWER
Answered 2021-Sep-01 at 02:40The CreateWICTextureFromFile
function in DirectX Tool Kit (a.k.a. the 'light-weight' version in the WICTextureLoader module) only loads a single 2D texture, not multi-frame images like animated GIF or TIFF.
The DirectXTex function LoadFromWICFile can load multiframe images if you give it the WIC_FLAGS_ALL_FRAMES
flag. Because the library is focused on DirectX resources, it will resize them all to match the first image size.
That said, what WIC is going to return to you is a bunch of raw frames. You have query the metadata from WIC to actually get the animation information, and it's a little complicated to reconstruct. I have a simple implementation in the DirectXTex texassemble tool you can reference here. I focused on converting the animated GIF into a 'flip-book' style 2D texture array which is quite a bit larger.
The sample I referenced can be found on GitHub
QUESTION
The idea is to draw the bounding box as 2D corners on the screen after my DiretXTK model is displayed.
I got the bounding box corners form DirectXKT in a std::vector
, so
ANSWER
Answered 2021-Jun-06 at 19:15In the DirectX Tool Kit wiki, I have a DebugDraw
helper which is specifically designed for drawing DirectXMath bounding volumes using DirectX Tool Kit's PrimitiveBatch
.
See this topic page.
You may also want to take a look at the Collision sample.
QUESTION
I use DirectX Toolkit to display a 3d model, following the 'Rendering the model' and my pyramid is displayed:
When trying to transform the object, the scaling and rotation work well but I'm not sure how to move the object (translate) around. Basically I'm looking for an algorithm that determines, given the current camera position, focus, viewport and the rendered model (which the DirectX toolkit gives me the bounding box so it's "size") the minimum and maximum values for XYZ translation so the object remains visible.
The bounding box is always the same, no matter the view port size, so how do I compare it's size against my viewport?
Please excuse my newbiness, I'm not a 3D developer, at least yet.
The "Simple Rendering" example which draws a triangle:
...ANSWER
Answered 2021-Jun-03 at 23:54TL:DR: To move your model around the world, create a matrix for the translation and set it as the world matrix with SetWorld
.
QUESTION
I am working on a low resolution 2D game using the DirectXTK and Spritebatch. Everything works fine in windowed mode, however whenever I start or switch to fullscreen the image is blurred to stretch the backbuffer to fit the screen.
I Initialise the device and swap chain with these settings:
...ANSWER
Answered 2021-May-04 at 21:09Thank you to Chuck Walbourn for pointing me to the DirectXTK templates.
After changing my Graphics class to match the template, the full screen on longer blurs.
Although I am not changing the backbuffer screen resolution It needs to be unchanged so that the low resolution is stretched to fit the window. If I change the backbuffer it is difficult to see the game because it is then rendered so small.
It appears the reason the fullscreen mode is not blurred when using the template is because it is actually borderless windowed mode and not exclusive fullscreen.
QUESTION
I've decided to try the DirectXTK12 audio and it's working fine except for the 3D sound. I'm following the guide from wiki but the sound is always in the left speaker no matter how I position the listener/emitter. What's wrong? My code looks like this:
...ANSWER
Answered 2021-Apr-11 at 07:51I've fixed the issue by converting used Sound.wav to mono (1 channel) sound.
QUESTION
I am trying to load a texture from a .GLB model in Direct3D 11. The image data is encoded as PNG (I checked the buffer and I could see the file signature in the first 4 bytes). When I try to execute my code, there is an HRESULT returning a WIC "component not found" error (0x88982F50). This is when I try to use WIC from a regular C++ 64-bit Windows API application. Is a component not installed on my machine? Should I use a different approach?
Here is the relevant code:
...ANSWER
Answered 2021-Jan-20 at 22:28I found what was wrong. Besides the fact that I was not calling CoInitialize (which I should), I was not referencing the buffer right.
Instead of:
QUESTION
I've been looking at the WICTextureLoader.cpp file that is part of the DirectX Toolkit. And I'm trying to understand this bit of code:
https://github.com/microsoft/DirectXTK/blob/master/Src/WICTextureLoader.cpp#L530
...ANSWER
Answered 2020-Dec-26 at 20:59bpp
here is "bits per pixel". The expression rounds up to the next whole byte (8 bits).
This is a classic C pattern for "align up" for power-of-2 alignments, here expressed as a C++ template.
QUESTION
I'm trying to load a DDS texture. For that, I'm using DDSTextureLoader11
provided by DirectXTex
. I already am using another texture loader from the same library - WICTextureLoader11
.
The problem is, I don't get errors with WICTextureLoader11
, however I do get errors either when including only DDSTextureLoader11
, or when I use both of them.
This is some of the errors I get when I include both or only DDSTextureLoader11
:
/WICTextureLoader11.cpp:51:17: error: redefinition of 'SetDebugObjectName'
/WICTextureLoader11.cpp:273:17: error: redefinition of 'MakeSRGB'
/WICTextureLoader11.cpp:747:17: error: no matching function for call to 'SetDebugObjectName'
/DDSTextureLoader.h:156:35: error: redefinition of default argument
I first thought that it was because both WICTextureLoader
and DDSTextureLoader
contain same functions, so when including both they "overlap" (i.e. compiler detects redefinition).
I'm using a batchfile to compile my project, where I link against both DirectXTex
and DirectXTK
. I also tried to include DDSTextureLoader
, but without success: I've read the GitHub page of the DirectXTK's DDSTextureLoader
, where I include that gives me a link error, which I guess is related to the incorrect call of the function
CreateDDSTextureFromFile
, so right now I'm trying to find a way to make the right call to the function.
Edit: no, it seems like I'm making the right function call. The wrong thing is that I'm trying to include DDSTextureLoader.h
, but it also wants DDSTextureLoader.cpp
. However, the errors occur when I include DDSTextureLoader.cpp
, such as:
'DDSTextureLoader.cpp': call to 'BitsPerPixel' is ambiguous -> 'DirectXTex.h'
or 'DDSTextureLoader' error: redefinition of 'SetDebugTextureInfo', previous definition in 'WICTextureLoader'
.
I think, what I need is to include the .cpp
file, but somehow get rid of the errors.
Edit2: So far, I tried to get rid of DirectXTex (I don't remember why I even needed it), and I've included WICTextureLoader.cpp
and DDSTextureLoader.cpp
. I downloaded and built the DirectXTK library, then included #pragma comment(lib, "directxtk.lib")
. Now, the weird thing is: when I compile with Clang++
, it doesn't throw any errors (but the program crashes after a second-long gray screen), however when I compile with cl
(through vcvars64
), I get fatal error LNK1104: cannot open file 'directxtk.lib'
.
Edit3: Wait, I don't even know why I even need the directxtk.lib
. So I removed it, and it compiles, but nothing works. I thought I needed that static library to resolve external symbol errors when trying to include the header (XXXTextureLoader.h
), instead of the source (XXXTextureLoader.cpp
).
Edit4: Wait,wait,wait. I think, I'm going crazy. Now, if I include only WICTextureLoader.cpp
(and remove DDSTextureLoader.cpp
), it gives me this error: (directxtk.lib) mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease'
. I don't know why I did that, but I'm crazy now, I blindly brute-force my way through resolving this cursed issue. Why can't I just throw both headers in my directory and just simply include them? Is there a way to do so? What should I do? Why doesn't DirectXTK/Tex pages on GitHub give a step-by-step guide to how to use these things? The examples drive me crazy!
Please, help me resolve this what seems to be a simple issue.
Edit5: The last thing that I tried is to include DDSTextureLoader.h
and WICTextureLoader.h
, and use directxtk.lib
, but it gives me these errors:
directxtk.lib(DDSTextureLoader.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main-3dacd8.o
directxtk.lib(pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main-3dacd8.o
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
I don't use VS, so I don't know how to use /NODEFAULTLIB
.
ANSWER
Answered 2020-Dec-23 at 04:01You have three choices for loading DDS and other image files with WIC:
Use DirectXTex (the library)
Use DDSTextureLoader/WICTextureLoader (the standalone versions)
or use DirectX Tool Kit (the library).
There's no reason to use more than one of them in the same program, and it's going to conflict if you try. See this post.
Unless you are writing a texture processing tool, or need support for the plethora of legacy DDS pixel formats, using DirectX Tool Kit is usually the simplest. The tutorials for DirectX Tool Kit covers this pretty well.
The error you are getting indicates something much more basic to using Visual C++. The DirectXTex, DirectXTK libraries build using the recommended "Multithreaded DLL" version of the C/C++ Runtime (i.e. /MDd
and /MD
).
The error indicates your program is building with "Statically linked" version of the C/C++ Runtime.
See Microsoft Docs
You didn't mention what compiler toolset you are using other than "not VS".
See directx-vs-templates for a bunch of 'basic device and present loop' samples. If you don't use VS, there are 'CMakeLists.txt' available on that site.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DirectXTK
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page