Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / white image instead of sprite.

Author
Message
waka324
16
Years of Service
User Offline
Joined: 31st Mar 2008
Location:
Posted: 16th May 2008 10:45
Hello.

I am having a slight issue when trying to load a sprite to the screen. It is a 640X124 image, and I had a similar issue with other images before, and I had determined that it was due to their dementions not being divisible by eight.

The odd thing with this problem is that it shows up most of the time, but every once and a while, the image will actually load perfectly! I would appreciate any help that could be given.

Attachments

Login to view attachments
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 16th May 2008 15:38
Its not that it needs to be divisible by eight, but it needs to be a power of 2.

By default, loading an image will load the image as a texture, and on many video cards, that has to be a power of two to prevent stretching, or blank space. I think you get it working at the times there is enough video memory to accomodate it, but then you either get stretching, or blank space.

There is a flag to the image loading. A value of 0, or no flag...loads it that way. A value of 1 will load an image of any particular size and not do anything to it. A value of 2 loads the image as a cubemap texture.

Anyway, try tacking an extra parameter on your load image function call....with the value 1.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th May 2008 15:42
Quote: "A value of 2 loads the image as a cubemap texture."


If you have minute, could you post what this means? I'll google it... I think I know... but I don't quite understand as I don't understand the ramifications of this flag... and I'm sure there is one.

jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 16th May 2008 15:47 Edited at: 16th May 2008 16:00
All I know is its "useful for shader implementation." Straight out of the DBPro help. Cubemap textures are applied differently than, say spherical ones, I assume.

I think that 0 and 2 will absolutely load it into video memory, and 1 will use system memory....maybe.

I do know that textures have mipmaps, and that is the reason for the power of 2 restriction. (Because each mipmap is half the size of the predecessor.) This is how the card can support crude LOD automatically.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th May 2008 16:41
thanx
I know if you do image manipulation - you need that 1 flag, as the mip maps hose sprites and the dbMakeMemblockFromImage command.

waka324
16
Years of Service
User Offline
Joined: 31st Mar 2008
Location:
Posted: 17th May 2008 10:58
ok. Well I tried modifying the texture flag with no difference, however, now that I think about it, It really should have been a power of 2. That would explain why a bitmap font I was working on only showed up about half the time, when it's sides were divisible by eight, but not a power of two. Thanks.
waka324
16
Years of Service
User Offline
Joined: 31st Mar 2008
Location:
Posted: 17th May 2008 11:16
yup. I split it into two different images and it works great now. Thanks for your help.

Login to post a reply

Server time is: 2024-09-29 21:27:20
Your offset time is: 2024-09-29 21:27:20