Code example for GL10

Methods: glPushMatrixglRotatefglScalefglTranslatef

0
	} 
	 
	public void draw(GL10 gl) {}
	 
	public void drawBefore(GL10 gl) {
		gl.glPushMatrix();
		positionCorrection(gl);
		scaleCorrection(gl);
		rotationCorrection(gl);
		tiltCorrection(gl);
	} 
	 
	public void drawAfter(GL10 gl) {
		gl.glPopMatrix();
	} 
 
	public float getScaleFactor() { 
		return scaleFactor;
	} 
 
	public void setTilt(int tilt) {
		this.tilt = tilt;
	} 
 
	private void scaleCorrection(GL10 gl) {
		if (scaleTendency == "up" && scaleFactor < maxScaleUp) {
			scaleFactor += 0.1;
		} else if (scaleTendency == "down" && scaleFactor > 1.0) {
			scaleFactor -= 0.1;
		} 
		gl.glScalef(scaleFactor, scaleFactor, scaleFactor);
	} 
 
	private void positionCorrection(GL10 gl) {
		gl.glTranslatef(position.getX(), position.getY(), position.getZ());
	} 
 
	private void tiltCorrection(GL10 gl) {
		gl.glRotatef(tilt, 1.0f, 0, 0);
	} 
 
	private void rotationCorrection(GL10 gl) {
		if (rotationFrequency > 0) {
			long steps = (long)(1/rotationFrequency * 1000);
			long stepno = (SystemClock.uptimeMillis() - rotationStart) % steps;
			float angle = 360f/steps * ((int) stepno);
			gl.glRotatef(angle, 0, 1.0f, 0);
		} 
	} 
} 
Experience pair programming with AI  Get Codota for Java