PDA

View Full Version : Problem in blend texture to draw translucent line



anoop.singh.knit
12-26-2011, 12:09 AM
I am trying to develop an android drawing app.In this app I am using texture to draw.
I want to draw translucent texture one over another to get continuous translucent line but I am only able to get this https://lh5.googleusercontent.com/-zaWuS1yTIZo/TvgInuyWb_I/AAAAAAAADUw/ZOeIkwMmkCg/s640/Untitled.jpg
As you can see in part B circular translucent textures appear one over other. I want line to appear as in part A.
I am adding information of texture drawing like width,height,x&y coordinate in ArrayList spriteArray.
The blending function used is- gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
To set opacity of texture-gl.glColor4f(1, 1, 1, opacityValue);

I have also used gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);it does not work either.

Any help to solve this problem will be appreciated.
If you need more information please tell me.


drawFrame code:

gl.glMatrixMode(GL10.GL_TEXTURE);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4f(1, 1, 1, opacityValue);
for (int x = 0; x < GLSurfaceView.mSpriteArray.size(); x++) {
int
mTextureName=GLSurfaceView.mSpriteArray.get(x).tex tureName;
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureName);

// Draw using the DrawTexture extension.
((GL11Ext) gl).glDrawTexfOES(x, y, 0, width, height);
}

Thanks.