开发者

OpenGL Texturing mesh FrontSide and BackSide

开发者 https://www.devze.com 2023-03-31 08:25 出处:网络
I doesn\'t have experience with OpenGL (and my question proof this) but I need a little snipplet to solve a problem. I have a mesh, a square and I need to apply 2 Texture: 1 FrontSide and 1 BackSide.

I doesn't have experience with OpenGL (and my question proof this) but I need a little snipplet to solve a problem. I have a mesh, a square and I need to apply 2 Texture: 1 FrontSide and 1 BackSide. This is the code to apply the texture frontside:

mTextureIds = new int[1];
gl.glGenTextures(1, mTextureIds, 0);
// Set texture attributes.
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureIds[0]);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexPar开发者_运维知识库ameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureIds[0]);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, mBitmapFrontSide, 0);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTexCoords);

Someone can help me?

1] Is it possible to aply 2 different texture 1 frontside and 1 backside?

2] Some one can post a snipplet or indicate a tutorial or other material?

Thanks.


Since you don't appear to be using shaders, the easiest thing you can do is use backface culling to your advantage. Render the object with one face culling, then change the texture and render it with the opposite faces being rendered.

0

精彩评论

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

关注公众号