Re: JOGL Tutorials
Posted by
luis on
Nov 23, 2010; 8:10pm
URL: https://forum.jogamp.org/JOGL-Tutorials-tp1386061p1955993.html
https://sites.google.com/site/justinscsstuff/jogl-tutorial-3the render method in the animated triangle shows a error if followed in the tutorial.
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1, 0, 0);
gl.glVertex2d(-c, -c);
gl.glColor3f(0, 1, 0);
gl.glVertex2d(0, c);
gl.glColor3f(0, 0, 1);
gl.glVertex2d(s, -s);
gl.glEnd();
c and s are declared as double, but the method glvertex2d is a (float, float). To fix this I converted the c and s as such:
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1,0,0);
gl.glVertex2f(-(float)c, -(float)c);
gl.glColor3f(0,1, 0);
gl.glVertex2f(0, (float)c);
gl.glColor3f(0, 0, 1);
gl.glVertex2f((float)s, -(float)s);
gl.glEnd();
just pointing this out if u want to update the tutorial