[Gambas-user] gb3: gb.opengl will not render alpha channel of 2D texture

Kevin Fishburne kevinfishburne at ...1887...
Sat Jul 30 22:26:59 CEST 2011


On 07/30/2011 12:57 PM, Laurent Carlier wrote:
> Le Samedi 30 Juillet 2011 00:19:41, Kevin Fishburne a écrit :
>> I've been researching this for hours and nothing I try works. The image
>> used for the texture has an alpha channel, but it is displayed as black
>> instead of transparent. I'm starting to think that the line:
>>
>> Gl.TexImage2D(t1)
>>
>> isn't passing the presence of an alpha channel to OpenGL, but that's
>> just a guess. Normally you specify the image format there, but those
>> parameters aren't supported yet in the gb3 implementation.
>>
>> The project is attached. You can move the little wizard around with the
>> ASDW keys and rotate with the QE keys. Any help appreciated...I'm going
>> crazy and am calling it quits for the night
> This is what i do in the sdl component to get alpha blending:
>
> glEnable(GL_BLEND);
> glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
>
> So it should be in gambas3 code:
>
> Gl.Enable(Gl.GL_BLEND)
> Gl.BlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA)

Hi Laurent. That's the same conclusion I came to from my research, 
however it doesn't make any difference. I can set the alpha level of the 
entire texture, but the texture won't use the alpha channel of the 
original image. The attached project shows clearly what is happening. 
The light-blue background should show around the wizard, not a black 
square. Could it have something to do with the texture being rendered at 
a z depth or 0? Maybe it needs another texture behind it and not just a 
colored background. I'm using an orthogonal projection matrix if that 
makes a difference, and depth is disabled.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gb3_opengl_texture.tar.gz
Type: application/x-gzip
Size: 14914 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20110730/d9d080d7/attachment.bin>


More information about the User mailing list