Loading textures #285
-
|
I've been at it for several hours now, my old SharpDX code doesn't seem to translate. And the C++ example code is 800 lines. So I'm giving up, and asking. Does anyone have some code to load a png into a texture2d? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 27 replies
-
|
Here's what I have, but as you can see, there are things missing, because many of my helper functions don't work anymore. |
Beta Was this translation helpful? Give feedback.
-
|
@Gavin-Williams i use a load into a bitmap then translate the bitmap data to the format in Texture2d, Can dump code here (it's a bit verbose though) This function is what im currently using, its a little inefficient but its a cut over from sharpdx days. Takes care of whether you want to create autogen mip maps ` ` Let me know if you want the rest. |
Beta Was this translation helpful? Give feedback.
-
|
This function is for the first code, will help ` //====================================================================================================================================// |
Beta Was this translation helpful? Give feedback.
-
|
Are there still examples using WIC? I couldn't find them in the main project or the samples project. They all seem to use SkiaSharp? |
Beta Was this translation helpful? Give feedback.
@Gavin-Williams i use a load into a bitmap then translate the bitmap data to the format in Texture2d, Can dump code here (it's a bit verbose though)
This function is what im currently using, its a little inefficient but its a cut over from sharpdx days. Takes care of whether you want to create autogen mip maps
`
public static ID3D11Texture2D CreateTex2DFromBitmap(System.Drawing.Bitmap bsource, D3D11.ID3D11Device1 d3dDevice, D3D11.Texture2DDescription textureDesc)
{
ID3D11Texture2D t2d_ = null;