[Pharo-dev] Transparent colors with NBOpenGL?

Alexandre Bergel alexandre.bergel at me.com
Tue Dec 24 03:14:09 EST 2013


Wow!! Impressive Ronie! 
Works pretty well!

I’ve played a bit:

Transparency + lighting model



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	| view el1 el2 |
	view := R3View new.
	view lightingModel: R3MultipassPerPixelLighting new.
	el1 := (R3CubeShape new color: (Color purple alpha: 0.2)) element.
	el2 := (R3CubeShape new color: (Color purple alpha: 0.2)) element.
	el1 makeTranslucent.
	el2 makeTranslucent.
	view add: el1; add: el2.

	el2 translateByZ: -2.
view add: (R3SpotLight position: (R3Vector3 newX: 0 y: 2 z: 0)
					direction: (R3Vector3 newX: 0 y: -1 z: 0)
					cutoff: 45 exponent: 10
					color: Color cyan).
					
	view addInteraction: R3MouseControl new; addInteraction: R3KeyControlForMac new.
	view open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Just posted on 
https://www.facebook.com/photo.php?fbid=562076237212311&set=a.552518388168096.1073741834.340543479365589&type=3&theater

Cheers,
Alexandre


On Dec 24, 2013, at 3:23 AM, Ronie Salgado <roniesalg at gmail.com> wrote:

> Hi Alex,
> 
> Translucent objects requires a singlepass lighting model, which I took the opportunity to complete and make it the default one.
> I put your example with a slight modification under R3Example>>translucentCubes
> Translucent elements require a reception of the message makeTranslucent since their rendering must be handled in a special way. They must rendered after all the opaque objects, in a back to front order without depth writing. Currently only depth writing disabling per element is supported, so their rendering is not going to be perfect, but at least some transparency can be seen.
> 
> Greetings,
> Ronie Salgado
> 
> 
> 2013/12/23 Igor Stasenko <siguctua at gmail.com>
> 
> 
> 
> On 23 December 2013 22:04, Alexandre Bergel <alexandre.bergel at me.com> wrote:
> Hi!
> 
> Is there a way to have transparent colors with NBOpenGL?
> I’ve tried the following (using Roassal 3d):
> 
> -=-=-=-=-=-=-=-=-=-=
> | view el1 el2 |
> view := R3View new.
> el1 := (R3CubeShape new color: (Color purple alpha: 0.2)) element.
> el2 := (R3CubeShape new color: (Color purple alpha: 0.2)) element.
> view add: el1; add: el2.
> 
> el2 translateByZ: -2.
> 
> view addInteraction: R3MouseControl new; addInteraction: R3KeyControlForMac new.
> view open
> -=-=-=-=-=-=-=-=-=-=
> 
> But I get something like:
> <Screen Shot 2013-12-23 at 10.03.37 PM.png>
> Would it be possible to have translucent cubes? Any OpenGL expert around?
> 
> 
> Come on, Alex, sometimes you make me think you just came from the Moon.
> 
> http://www.opengl.org/archives/resources/faq/technical/transparency.htm
> http://www.openglsuperbible.com/
> google: opengl transparency
>  
> Alexandre
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> 
> 
> 
> 
> 
> 
> -- 
> Best regards,
> Igor Stasenko.
> 
> <translucent.png>

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131224/12dd680e/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2013-12-24 at 9.10.08 AM.png
Type: image/png
Size: 46611 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131224/12dd680e/attachment.png>


More information about the Pharo-dev mailing list