PDA

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



Anoop
12-25-2011, 11:05 PM
I am trying to develop an 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.

Alfonse Reinheart
12-25-2011, 11:34 PM
You can't. Well, not trivially, and not without some form of render to texture.

First, you should probably say that you're using OpenGL ES 1.1 (which I assume because you are calling "glDrawTexfOES"). That pretty much limits your options to... I'm not sure what the options are for ES 1.1. This forum is primarily for desktop OpenGL; you may get better help on the Khronos OpenGL ES forums (http://www.khronos.org/message_boards/).