turbulenz / turbulenz_engine

Turbulenz is a modular 3D and 2D game framework for making HTML5 powered games for browsers, desktops and mobile devices.
http://turbulenz.com
MIT License
4.55k stars 513 forks source link

Transparent Background #23

Open sweaver360 opened 11 years ago

sweaver360 commented 11 years ago

Is it possible to have a transparent background in Turbulenz? I tried setting the alpha value in graphicsDevice.clear(), but the background always seems to be black rather than whatever color is behind the window.

davidgaleano commented 11 years ago

The TurbulenzEngine creates a WebGL context without an alpha channel, so changing the alpha value when calling clear is not going to help. Are you trying to blend the whole rendering with the background web page or just the pixels with an alpha value lower than one? The former may be possible with CSS styling, the later would require a small change on the engine code.

sweaver360 commented 11 years ago

Thanks for the quick response. I'm trying to blend only the pixels with an alpha value lower than one, so that I can have a 3D object with no background that blends in with whatever page it's on. Could an override be added to the engine code that would allow that, or is that something the developers are against?

davidgaleano commented 11 years ago

It maybe easier just to change the engine code. The variable setting alpha to false is hidden inside an internal function not available to the outside world, you would need to to overload the browser function canvas.getContext to ignore the alpha value. I will change our code to support passing an alpha property on the creation parameters to TurbulenzEngine.createGraphicsDevice.

In general we prefer if you contact us with your needs on our Google Group for engine users so we can fix the problem or explain a safe workaround (which could be an override), but if you are in hurry and you need to ship your application then do whatever you need to, just be ready for things breaking :-)

sweaver360 commented 11 years ago

Thanks for the help! Sorry, I'm still really new to Turbulenz so I wasn't aware there was a Google Group.

I'm not in a huge hurry so I can probably wait for the official change in the engine code. Would you happen to know when the next SDK release is scheduled for?

davidgaleano commented 11 years ago

The next SDK will be released soon but I cannot guarantee that this change will be on it, we do have a QA process that may delay some changes until they are properly tested.

sweaver360 commented 11 years ago

OK, thanks for the info. I'll keep an eye on the release notes for the next few releases. Will the SDK notify me when a new version is available for download?

davidgaleano commented 11 years ago

If you use our local development server you will be notified when a new SDK is available.

beniwtv commented 10 years ago

+1 that feature would be very handy :)

davidgaleano commented 10 years ago

This feature is already supported in the latest version:

http://docs.turbulenz.com/jslibrary_api/engine_api.html?highlight=creategraphicsdevice#creategraphicsdevice