Did you succesfully solve transparency problem with SDL2?

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
AlBo
Posts: 2
Joined: September 11th, 2018, 1:09 pm

Did you succesfully solve transparency problem with SDL2?

Post by AlBo »

Hello,

I'm sorry to come here for my own problem not regarding Wesnoth in any way but I'm currently fighting with SDL2 transparency processing and I've read some quite old posts here talking about this problem when you migrated from 1.2 to 2.0.

It's also why I'm coming here. I cannot find answer to my problem and I really wonder if it's because I don't understand the basic concept or if there is a real problem in SDL2.
As I suppose you deeply explored this, maybe you could point me out on the right direction.

Basically, I want to render an image on a transparent/semi-transparent intermediate texture and then, render this result on a background.
Using SDL_BLENDMODE_BLEND, I note that everytime I add an intermediate even fully transparent texture, I loose informations in the resulting image. It's like if the initial image gets more and more transparent which is not what I'm expecting for as the initial image is supposed to be on top.

It's maybe not really usefull to explain what I tried, it's quite simple and fully explained here https://discourse.libsdl.org/t/how-to-c ... ency/24996.

If someone knowing SDL2 could spend a couple of minutes to take a look at the post above and tell me where I'm wrong, I would greatly appreciate.

Alain
gfgtdf
Developer
Posts: 1431
Joined: February 10th, 2013, 2:25 pm

Re: Did you succesfully solve transparency problem with SDL2?

Post by gfgtdf »

hmm well i didnt notice any issue with transparency recently so i guess we did fix it somehow, unfortunateley, the aginor who iirc did most of the sdl2 transition (https://github.com/wesnoth/wesnoth/comm ... hor=aginor) is not longer active. And i personally don't know much about this. Also note that the current stable branch (the 1.14 release) does not use any hardware accerleration (gpu) at all (we intend to impove this in 1.16). Vultraz also did quite some work on this in 1.15 so maybe he can help you.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
AlBo
Posts: 2
Joined: September 11th, 2018, 1:09 pm

Re: Did you succesfully solve transparency problem with SDL2?

Post by AlBo »

Hello,
Thanks for your answer anyway and I hope that Vultraz could say something about this topic.

Al
User avatar
GunChleoc
Translator
Posts: 506
Joined: September 28th, 2012, 7:35 am
Contact:

Re: Did you succesfully solve transparency problem with SDL2?

Post by GunChleoc »

I have never written a back-end for this either, but you could have a look at the Widelands code. Start from https://bazaar.launchpad.net/~widelands ... lor.cc#L31 and use an IDE to dig through the control flow. There might be some shaders involved in there too, and you'll hit some deferred rendering on the way.

Or maybe this is all you need: https://github.com/wesnoth/wesnoth/blob ... s.cpp#L261
Post Reply