DirectXTex | DirectXTex texture processing library | Game Engine library
kandi X-RAY | DirectXTex Summary
kandi X-RAY | DirectXTex Summary
Copyright (c) Microsoft Corporation. This package contains DirectXTex, a shared source library for reading and writing .DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion. This library makes use of the Windows Image Component (WIC) APIs. It also includes .TGA and .HDR readers and writers since these image file formats are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec. This code is designed to build with Visual Studio 2017 (15.9), Visual Studio 2019, Visual Studio 2022, or clang for Windows v11 or later. Use of the Windows 10 May 2020 Update SDK (19041) or later is required. These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see Where is the DirectX SDK?.
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 DirectXTex
DirectXTex Key Features
DirectXTex Examples and Code Snippets
Community Discussions
Trending Discussions on DirectXTex
QUESTION
I'm trying to generate mip map chain from an .exr HDR image with the DirectXTex function DirectX::GenerateMipMaps().
But the result have all pixel clamped to 1.0f.
The source image have some to pixel superior to 30.0f, but after the mimap generation there are all clamp to 1.0. it's a knowing issue? i miss a specific flags?
...ANSWER
Answered 2022-Apr-04 at 21:00Most of the DirectXTex functions, including GenerateMipMaps, were originally written to use the Windows Imaging Components (WIC) feature of the Windows operating system. This works for many cases, but there are lots of edge-cases for textures where this causes a problem. For example, WIC's resize function will always use 8-bit per channel formats and therefore will lose the HDR range as you have seen.
Therefore, DirectXTex has custom filtering codepaths as well. Normally these are picked automatically based on the source format but you can provide the filter flag TEX_FILTER_FORCE_NON_WIC
to ensure it uses the custom paths.
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.
QUESTION
So far, I tried to do this with my DirectX 11 project to load a texture:
I downloaded DirectXTex source, included source files into my project and tried to compile, but got errors. I got errors from these header files: WICTextureLoader.h
, DDSTextureLoader.h
, and DirectXTex.h
. The errors were from header files, and not my own code. Then, I tried WICTextureLoader11.h
and DDSTextureLoader11.h
, and the error that I got was undefined reference to the function CreateWICTextureFromFile()...
(or the same, but with DDS).
I think, the problem here could be that the compiler (I use Clang/GCC) cannot find the .lib
file? However, some people here mentioned that you could just throw the source files into your folder and everything would be OK. Seems like, it's not OK for me. If this is the problem, is there a way to get the binaries (.lib
) without going through VS installation and other stuff?
ANSWER
Answered 2020-Aug-09 at 22:03The DirectXTex library can be built with clang/LLVM for Windows or Visual C++. The project includes a CMakeLists.txt for building the DirectXTex library, and optionally the command-line tools, using CMake. If you have your own make solution, you can work out the details by referencing that file.
To use the DirectXTex library functions (a.k.a. LoadWICFromFile
, Compress
, etc.), you need to link to the DirectXTex library, which you can do in CMake via add_subdirectory
and target_link_libraries
. You also need to add the include path:
To use it from your own CMake:
QUESTION
I've been trying to implement a BC1 (DXT1) decompression algorithm in Java. Everything seems to work pretty precise but I've ran into problem with some blocks around transparent ones. I've been trying to resolve it for a few hours without success.
In short, after decompressing all blocks everything looks good except for the blocks whose are around transparent ones. During the development I've been checking results with results from DirectXTex (texconv) which is written in C++.
This is my result compared to DirectXTex one:
Here is the code I'm using:
...ANSWER
Answered 2020-Jan-02 at 22:02Is it that blockPalette[2].set(c2r, c2g, c2b);
should be blockPalette[2].set(c2r, c2g, c2b, 255);
? (in two locations)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DirectXTex
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