开发者

Texture spill over android open gl es

开发者 https://www.devze.com 2023-02-02 18:14 出处:网络
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 displayi

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.

0

精彩评论

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

关注公众号