Draw function graph with negative values on visible marker

Community support forum for the ARToolKit v5.x for Android SDK.
Ilya
Posts: 2
Joined: Sun Jan 08, 2017 10:25 am

Draw function graph with negative values on visible marker

Postby Ilya » Sun Jan 08, 2017 11:06 am

Hello,

I use ARToolKit for Android permanently for marker detection. After the detection I want to plot (with OpenGL ES) some simply vertices (mathematical functions). The application works already, but the vertices with negative values (y - axis) are not visible on the screen (in opposite to positive values).

These steps I'm doing in the draw-part in my application:

Code: Select all


< begin >

gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_PROJECTION);

gl.glLoadMatrixf(arToolKit.getProjectionMatrix(), 0);

gl.glEnable(GL10.GL_CULL_FACE);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glFrontFace(GL10.GL_CW);
gl.glMatrixMode(GL10.GL_MODELVIEW);

gl.glLoadMatrixf(ARToolKit.getInstance().queryMarkerTransformation(markerId3), 0);

< draw function >

float verteces[] = { /* simply square, variably size */

                0, 0, 0,
                x1, 0, 0,
                x1, y1, 0,
                0, y1, 0
        };
       
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, RenderUtils.buildFloatBuffer(verteces));

gl.glColor4f(1.0F, 0.0F, 0.0F, 0.3F);
gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
       
< end of draw function >

< go to begin >



Can somebody help me?

Thanks in advance

Ilya

EDIT

If gl.glFrontFace(GL10.GL_CW); is used: vertices with positive y - axis value are invisible.
If gl.glFrontFace(GL10.GL_CCW); is used: vertices with negative y - axis value are invisible.

Ilya
Posts: 2
Joined: Sun Jan 08, 2017 10:25 am

Re: Draw function graph with negative values on visible marker

Postby Ilya » Wed Jan 11, 2017 12:42 pm

Anyone ideas?


Return to “ARToolKit for Android”

Who is online

Users browsing this forum: No registered users and 2 guests