GLBasic forum

Main forum => GLBasic - en => Topic started by: planetm on 2007-May-12

Title: grabsprite and transparency
Post by: planetm on 2007-May-12
In my current project I'm grabbing a sprite from the backbuffer. Some of the image I have drawn to the backbuffer is RGB(255,0,128) which I assume should be transparent once I grabsprite. However, when I later draw the sprite to the screen it appears with the magenta (255,0,128) areas visible and not transparent.

I'm using a laptop with the desktop set to 32bit colour depth and i'm running the glbasic program full screen. Does transprency work with 'grabsprite' sprites? If so, what might I be doing wrong?

Thanks...
Title: grabsprite and transparency
Post by: Schranz0r on 2007-May-12
first you have a Sprite with transperents, right?

why you want to grab it twice?
Title: grabsprite and transparency
Post by: planetm on 2007-May-12
I'm actually using a sprite the size of the screen to mask everything except the specific areas of an image below it that I want to show. Imagine a fullscreen "hidden" image where the mouse controls a spotlight illuminating only a small part of the image, the rest remaining black.

I set the whole backbuffer to black, then draw in (255,0,128) the area I want to be transparent (depending on the mouse position). Finally I use grabsprite to make a sprite the size of the screen.

For the actual display I then draw the "hidden" image to the backbuffer, draw my new sprite over the top of it and hopefully the area I drew in (255,0,128) should show through.

I repeat this process over and over again to change the part of the "hidden" image which shows through my mask sprite depending on the mouse position. I hope that makes sense.

All that actually happens is that I end up with a magenta blob following the mouse around, no transparency.
Title: grabsprite and transparency
Post by: Kitty Hello on 2007-May-12
Must work.
1. Did you update to latest version?
2. Can you post a minimal sample that's not working?
Title: grabsprite and transparency
Post by: planetm on 2007-May-13
Sorry, it was my own stupid mistake. I'd set the background image using loadbmp, but then drawn the mask sprite over the mask image so the magenta I saw was my drawn magenta area showing through the transparent sprite areas.

What I could have used would be a command to reset the backbuffer (like cls but still displaying the loadbmp image) without having to showscreen, does such a command exist?

Thanks for you help already, sorry to have wasted your time!