本文介绍了怎么办多重采样在Android中的OpenGL ES?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
How摆脱在Android的OpenGL ES的锯齿状边缘?
我想要做的抗锯齿我appliction.But这是行不通的,无论我做什么。我的code是
I want to do Antialiasing in my appliction.But it doesn't work no matter what I did.My code is
public void onSurfaceCreated(GL10 gl, EGLConfig config){
g10 = gl;
gl.glClearColor(0f, 0, 0.0f, 1.0f);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
GL10.GL_REPEAT);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
GL10.GL_REPEAT);
gl.glSampleCoverage(1.f, true);
gl.glEnable(GL10.GL_DITHER);
gl.glEnable(GL10.GL_MULTISAMPLE);
gl.glEnable(GL10.GL_POINT_SMOOTH);
gl.glEnable(GL10.GL_LINE_SMOOTH);
gl.glEnable(GL10.GL_SAMPLE_COVERAGE);
gl.glPointSize(8);
gl.glLineWidth(5);
gl.glHint(GL10.GL_POINT_SMOOTH_HINT, GL10.GL_NICEST); // Make round points, not square points
gl.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST); // Antialias the lines
}
public void draw(GL10 gl){
gl.glClearColor(0f, 0, 0.0f, 1.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glEnable(GL10.GL_BLEND);
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTexture[0]);
gl.glFrontFace(GL10.GL_CCW);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, m_TexBuffer[i]);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, m_VertexBuffer[i]);
gl.glDrawElements(GL10.GL_TRIANGLE_FAN, vertexCount, GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
}
它没有做任何work.Please告诉我为什么。谢谢你。
It didn't do any work.Please tell me why. Thank you.
推荐答案
如果你想要做FSAA,你需要创建一个EGL上下文多重采样功能。写的EGLConfigChooser返回一个多重采样配置(指定1 EGL_SAMPLE_BUFFERS),并把它传递给setEGLConfigChooser.
If you want to do FSAA, you need to create an EGL context with multisampling enabled. Write an EGLConfigChooser that returns a multisampling config (specify 1 for EGL_SAMPLE_BUFFERS), and pass it to setEGLConfigChooser.
这篇关于怎么办多重采样在Android中的OpenGL ES?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!