Java Code Examples for org.lwjgl.opengl.GL11#glClipPlane()

The following examples show how to use org.lwjgl.opengl.GL11#glClipPlane() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BillboardPainter.java    From tribaltrouble with GNU General Public License v2.0 6 votes vote down vote up
private final static void initClipPlane(int clip_enum, int face_index, int vertex_index1, int vertex_index2, short[] indices, float[] face_tex_coords, float handedness) {
	float u1 = getElement(face_index, vertex_index1, 0, 2, indices, face_tex_coords);
	float v1 = getElement(face_index, vertex_index1, 1, 2, indices, face_tex_coords);
	float u2 = getElement(face_index, vertex_index2, 0, 2, indices, face_tex_coords);
	float v2 = getElement(face_index, vertex_index2, 1, 2, indices, face_tex_coords);
	Vector3f vec1 = new Vector3f(0f, 0f, 1f);
	Vector3f vec2 = new Vector3f(u2 - u1, v2 - v1, 0);
	Vector3f vec3 = new Vector3f();
	Vector3f.cross(vec1, vec2, vec3);
	vec3.scale(handedness);
	vec3.normalise();
	vec1.set(u1, v1, 0f);
	float d = -Vector3f.dot(vec3, vec1);
	plane_buf.put(0, vec3.x).put(1, vec3.y).put(2, vec3.z).put(3, d);
	GL11.glClipPlane(clip_enum, plane_buf);
}
 
Example 2
Source File: ImmediateModeOGLRenderer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#glClipPlane(int, java.nio.DoubleBuffer)
 */
public void glClipPlane(int plane, DoubleBuffer buffer) {
	GL11.glClipPlane(plane, buffer);
}