Independent alpha value

Problems with Canvas, OpenGL, etc...

Independent alpha value

Postby vchelaru » Thu Oct 21, 2010 2:26 pm

I'm rendering some textured quads using OGL on the Android and am having a small issue. I basically use the color values of the verts to modify how the texture is rendered. I have a "ColorOperation" enumeration to control how the vert values modify the final rendering:

Code: Select all
       if(mColorOperation == ColorOperation.Add)
       {
          gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_ADD);
       }
       else if(mColorOperation == ColorOperation.Texture)
       {
          gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);
       }
       else // modulate
       {
          gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE);
       }


That works great for color, but the problem is the vertex alpha value. I want the vertex alpha value to *always* use GL_MODULATE (or similar functionality) regardless of the color operation. Is there a way to specify that the vert alpha should be using a different value?

One work-around that I've found is to use the modulate logic even if my color opeation is Texture, but to pass 1's instead of the actual vert colors when creating my buffers. The problem is that puts some branching code in my code: I'm trying to sort by color operation and avoid having to branch per quad. Any advise would be greatly appreciated!
vchelaru
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Sep 12, 2010 7:13 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests