Hi.
I ran into a problem concerning the OpenGL (like) implementation of KallistiOS. When I try to make a quad transparent I do use switch to the transparency list with a call to glKosFinishList and set an appropriate blending function with glBlendFunc. Then I just draw the polygon with a preceding call to glColor4f(1.0f, 1.0f, 1.0f, 0.25f) for example. However, the alpha value doesn't seem to have any impact on the result. The drawn quad has actually some transparency applied to it, but it's the same degree of translucency with an alpha of 0.25f or 0.75f or any other value.
I'm actually experienced with the OpenGL implementation on PCs and I'm pretty confident that my approach should work. However, it might be that I'm missing something here or that there are some quirks with the KOS implementation in this particular case.
I need the variable alpha value for fading out animations...
Here's some code:
(Drawing function in main.cpp)
(Drawing function in animation.cpp - fFade ranges from 1.0f to 0.0f and is evaluated on time)Code:/* Draw the opaque GL "scene" */ glKosBeginFrame(); glDepthMask(1); //Reset the modelview matrix to the identity matrix glLoadIdentity(); //Drawing color glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GameStateManager::Instance()->DrawOpaque(); //Draw the opaque animations AnimationManager::Instance()->DrawOpaque(); /* Draw the translucent GL "scene" */ glKosFinishList(); glDepthMask(0); GameStateManager::Instance()->DrawTranslucent(); //Draw the translucent animations AnimationManager::Instance()->DrawTranslucent(); glKosFinishFrame();
Thanks!Code:void AnimationDestroy::DrawTranslucent(void) { if(IsAtEnd()) return; if(texAnim) texAnim->Bind(); glPushMatrix(); glLoadIdentity(); glTranslatef(x, y, ANIMATION_Z); glScalef(fScale, fScale, fScale); glRotatef(fRot, 0.0f, 0.0f, 1.0f); glColor4f(r, g, b, fFade); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.5f, -0.5f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.5f, -0.5f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.5f, 0.5f, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-0.5f, 0.5f, 0.0f); glEnd(); glPopMatrix(); }
ZMaster
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks