grabsprite and transparency

Previous topic - Next topic

planetm

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...

Schranz0r

first you have a Sprite with transperents, right?

why you want to grab it twice?
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

planetm

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.

Kitty Hello

Must work.
1. Did you update to latest version?
2. Can you post a minimal sample that's not working?

planetm

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!