Code example for GL10

Methods: glDrawArrays, glPopMatrix, glPushMatrix, glScalef, glTranslatef

0
 
	private static void drawAStripe(GL10 gl, GloneTz gtz, float fdstoffset) {
		int		n0 = 0;
		float	frem = Math.abs(fdstoffset) % 1f;	// for the case offset < 1h (Australia/LHI)
		// draw 0, 1 
		gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4 * 0, 4 * 2);
		// draw from 2 
		if(fdstoffset > 0f) {
			gl.glTranslatef(0.0f, GlStripe.getVtxHeightOfOneHour() * 1f, 0.0f);
			gl.glPushMatrix();
			if(frem > 0f) {
				gl.glTranslatef(0.0f, GlStripe.getVtxHeightOfOneHour() * fdstoffset, 0.0f);
				gl.glScalef(1f, fdstoffset, 1f);
			} 
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4 * 1, 4 * 1);	// duplicate 1
			gl.glPopMatrix();
			gl.glTranslatef(0.0f, GlStripe.getVtxHeightOfOneHour() * -1f, 0.0f);
		} else 
		if(fdstoffset < 0f) {
			// don't cover 1 and restart with 3. 
			if(frem > 0f) {
				gl.glPushMatrix();
				gl.glTranslatef(0.0f, GlStripe.getVtxHeightOfOneHour() * 1f, 0.0f);
				gl.glScalef(1f, fdstoffset * -1f, 1f);
				gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4 * 2, 4 * 1);	// 2 am
				gl.glPopMatrix();
			} 
			n0 = 1;
		} 
		gl.glTranslatef(0.0f, GlStripe.getVtxHeightOfOneHour() * (fdstoffset), 0.0f);
		gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4 * (2 + n0), 4 * (24 - 2 - n0));
	} 
 
	/** 
	 * @param narg 
	 * @param nmindigits minimum digits number (0 fill)