java - Drawing with transparent texture, then opaque color -
i initialize opengl make transparent textures transparent:
glenable(gl_blend); glblendfunc(gl_src_alpha, gl_one_minus_src_alpha);
i draw texture this:
glpushmatrix(); //translate //neutralize colors //bind texture //vertex points glpopmatrix();
but when try draw quad afterwards, won't show up:
glpushmatrix(); { gltranslatef(x, y, 0); glcolor3f(1f, 0f, 0f); glbegin(gl_quads); { glvertex2f(0, 0); glvertex2f(10, 0); glvertex2f(10, 10); glvertex2f(0, 10); } glend(); } glpopmatrix();
if remove initialization above, quad appears, texture no longer transparent.
what doing wrong here?
edit: should call gldisable(gl_blend);
whenever want draw not texture?
you need disable blending before drawing quad.
edit: can post more code? problem may somewhere else, example if have not disabled texture before drawing quads.
Comments
Post a Comment