bmp loading problem

Previous topic - Next topic

Gary

Just on the first steps of my first program and hit a stumbling block

I am trying to load some BMP graphics at the start of the program and have the code as follows

Code (glbasic) Select

                     SETTRANSPARENCY RGB(54,255,0)
LOADSPRITE "background.bmp",0
LOADSPRITE "15.bmp",1
LOADSPRITE "16.bmp",2


followed by the rest of my code, now if I compile and run the screen flashes up loading and bombs straight out, if I comment out LOADSPRITE "16.bmp",2 the code compiles and runs fine

Is there a specific size required for the sprites? does it need to be a multiple of say 2 4 or 8 and I got lucky with the first one?

I can post the BMPs if required

Thanks
Gary

Schranz0r

how big is that bmp? what graphiccard do u use?
Maybe your card doesen't support big "textures" / sprites
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Hemlos

#2
Quote from: Gary_Leeds on 2009-Oct-11
Is there a specific size required for the sprites? does it need to be a multiple of say 2 4 or 8 and I got lucky with the first one?

I can post the BMPs if required


1. i think theres a size limit, i ran into a problem like this recently.
2. opengl really loves to draw a power of 2 image, yes 2x2 4x4 8x8 etc etc
3. odd size images do different things...like liquifying. a 3x3 image with a black border and white dot, rendered onto a square power of 2 size object will make the dot stretch and fade to black on the edges. However, a power of 2 image will make perfect distinctions of pixels. And i THINK(not positive about this)Possibly visa versa, a power of 2 image on an odd sized object will create blending of color while a power of 2 size object will retain the pixel sharpness.

Basically, opengl is not picky, it does what it does according to what you give it.
In your case, i would start with limiting my texture size to the width and height of the screen size in your GLBasic options window.
Bing ChatGpt is pretty smart :O

Schranz0r

there is no limit from GLB, its only from the graphicscard
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Moru

For textures to work on most cards, limit the size to a power of two and no bigger than 512x512. This should work on most cards.
So make those sprites 16x16, 32x32, 64x64, 128x128 and so on. Also always equal height as width.

Gary

Sorry, I should have said the bmp that loaded was 40x13 and the one that doesnt is 27 x 13. I have a few others that are similar sizes that load and dont load and all the ones that load have an even number of pixels in the x size and the ones that fail have an odd number. Convert them all to PNGs and they load regardless of size.

Thanks for the help

Gary

Ian Price

Can you post the actual images, so that we can have a play with them?
I came. I saw. I played.

Gary


This one doesnt work


This one does

But as I said convert them to PNGs and they work with no resizing

Ian Price

There does indeed appear to be a problem with the first bitmap format. How was this saved? It seems to be incompatible for some reason - minor corruption perhaps?

However, if you convert it to a .PNG and then back to a proper 24bit .BMP it works fine. As it is now, it doesn't work. Odd though.
I came. I saw. I played.

Gary

i used a tool I wrote quickly to cut an image into smaller bitmaps, obviously there is a bug in there.

Thanks for your help

Hemlos

#10
You built this image file with glbasic write commands?
It seems there is too much info in this bmp.
Bing ChatGpt is pretty smart :O

Gary

no, it was written ages ago with borland so the bug is not with GLBasic

MrTAToad

Its possible an older version of BMP - I would load it in Paint and then resave it.

Hemlos

Tested, Definetly resave it...it works fine at that resolution in 24 bit.
Bing ChatGpt is pretty smart :O

Kitty Hello

It's a bug. I fixed it in the next update.
I suggest using PNG, though.