12-23-2012 02:28 PM
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
12-24-2012 06:17 AM - edited 12-24-2012 06:18 AM
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
12-24-2012 06:24 AM
try:
glBlendFunct(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
12-24-2012 04:18 PM
How do you create native window on top of which you have your OpenGL? what format do you use?
12-24-2012 07:13 PM
I'm confused, BGmot could you rephrase the question?
12-24-2012 08:35 PM
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).