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.

Newcomers DBPro Corner / Can textures in .png format be used with "set object transparency" command?

Author
Message
Gyrich
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Here, obviously.
Posted: 24th Jan 2006 21:59
i tried to use a .png (because the file size is smaller) but the transparency won't take effect, no matter what number (1 thru 5) i use for the transparency command.

I changed the texture to a .bmp and the transparency worked fine, so im glad there is a workaround, but if possible i'd like to use the smaller .pngs. I'll be switching out 53 textures on 52 objects when the objects are clicked, and my game already chugs along at almost <30 fps ; ;. I would like my game to run smoothly at 1024x768 with 32-bit depth, but i'm running with 16-bit depth right now and can't get above 25 fps.

In any case, any insight you guys have on the transparency question above, and hopefully my slow frame rate would be appreciated. My game is a match cards game, very simplistic, just a skybox, and 52 other simple box objects for the cards, i wouldn't think it should slow down that much. my pc's specs are below

here's the code its my code from work so it doesn't have any of the media loading and handling commands, sorry. I'll upload the code will all the media handling when i get home tonight:



DBPro User
PC: WinXP, AthlonXP 2100+ 1.7ghz, 80gb HD, Nvidia GeForce FX 5200 (128mb onboard RAM), 512mb DDR400 system RAM. Thank you for your help.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Jan 2006 22:27
Quote: "but i'm running with 16-bit depth right now and can't get above 25 fps"


That's the problem...you can't have true transparency with 16 bit mode.

With your bitmaps, it's just making the black pixels non-existent. With a PNG, you have an alpha layer, which is the last 8 bits of a 32 bit image. They are ignored in 16 bit display mode.

To be honest, 16 bit mode should be slower than 32 bit. There is more work involved in downgrading the textures. The slow-down comes in when your texture memory requirements are greater than the amount of memory on your graphics card.

Gyrich
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Here, obviously.
Posted: 25th Jan 2006 10:15 Edited at: 25th Jan 2006 10:24
Thank you as always BatVink . any idea what i can do to rid myself of some of the slow down? im currently converting all my .pngs for the card images to .bmps since i still haven't figured out how to get png's to turn transparent. I thought using bitmaps would slow the game down more because of their larger file size. here's the code with all the media handling included:



Also of note: 32-bit depth was still slower for me than 16-bit ever was, i would stick with 16-bit depth if it didn't mess up the color blending on my images. what do u think?

Lastly an unrelated problem: my main menu background image shows up fine when i first execute the code, but if i complete a game and choose to go back to the main menu, the background image shows up for a brief instant, then either disappears or is covered by a blue screen the same color as the screen that pops up to give the player choices after a game has been completed (look in the gameover() function to see the choices im referring to). i think its the default blue for dbpro when you clear the screen or whatever its called. Anyway i haven't been able to fig out how to get main menu image to stay visible like its supposed to, could use u guys help.

DBPro User
PC: WinXP, AthlonXP 2100+ 1.7ghz, 80gb HD, Nvidia GeForce FX 5200 (128mb onboard RAM), 512mb DDR400 system RAM. Thank you for your help.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Jan 2006 11:00
The first thing to note is that you are using the automatic SYNCing, which is not "normal", for want of a better word. It is "normal" practise to SYNC yourself and thus be in control. The first thing you do is:

SYNC ON: SYNC RATE 60

This will switch manual SYNCing on, and set the frame rate to 60 (60 being the max, but may be slower if the computer can't manage that rate).

Then, you SYNC when you need to. The general pattern is:



There are some routines which will affect the FPS because of the way they are written. For example, this code:



The maximum FPS you can get here is 33 FPS. That's because the WAIT 30 introduces a delay that drops the FPS to 33. Remember that SCREEN FPS() is just an average, and will take this into account.

Hope this helps a little.

Login to post a reply

Server time is: 2024-09-24 15:37:54
Your offset time is: 2024-09-24 15:37:54