Setting alpha to a layer / render to texture

I have a layer, on which I draw solid rectangles.
The layer has an alpha of 0.5

The result is that all rectangles are drawn as if they had an alpha of 0.5, instead of first drawing the rects, and then applying alpha.

The result now is that sections which overlap, show in a different color than others.
How can I change this [import]uid: 5942 topic_id: 15909 reply_id: 315909[/import]

Are you sure you are talking CoronaSDK? Layers, Drawing…??

If you make two transparent items overlap, the overlapped portion will be darker than the transparent one.

Do you mean Group? instead of Layers?

And if that is the case, why would you want to set alpha properties on a Group? The group is transparent anyways.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15909 reply_id: 58866[/import]

Yes I am talking about corona.
Groups are the only way to have “layers”, as they control the draw-order.

I want to set the alpha of a group to something, because I draw several rects on to of each other to create a red/green mask based on a map. No

The mask should be 50% transparant, which is currently not possible in corona. [import]uid: 5942 topic_id: 15909 reply_id: 58868[/import]

why do you not make 50% transparent mask in Photoshop instead and use an image.

I have trouble understanding your question because the terminology you use is so different from that used in Corona.

Masks in Corona are B&W and are used to restrict portions of the image not colors.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15909 reply_id: 58870[/import]

Because the mask is dynamic.

Even if I create a 50% mask, I cannot overlap two rects, because it will add the colors [import]uid: 5942 topic_id: 15909 reply_id: 58871[/import]

Beware:

Setting the alpha of a group to 0.5 is probably not the same as setting the alpha of all child objects of the group to 0.5 - I don’t know how Corona works but I can imagine that a displayGroups becomes one openGL ‘polygon’, so setting it’s alpha will work on the total ‘flattened’ image, and not on it’s subcomponents.

Also, I’m not sure if the color filter effect you describe is possible. There are new blend mode for bitmap in the latest daily builds, but I haven’t played with these yet. Standard opacity will not give you color filtering effects, mind you. [import]uid: 70134 topic_id: 15909 reply_id: 58909[/import]

Actually, it is the same.

It does not work the way you say it works. The way you explain is exactly what i’d want.

Ansca should take a look at some of the features of cocos2d:

CCAtlasNode
CCRenderTexture
CCLayer
Hopefully things will be better with the new blendmode… I can implement what I want using that. [import]uid: 5942 topic_id: 15909 reply_id: 58912[/import]

I stand corrected - thanks for testing :slight_smile:

Yup, some more control over the graphics pipeline would be nice. I’m waiting for copypixels badly - assuming that this is a lot faster than the current methods, of course. [import]uid: 70134 topic_id: 15909 reply_id: 59029[/import]

Yes, I really hope ansca will try and push some of the graphics stuff.
The CCAtlasNode for example, would be a great thing for tiled maps, where there are still a lot of problems performancewise.

Nevertheless, so far corona is rocking my world :D. Coding is fun and fast again! [import]uid: 5942 topic_id: 15909 reply_id: 59031[/import]