horde3d / Horde3D

Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.
http://horde3d.org/
1.52k stars 306 forks source link

Incorrect casting from H3DFormats to TextureFormats #202

Closed Axodoss closed 2 years ago

Axodoss commented 2 years ago

I am creating a texture by calling the following function like this: h3dCreateTexture(name, image->width, image->height, H3DFormats::TEX_BGRA8, H3DResFlags::NoTexMipmaps);. This worked before but at some point in time a change to either TextureFormats in egRenderBase.h or TextureResource *texRes = new TextureResource( safeStr( name, 0 ),(uint32)width,(uint32)height, 1, (TextureFormats::List)fmt, flags ); in egMain.cpp was made that breaks the texture creation process. the fmt value is simply cast from H3DFormats to TextureFormats which for TEX_BGRA8 results that a R8 texture is created instead of a BGRA8.

Workaround is to do the following when creating a texture: h3dCreateTexture(name, image->width, image->height, 7, H3DResFlags::NoTexMipmaps);

algts commented 2 years ago

Hello. Thanks for reporting, I'll take a look and will fix it soon.

algts commented 2 years ago

Did you update Horde3D.h file in your configuration? If we take current bindings, tex formats in Horde3D.h should be the same as in egRendererBase.h: https://github.com/horde3d/Horde3D/blob/cd7ba67a0e10edddb6927254b0393c6182a6f63f/Horde3D/Bindings/C%2B%2B/Horde3D.h#L285 https://github.com/horde3d/Horde3D/blob/cd7ba67a0e10edddb6927254b0393c6182a6f63f/Horde3D/Source/Horde3DEngine/egRendererBase.h#L243

Axodoss commented 2 years ago

Thank you for your help. You are correct, sorry for the false issue report. I now see that I was compiling using an older version of the header file.