hello,
i got my first jogl things to work, but i have some questions about it
(i am new to java)
in my display function i got all the graphic stuff but it seems
that in my example they all act together in a way i did not understand
the tepot is shown, the triangle not(shows only if i // the teapot) ,
and the whole scene is looking in the direction of the text, how can
i add something like an lookat with perspective and that all
things are draw .
(java noob question) how can i load textures in an array?
i found an texture loader that work, but i want to load some
textures in memory but i search for one simple thing:
var delaration of public Texture texture; into something like public Texture texture:array[200] ??
much thx
(sorry for my english)
public void display(GLAutoDrawable arg0)
{
GL gl = arg0.getGL();
GLUT glut = new GLUT();
Random r = new Random(34567890);
float ran =(float)Math.random();
float sii = (float)Math.sin(12);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
//Light Position rotating
float l_position[] = { 200*(float)Math.sin(ic*3.141593/180), 100.0f, 200*(float)Math.cos(ic*3.141593/180), 1.0f};
gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, l_position, 0);
float g_fNearClipPlane = 8.0f;
float g_fFarClipPlane = 20.0f;
gl.glMatrixMode(GL.GL_MODELVIEW); //GL_PROJECTION);// GL_MODELVIEW);
//gl.glPerspective( 45.0f, 800 / 400, g_fNearClipPlane, g_fFarClipPlane); //not working
gl.glRotatef(1, 1.0f, 0.0f, 0.0f); // Rotation
gl.glRotatef(1, 0.0f, 1.0f, 0.0f);
gl.glColor3f(0.2f, 0.0f, 0.3f);
glut.glutSolidTeapot( 50.0 ) ;
GLU glu = new GLU();
ic+=10;
gl.glLoadIdentity();
gl.glColor3f(1.0f, 0.0f, 0.0f );
//this triangle shows only if i // the teapot ?!?!
gl.glBegin( GL.GL_TRIANGLES );
gl.glVertex3f( 0.0f, 0.0f, 0.0f );
gl.glVertex3f( 1.0f, 0.0f, 0.0f );
gl.glVertex3f( 1.0f, 1.0f, 0.0f );
gl.glEnd();
// Display Text (topleft)
//if the text is draw i see the teapot only from the side?!
TextRenderer renderer = new TextRenderer(new Font("Arial", Font.PLAIN, 14));
renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
renderer.begin3DRendering();
gl.glLoadIdentity();
renderer.draw3D("Hello World",
-100, 95,0, 0.4f);
renderer.end3DRendering();
gl.glPopMatrix();
}