Hey folks. Just found this sight, could be a godsend for me.
Anyway, I appologize for a vague and hard-to-answer question, but I’ma give it a shot.
I’m trying to make a first person game. All I have so far is a freely moving camera, and walls which consist of 5 quads ( no bottom ). I find that with as few as 10 walls, performance is slowing to really choppy. I figure I’ll post as much code as I think is relevent, and if anyone sees anything that pops out at them, it’d be great. Otherwise, if some great soul could suggest other parts of my code that might be relevent, that’d also be great.
I’d love to say more about where the problem might be, but I’m a bit of a neophyte.
Oh, also: it mostly is pretty smooth. It seems like there are patches of very slowness, mostly around walls.
I init like this:
gl.glShadeModel(GL.GL_SMOOTH);
gl.glEnable( GL.GL_DEPTH_TEST );
gl.glDepthFunc( GL.GL_LEQUAL );
gl.glHint( GL.GL_PERSPECTIVE_CORRECTION_HINT , GL.GL_NICEST );
gl.glEnable( GL.GL_COLOR_MATERIAL );
gl.glLightfv( GL.GL_LIGHT1 , GL.GL_AMBIENT , ambient );
gl.glLightfv( GL.GL_LIGHT1 , GL.GL_DIFFUSE , diffuse );
gl.glLightfv( GL.GL_LIGHT1 , GL.GL_POSITION , position );
gl.glEnable( GL.GL_LIGHTING );
gl.glEnable( GL.GL_LIGHT1 );
My light variables are
private float[] ambient = { .6f , .6f , .6f , 1 };
private float[] diffuse = { .2f , .2f , .2f , 1 };
private float[] position = { 0f , 0f , 0f , 1 };
I draw my walls like this:
gl.glPushMatrix();
gl.glColor3f( .7f , .7f , .7f );
gl.glTranslatef( x1 , y1 , 0 );
gl.glRotatef( theta * Util.TO_DEG , 0 , 0 , 1 );
gl.glBegin( GL.GL_QUADS );
gl.glEnd();
gl.glPopMatrix();
A thousand thanks for anyone who reads this.
-Upton