Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
Posts: 6
Registered: ‎12-23-2012
My Device: Playbook 2.0
My Carrier: MegaFon RUS

show an RGBA image

   Hello. I tried to render on screen PNG image with alpha channel, using bbutil_load_texture function for load image and that code

 

glEnable(GL_TEXTURE_2D);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(2, GL_FLOAT, 0, m_vertices);
glTexCoordPointer(2, GL_FLOAT, 0, m_tex_coord);
glBindTexture(GL_TEXTURE_2D, m_texture);

glColor4f(m_color.r, m_color.g, m_color.b, 1.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_TEXTURE_2D);

to render it on my playbook. But its looks like that OpenGL doesn't look at alpha channel at all - my image rendering without transparency. That is image, with I want to render: ClickMe

That is a screenshot of what I got on the screen: ClickMe

 

Thanks

Developer
Posts: 107
Registered: ‎02-15-2012
My Device: Blackberry Playbook 32GB
My Carrier: Virgin Mobile

Re: show an RGBA image

[ Edited ]

correct me if im wrong but shouldnt you need GL blending turned on?

e.g.

glEnable(GL_BLEND);

glBlendFunct(__Source blending__, _Destination blending_);

//Draw stuff here

then once finished:

glDisable(GL_BLEND);

 

replace source and destination blending with the settings you want.

 

Look here:

http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendFunc.xml

Developer
Posts: 107
Registered: ‎02-15-2012
My Device: Blackberry Playbook 32GB
My Carrier: Virgin Mobile

Re: show an RGBA image

try:

glBlendFunct(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: show an RGBA image

How do you create native window on top of which you have your OpenGL? what format do you use?

Developer
Posts: 107
Registered: ‎02-15-2012
My Device: Blackberry Playbook 32GB
My Carrier: Virgin Mobile

Re: show an RGBA image

I'm confused,  BGmot could you rephrase the question?

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: show an RGBA image

First you create native window

screen_create_window()

the set up transparency

int transparency = SCREEN_TRANSPARENCY_SOURCE_OVER;

screen_set_window_property_iv(screen_win_gles, SCREEN_PROPERTY_TRANSPARENCY, &transparency);

Then format I was talking above:

int format = SCREEN_FORMAT_RGBA8888;

screen_set_window_property_iv(screen_win_gles, SCREEN_PROPERTY_FORMAT, &format);

... some more settings here..

and finally 'attach' EGL surface to this window by calling eglCreateWindowSurface()

 

So what I meant was format and transparency settings are important if you want to acheive OpenGL window drawing transparency (at least if it placed on top of other native windows).