By mamairaja
on Wed, 06/20/2012 - 17:10
Hi all,
With vuforia sdk Imagetargets example I am trying to draw a 2d component (Buttons, Label etc...).
Following is my approach and it worked for me in other opengl projects
1 First I save the current opengl state
2 create orthographic
3 draw 2d stuff
4 Then restore the opengl state
following is code and it didn't wok with ImageTargets example and it did work for other opengl android projects
[CODE]
// modify ImageTargets example
public void onDrawFrame(GL10 gl)
{
// draw the camera texture and do tracking
renderFrame();
// 2D start
gl.glDisable(gl.GL_LIGHTING);
gl.glDisable(gl.GL_FOG);
gl.glDisable(gl.GL_TEXTURE_2D);
gl.glDisable(gl.GL_DEPTH_TEST);
gl.glDisable(gl.GL_CULL_FACE);
gl.glViewport(0, 0, w, h);
gl.glMatrixMode(gl.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrthof(0, w, 0, h, -1, 1) ;
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();
// draw 2D here
//restore
gl.glMatrixMode(gl.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glPopMatrix();
}[/CODE]
But this never draw any thing
Could you please advice?
Re: Draw 2D component