-1

我正在尝试使用 Open GL 绘制图形。我制作了如下图所示的图表。

在此处输入图像描述

我的代码如下:

public void draw(GL10 gl) {
        gl.glFrontFace(GL10.GL_CCW);

        // rendering.
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

        gl.glAlphaFunc(GL10.GL_GREATER, 0.1f);
        gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer);

        gl.glColor4f(1.0f, 0.0f, 0.0f, 0.5f);
        gl.glColorMask(true, true, true, true);
        gl.glDepthMask(true);


        gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, vertices.length / 2);

        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

        // Disable face culling.
        gl.glDisable(GL10.GL_BLEND);
    }

现在,我想绘制如下图:

在此处输入图像描述

triangle_strip 但没有得到我想要的正确填充区域

需要任何指导或帮助。

4

1 回答 1

0

choosing the right primitive with your draw call has only to do with the disposition of the vertecies, which we can't see without looking at your data. I woud look at something like this image (tfc.duke.free.fr/old/models/images/05.gif) to see if your data matches the primitive you are using.

于 2013-09-10T07:44:45.520 回答