注册 登录
编程论坛 Android开发

android opengl es 里面纹理贴图 平铺y轴和x轴的界面图片显示正常,但平铺z周和x周图片显示不均匀

yjfgh5t 发布于 2012-10-24 10:10, 946 次点击
程序代码:

public void draw(GL10 gl)
{
gl.glTranslatef(-1.0f, -1.0f, -1.0f);
        
        //设置背景和清楚颜色缓存,深度缓存
        gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
        
        //********开始画图*********//
        

        //设置画笔的颜色
        gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        

        
        //启用顶点坐标
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        //启用图片纹理坐标
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        //启用颜色坐标
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        
        gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);  
        
        //将坐标数据传送给OPENGL
        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, verTexture);
        
        gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, verPictuer);
        //绑定图片纹理
        gl.glBindTexture(GL10.GL_TEXTURE_2D, textrueID[texID]);
        
        gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);
        
        
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        gl.glDisable(GL10.GL_DEPTH_TEST);
        gl.glDisable(GL10.GL_TEXTURE_2D);
        
}

public void initPoint()
{
        //图形坐标点   ---这个是在y轴和x轴的图形坐标
    float f_verTexture [] ={
            1.6f,1.0f,0.0f,  0.5f,1.0f,0.0f,
            0.5f,0.0f,0.0f,  1.6f,0.0f,0.0f,
    };  

        
        //图形坐标点  ---这个是在z轴和x轴的图形坐标
    float f_verTextureA [] ={
            1.6f,1.0f,0.0f,  0.5f,1.0f,0.0f,
            0.5f,0.0f,0.0f,  1.6f,0.0f,0.0f,
    };  

}
---y轴和x轴截面图形的纹理贴图效果
只有本站会员才能查看附件,请 登录


--z轴和x轴的截面图形的纹理贴图效果
只有本站会员才能查看附件,请 登录

0 回复
1