its working 99.0%
the only thing is, and that i think is what cylab wrote, is the [quote]multiply your objects vertices
[/quote]
.
my camera is not interacting with the objects like it does before.
My old code was looking like that:
glu.glulookat for camera
…
push matrix
rotate …
rotate…
translate
callList(xyz)
pop matrix
now i replaced the rotate … with the set_rota funktion (see code)
when i got my camera fixed ( glu.gluLookAt(0,0,1, 0,0,0, 0,1,0);
the object is working perfect with the vector rotations.
when now putting the vectors in the lookat funktion for the camera
they make an twice rotation and the object is always in front of me.
greetings
// Paint object with vector offset 0
gl.glPushMatrix();
texture[9].bind();
set_rota(drawable, 0); // build matrix from vector set 0
gl.glCallList(2005);
gl.glPopMatrix();
// My build matrix from vector method
public void set_rota(GLAutoDrawable drawable,int off)
{
GL2 gl = drawable.getGL().getGL2();
float flc=0.0f;
FloatBuffer matrix2 = FloatBuffer.allocate(16);
matrix2.rewind();
flc=(float) vector[off+3] ;matrix2.put(flc);
flc=(float) vector[off+4] ;matrix2.put(flc);
flc=(float) vector[off+5] ;matrix2.put(flc);
flc=0.000000f ;matrix2.put(flc);
flc=(float) vector[off+6] ;matrix2.put(flc);
flc=(float) vector[off+7] ;matrix2.put(flc);
flc=(float) vector[off+8] ;matrix2.put(flc);
flc=0.000000f ;matrix2.put(flc);
flc=(float) vector[off+0] ;matrix2.put(flc);
flc=(float) vector[off+1] ;matrix2.put(flc);
flc=(float) vector[off+2] ;matrix2.put(flc);
flc=0.000000f ;matrix2.put(flc);
flc=(float) 0 ;matrix2.put(flc);
flc=(float) 0 ;matrix2.put(flc);
flc=(float) -10 ;matrix2.put(flc);
flc=1.000000f ;matrix2.put(flc);
matrix2.rewind();
gl.glLoadMatrixf(matrix2);
// My Camera Setup
public void setcamera(GLAutoDrawable drawable,int was)
{
GL2 gl = drawable.getGL().getGL2();
GLU glu = new GLU();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
float pvi=35.0f;
float near=0.1f;
float far=50000.0f;
float asp = (float)screen_x / (float)screen_y;
if (asp==0) asp=1;
glu.gluPerspective( pvi, asp, near,far );
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
glu.gluLookAt(vector[0],vector[1],vector[2], //look from
0,0,0, //look to zero
vector[6],vector[7],vector[8]); //up vector