Graphics/incbin trouble

BlitzMax Forums/BlitzMax Programming/Graphics/incbin trouble

Chugs40(Posted 2006) [#1]
Here is a project i have been working on and it runs fine on my machine, but has graphics issues on others.

Link removed

Please compile and run and tell me if it runs ok.

You will notice after the intro, The programs main graphics files are loaded, most with incbin. I displayed the images just before capture and you will notice at one point one or more of my images turn white, like nothing there. And it only does this on other machines not on the one i am working on the project with.

I have had these problems on my last two bmax projects, I have also seen black frames around some of my imagery in the past. The last one being Jack-o's Revenge http://hsretrogames.com/jack-o.zip

So please help me figure this problem out...


Warren(Posted 2006) [#2]
Without knowing which specific images are giving you problems, this line jumped out at me:

_hucksprite:TImage=CreateImage(100,100,57,-1)

Have you tried creating your images as powers of two? Like 128,128 instead of 100,100? Most video cards get upset if the textures fed to them aren't powers of two.


FlameDuck(Posted 2006) [#3]
Images (textures) turning white is a symptom of one of two things:
a) Substandard drivers/DirectX combo.
b) Not enough video memory.

I'll check the other stuff when I get home.


ImaginaryHuman(Posted 2006) [#4]
White image can also happen if mipmapping is turned on and the full set of mipmapped images are not specified, in OpenGL anyway.


Chugs40(Posted 2006) [#5]
I have thought of alot of things in these replys.

But if it is a video memory issue why would the 2nd or 3rd image set not load properly and 1st and last one load fine, it makes no sense to me... Becouse if you notice at program startup the images are displayed before i capture my individual images. One always seems to not load or blank in the middle of the loading process. It's a creepy problem that's starting to annoy me.

As for mip-mapping goes, I did not initialize any of the images as mipmapped images in my image flags. If it is on by default how do i disable it?

I really don't think it is a memory/video memory issue, the program is not that big!

My earlier Bmax projects didn't seem to have this problem.


tonyg(Posted 2006) [#6]
Because the ones at startup are not incbinned?
What happens when you change the incbin to 'normal' loading?. Then change a single image to be incbin and check the result.
If the very first once becomes a white image you should be able to supply simple code to show the problem.
If the white images start after a certain number are changed to incbin you should look at a resource issue.


FlameDuck(Posted 2006) [#7]
I really don't think it is a memory/video memory issue, the program is not that big!
Video memory does not depend on the size of the program. It depends largely on the size and ammount of images. Also remember that video memory is also used by the framebuffer (and backbuffer). So if you only have 32 or 64 megs of video memory, you could be running out rather quickly.


Chugs40(Posted 2006) [#8]
Well supposing i am using to much video mem. How do i manually delete graphics objects in Bmax.

Like in my intro graphics are loaded, do they stay in memory/video memory, or are they released when the function terminates?

Or should i just use loadanimimage in stead of loading images and then creating my multiple image objects and capturing them from the loaded image?


REDi(Posted 2006) [#9]
*EDIT* oops, my bad! ;)

I would use LoadAnimStrip anyway.


Chugs40(Posted 2006) [#10]
Not to mension, i did away with the intro stuff, and still had problems on other machines. Meaning fewer images are loaded, and it should not be a problem.


tonyg(Posted 2006) [#11]
Because the ones at startup are not incbinned?
What happens when you change the incbin to 'normal' loading?. Then change a single image to be incbin and check the result.
If the very first once becomes a white image you should be able to supply simple code to show the problem.
If the white images start after a certain number are changed to incbin you should look at a resource issue.


So did loading outside incbin make any difference?


Warren(Posted 2006) [#12]
The power of two thing isn't it? Which graphics cards are those other machines using?


Dreamora(Posted 2006) [#13]
power of two is no problem.
BM automatically extends the image to be power of two and fills up with black (and just uses the original part for drawing).

One thing that at least with the DX7 driver is a problem is not square power of two which at least makes GeForce 6600 break ...


Chugs40(Posted 2006) [#14]
Just what dreamora said, bmax takes care of it. It's just got me baffled....

I know i mentioned before about the program not being that big, what i meant to say there really isn't that much media being loaded there. It's four local images less than 640x480 being loaded so i can capture my sprites, then they should be terminated when load_media() terminates, keeping my globals.

Maybe i sould consolidate it into fewer images and then capture what i need with grabimage()

And it still trips me out that it does it in the middle and not at the end of the loading sequences. (if it was a memory problem) Becouse if say the middle image is bigger, but the two that are loaded afterwards load just fine with the two put together are larger than the one that was skipped?

Maybe what i am doing is just out of the norm and too old school. Thats how i used to load and capture indivudual images when i was programing in c++.

Its wierd i am not used to not releasing my own graphics objects. I usually load tempory's and release them all the time.

I personally think incbin is not storing my images properly. Maybe the images are corrupt somhow or since the paths are on my machine when incbin does not find the binary data in the app it's finding it with the path in the incbin on my hard drive. (not likely probably) It's wierd becouse i ran it on a laptop newer than mine with more memory and everything. It's got me baffled and seems to keep happening to me on my newer projects, especially since version of 1.18 or higher of bmax.

So who knows what is going on.... But hey thanx to all who are helping me on this.


tonyg(Posted 2006) [#15]

Because the ones at startup are not incbinned?
What happens when you change the incbin to 'normal' loading?. Then change a single image to be incbin and check the result.
If the very first once becomes a white image you should be able to supply simple code to show the problem.
If the white images start after a certain number are changed to incbin you should look at a resource issue.



So did loading outside incbin make any difference?



So *DID* loading outside incbin make any difference?


Chugs40(Posted 2006) [#16]
No loading outside incbin did not make any difference.

At one time i did away with all of the incbins and still had issues with my images.


tonyg(Posted 2006) [#17]
OK, does the problem occur when loading just one of the 'problem' images or when you get to a certain number of images loaded?


Chugs40(Posted 2006) [#18]
Some times it seems like it does and other times it makes no sense at all.

I have couple ideas i am going try, i will post again later...


Chugs40(Posted 2006) [#19]
Well I tried to separate the images into different functions to load and capture individually, it did not work the results were even worse! i thought for sure it would work.

The only other thing i can think of is maybe use animimage.

If the mods aren't syncronized right could that be a problem? Just can't figure it out....

Man, maybe i'll throw something together with blitzplus, and see how the imagry loads, if i still have problems then it must be a memory/video memory issue.


Chugs40(Posted 2006) [#20]
Well i can't seem to figure this out.

I did away with incbin entirely all of the games media is now in the data folder. Still won't work right.

So please download, compile and run on your machine and let me know if it works ok (no white blocks for images)


REDi(Posted 2006) [#21]
I noticed (old version) that you're flipping the backbuffer before you grab the images, try flipping after (or no flip at all), I think the backbuffer might be invalid on some machine after a flip, just a thought.

*EDIT*
Also try turning off MaskBlend before drawing the original images.

No white blocks here, but all images are merged because of MaskBlend


Chugs40(Posted 2006) [#22]
The flips are in there to see if the images actually load, so i can capture my idividual imagery. The flips didn't seem to matter either way.

Please try tweaks you think might work, becouse you can now compile my source code all of the graphics etc. are in the data folder.


REDi(Posted 2006) [#23]
cant because we dont have "c:\mingw\hero.o"

*EDIT* oh, its not needed, I just commented it out.


REDi(Posted 2006) [#24]
Okay it works fine here, I commented out the SetBlend(MASKBLEND) at the top (line 17), and removed the flips from load_media.

With the flips in I get Currupt graphics!

Looks like a interesting game mate, well done! That'll look a treat on my arcade machine ;)

*EDIT* no, its seems that the SetBlend didnt actually make any difference, but the flips definatly do on my machine.
BTW, the music distorts big time at full volume, sounds good at 50% tho.


REDi(Posted 2006) [#25]
*images removed*

But I suppose this really doesnt have anything to do with the problem your having with white textures, so you could try it like this...

So it only holds one big image at a time. as I dont get this white texture problem, I cant tell if it make a difference or not, but at least it wil save a lot of video memory, because bmax uses power of two textures, your 640x480 images are actually loaded as 1024,512 (..or is it 1024x1024, not sure)

anyway worth a try.


Chugs40(Posted 2006) [#26]
REDi,
I had that goofy frame problem when i would compile the app with 32 bit graphics.

Oringinaly those flips weren't there, i added those so i could see the images as they load on my desktop so i could see if they were actually loading before capture.

Well if you got it to work in your ide, try running the app on another machine and tell me what happens. Thats what baffles me it will run fine at compile time and running the app of my machine. but when i take it to another machine and run the app some the graphics don't load right.

Did the intro and the menu graphics work ok? (Press space to pull up the games menu)


REDi(Posted 2006) [#27]
oh, just run it again and hero03.png does display as a pure white image, very strange! it worked fine this morning :/

*EDIT*
But it does work perfectly with d3d7 driver! seems to be an opengl bug :(


REDi(Posted 2006) [#28]
If I use pixmaps instead of images it works in opengl



I really dont understand why it worked fine this morning but now I get this white texture problem when loaded as images.

*EDIT*
Are Pixmaps stored in system memory, instead of video memory?


Chugs40(Posted 2006) [#29]
I was dink'n around with blitzplus this morning loading the images and stuff. Blitzblus wouldn't let me use underscores infront of my variables or graphics object names.
I thought hmmm. I went back into blitzmax removed all of the flips and removed all of the underscores from the front of my graphics object names and it worked fine on my crappy old desktop (w/ only 12mb video ram or so!)

I'ts strange but i think the under score was causing problems some how. Try removing the underscores and see what happens (using images not pixmaps)

As for now that also seemed to solve the problem, still afraid to use incbin though!

Thanx for taking the time to check this out, i knew something wierd was going on...


Chugs40(Posted 2006) [#30]
REDi,

About the volume issue, i've had a couple reports of distorted music.

Are you putting your system volume at 50% or the games music volume at 50%. Just curious.

i'd like to fix that problem to.


REDi(Posted 2006) [#31]
Yes removing the underscores does the trick, probably worth posting that in the bug forum. strange that it didnt effect d3d7 or pixmaps the same as it did opengl images :/

I was setting the game volume at ~50% to stop the distortion, I tried it with my directsound audio driver and it doesn't distort half as much as it does with the freeaudio driver.

looking at your music in soundforge there is some visible clipping going on, that means its been recorded a tad to loud.


Chugs40(Posted 2006) [#32]
Thanx, REDi

I will probably bust the ol' keyboard out and re-record my music samples.

Hey where can i find soundforge? I've heard of it, i would like to try it out


REDi(Posted 2006) [#33]
You can find a trial version of SoundForge 8 here... http://www.sonymediasoftware.com/download/step1.asp?CatID=1


Chugs40(Posted 2006) [#34]
Thanx, i will check it out...