public void clearColorBuffer(int color) { float r, g, b, a; int ir, ig, ib, ia; ia = (color >> 24) & 0xff; ir = (color >> 16) & 0xff; ig = (color >> 8) & 0xff; ib = color & 0xff; a = ia / 255.0f; r = ir / 255.0f; g = ig / 255.0f; b = ib / 255.0f; gl.glClearColor(r, g, b, a); gl.glClear(GL.GL_COLOR_BUFFER_BIT); }
public void clearTex(int glid, int target, int color) { float r, g, b, a; int ir, ig, ib, ia; ia = (color >> 24) & 0xff; ir = (color >> 16) & 0xff; ig = (color >> 8) & 0xff; ib = color & 0xff; a = ia / 255.0f; r = ir / 255.0f; g = ig / 255.0f; b = ib / 255.0f; pushFramebuffer(); setFramebuffer(FBO); FBO.setDrawBuffer(target, glid); gl.glClearColor(r, g, b, a); gl.glClear(GL.GL_COLOR_BUFFER_BIT); popFramebuffer(); }
private void renderOneside(Point2D a, Point2D b, GL gl, double d) { gl.glClear(0); Vector3D t = new Vector3D(b.x - a.x, 0, b.y - a.y); Vector3D n = new Vector3D(0, 1, 0); Vector3D cross = n.cross(t); gl.glNormal3d(cross.x, cross.y, cross.z); // Texture adjustment vars double length = scale * Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) / 100 + 0.1; double height = scale; // draw the 4 points of it gl.glBegin(GL.GL_POLYGON); gl.glTexCoord2d(0, 0); gl.glVertex3d(a.x, d, a.y); gl.glTexCoord2d(0, height); gl.glVertex3d(a.x, d + 100, a.y); gl.glTexCoord2d(length, height); gl.glVertex3d(b.x, d + 100, b.y); gl.glTexCoord2d(length, 0); gl.glVertex3d(b.x, d, b.y); gl.glEnd(); }