SDL and transparency

Discuss SDL programming with the RebelSDL plugin here
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

SDL and transparency

Post by Allanon »

Hello,
I'm having problems drawing hardware brushes with an arbitrary transparency (on WIndows).

The drawing tag "transparency" seems to be not supported while RebelSDL is used, I've also tried to use

Code: Select all

sdl.SetTextureAlphaMod(1, 100)
Where 1 is the id of my hardware brush, but it says that the object is not found.

Any hints?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair »

The "Transparency" tag of @BRUSH and LoadBrush() works here with RebelSDL. Please post a code snippet if it doesn't work you and I'll take a look.

sdl.SetTextureAlphaMod() and all other RebelSDL commands which expect an identifier of a hardware brush require Hollywood 7.1, unfortunately :)
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon »

Hi Andreas,

here a screenshot running on Windows 10 :
Image

and here is the snippet:

Code: Select all

; TESTING DRAWING TAGS & SDL
; --------------------------------------------------------------
@REQUIRE "rebelsdl"

LoadBrush(1, "test.png",
          { Hardware = True, Display = 1, LoadAlpha = True })
                    
                    
Local tags = 
  { ; Width = 300, Height = 300,
    ; ScaleX = 0.5, ScaleY = 0.5,
    ; Rotate = 125,ù
    ; Transform = { 1, 0.5, 0, 0.5 },
    ; SmoothScale = True,
    ; AnchorX = 0.5, AnchorY = 0.5,
    Transparency = 100
    ; Tint = 100,
    ; TintColor = #RED,
    }
    
BeginDoubleBuffer(True)

Repeat
  Cls(#RED)
  DisplayBrush(1, #CENTER, #CENTER, tags)
  Flip()
Forever
For the sdl commands, ok, I will update HW in the next weeks ;)
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair »

Sorry, I misread your original post. Indeed, the "Transparency" tag in DisplayBrush() et al. isn't supported by RebelSDL and GL Galore because the Hollywood SDK doesn't support this. Would be a nice addition though but before this is possible the SDK will need a new interface that supports it.
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon »

:cry:
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair »

As a workaround, you can use sdl.SetTextureAlphaMod(), though. But it needs Hollywood 7.1...
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon »

Well, I've planned to switch to Hollywood 7.1 so it's good to hear that :)
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon »

Here again to try to change the alpha of an hardware brush :)

Code: Select all

@REQUIRE "rebelsdl"

LoadBrush(1, "config/icons/arun.png", { Hardware = True, LoadAlpha = True })
sdl.SetTextureAlphaMod(1, 100)
DisplayBrush(1, 100, 100)

WaitLeftMouse()
With this snipped I'm getting this error:

Code: Select all

Requested object not found!
I think it is referring to the brush id... I'm missing something?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair »

No, I'm afraid these functions need Hollywood 7.1 because they need a new SDK API which is not available in 7.0 and earlier.
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon »

Ok, sorry Andreas for having asked the same question two times, reading back my first post you already answered that these functions require HW7.1
Let's hope for a quick release then :)
Post Reply