Texture spill over android open gl es
I have adapted lesson six of insantydesign's android examples (http://insanitydesign.com/wp/projects/nehe-android-port开发者_StackOverflow中文版s/) to work for a 2d square and the texture is displaying fine but I also have other (non textured) shapes drawn on screen and the texture from the square "spills over" to them.
In my on surface created method I have the line squaretexture.loadGLTexture(gl, this.context); which I think may be the problem.
My question is where should I put this line in order to fix my problem?
You need to enable texturing when you want to draw textures primitives, and disable texturing when you want primitives without a texture. For example:
glEnable(GL_TEXTURE_2D);
drawObjectA();
glDisable(GL_TEXTURE_2D);
drawObjectB();
Object A will be textured, but object B won't.
精彩评论