Jump to content
  • Advertisement
Sign in to follow this  
Oxyacetylene

Very confusing texture problem - fixed

This topic is 4806 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a very weird problem in my application when I use 32 bit textures, and I was wondering if anyone has any idea what could cause this. I've just got to the stage of loading textures in an engine I'm working on. At the moment, the program simply loads in a texture, and displays it on a quad in the middle of the screen. The quad is blended on the screen using the blending mode SRCALPHA, INVSRCALPHA For the DirectX renderer I'm using the D3DXCreateTextureFromFile function. I've tried loading textures from 32bit png, and 32bit DDS files, and the same problem occurs. When I run my program in a debug build, it works fine, when I run my program as a release build from the Visual studio debugger, it works fine. When I run my program as a debug build outside of the debugger, it works fine. When I run my program as a release build, outside of the debugger, the texture loads fine, but it appears completely transparent when displayed on the screen. I've tried replacing the texture file with a 24bit png, with no transparency, and the texture displays perfectly when I do this. I don't get any warnings at all from the debug DirectX runtime. I'm completely at a loss as to why this would happen. I'm using the June SDK, with Visual Studio 2002 if it makes a difference. Anyone got any ideas? [Edited by - Oxyacetylene on June 18, 2005 2:40:31 AM]

Share this post


Link to post
Share on other sites
Advertisement
Just out of curiosity, I tried changing the blending mode to SRCALPHA, DESTALPHA. The transparent parts of the texture show up as black when I do this. When I run it in a release build outside of the debugger, the texture shows up as being completely black, which would seem to confirm my hypothesis that the texture is being drawn as completely transparent.

EDIT: it looks like the pixels around the edge of the quad are being drawn over the whole quad. When I turn blending off, the whole texture is displayed as white, when I run it outside of the debugger which is the colour that displays in the transparent areas when blending is off, when run inside the debugger.

Share this post


Link to post
Share on other sites
Off the top of my head make sure your initializing all of your values, in release build some values arent initialized properly (to zero) I remember having a similar problem which worked in debug but not release mode, it was because the iniital values of your variables are different, its the only thing I can think of.

Hope this helps.

Share this post


Link to post
Share on other sites
I managed to solve the problem. I just thought I'd post it here in case anyone happens to run across the same problem in future.

The texure wasn't just appearing as completely transparent, it was being textured flatly with some kind of average of the first few rows of the texture. I added support for the reference device, and the same problem was happening on the reference device too.

It was caused by the "Whole program optimisation" option in Visual Studio. When I switched this off, the program worked perfectly.

Hopefully that should help someone in future :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!