lacas
lacas

Reputation: 14067

Android OpenGL ES Line antialiase

        public void draw(GL10 gl) {

        gl.glFrontFace(GL10.GL_CCW);
        gl.glEnable(GL10.GL_CULL_FACE);
        gl.glCullFace(GL10.GL_BACK);

        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

        /*
        gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
        gl.glEnable(GL10.GL_BLEND);
        gl.glEnable(GL10.GL_LINE_SMOOTH);
*/

        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);

        gl.glLineWidth(3.0f);
        gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

        gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, list.size()/3);


        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisable(GL10.GL_CULL_FACE);

        //gl.glDisable(GL10.GL_BLEND);
        //gl.glDisable(GL10.GL_LINE_SMOOTH);

    }

my code is the following.

if i add this code

gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL10.GL_BLEND);
gl.glEnable(GL10.GL_LINE_SMOOTH);

then i get a very thin (1px) line, and not an antialised line. what is the best way to do its correctly?

Upvotes: 0

Views: 3123

Answers (1)

Stefan H Singer
Stefan H Singer

Reputation: 5504

I think what you're doing is correct, but are you sure your device supports anti aliasing? Look at this blog post: http://olofsj.posterous.com/playing-with-android-and-opengl

Upvotes: 2

Related Questions