Hello~ comrade!
I am developing opengl based application.
something mysterious happened.
I've tested it with simple triangle.
I moved triangle's x coordinate and I also moved coordinate system
itself using glTranslatef
It looks well before triangle's x coordination approach around 8100..
But when x coordination over around 8100, triangle disappear.
this is strange.
is there any limitation on glTranslatef or vertex coordinate system?
Here is my code:.
....
private float zoom=-8020.0f;
private float xt=-8000.0f;
private float yt=-8000.0f;
private float prevTouchedX;
private float prevTouchedY;
private float xrot=0;
private float yrot=0;
public ModelRenderer(GLSurfaceView v, Model m) {
this.m=m;
this.v=v;
this.c=v.getContext();
}
@Override
public void onDrawFrame(GL10 gl) {
int w = v.getWidth();
int h = v.getHeight();
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glViewport(0,0,w,h);
GLU.gluPerspective(gl, 45.0f, ((float)w)/h, 1f, 1000f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
xt-=1.0f;
gl.glTranslatef(xt,yt,zoom);
gl.glRotatef(xrot, 1, 0, 0);
gl.glRotatef(yrot, 0, 1, 0);
vertices[frame_ix].put(0,vertices[frame_ix].get(0)+1.0f);
vertices[frame_ix].put(3,vertices[frame_ix].get(3)+1.0f);
vertices[frame_ix].put(6,vertices[frame_ix].get(6)+1.0f);
System.out.println(vertices[frame_ix].get(0));
gl.glVertexPointer(3,GL10.GL_FLOAT, 0, vertices[frame_ix]);
gl.glNormalPointer(GL10.GL_FIXED,0, normals);
gl.glTexCoordPointer(2,GL10.GL_FIXED,0,texCoords);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glColor4f(1,0,0,1);
gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
gl.glDrawElements(GL10.GL_TRIANGLES, verts,
GL10.GL_UNSIGNED_SHORT,
indices);
frame_ix = (frame_ix+1)%m.getFrameCount();
}
....
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.