开发者

Problems Using glColor to set textures to half transparency

Basically I have a fully functional ogl program (2D game) in opengl es 1.1, everything works fine except for one problem: glcolor

I'm trying to set some of my texture to half transparent and I would like to do it as follows;

gl.glColor4f(1f, 1f, 1f, .5f);
obj.draw(gl);
...

gl.glColor4f(1f, 1f, 1f, 1f);

I'm using VBO for my vertice, my textures and indices. (if that is relevant)

the problem is that nothing gets set to 50% transparency...

I'm don't think relevant to post all my code (mainly bec开发者_如何学运维ause it is spread out several classes with several GL options changing (blends, scissors etc etc).

What I would like is for people to tell me what state of OGL could prevent glcolor form working like I want, what functions should I check, what state should I call.

Jason


I finally got enough time to go step by step trhough all my traces and found the problems

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, ...);

... was set to GL_REPLACE while generating some textures and was never set to GL_COMBINE


Have you enabled GL_BLEND? Check out glBlendFunc. I generally end up using glBlendFunc( SRC_ALPHA, ONE_MINUS_SRC_ALPHA )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜