Java Code Examples for org.lwjgl.opengl.GL11#GL_QUADS

The following examples show how to use org.lwjgl.opengl.GL11#GL_QUADS . 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: GeometryTessellator.java    From LunatriusCore with MIT License 6 votes vote down vote up
private static void drawCuboid(final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb, final double delta) {
    if (buffer.getDrawMode() == -1 || sides == 0) {
        return;
    }

    final double x0 = begin.getX() - delta;
    final double y0 = begin.getY() - delta;
    final double z0 = begin.getZ() - delta;
    final double x1 = end.getX() + 1 + delta;
    final double y1 = end.getY() + 1 + delta;
    final double z1 = end.getZ() + 1 + delta;

    switch (buffer.getDrawMode()) {
    case GL11.GL_QUADS:
        drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
        break;

    case GL11.GL_LINES:
        drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
        break;

    default:
        throw new IllegalStateException("Unsupported mode!");
    }
}
 
Example 2
Source File: GeometryTessellator.java    From ForgeHax with MIT License 5 votes vote down vote up
private static void drawCuboid(
    final BufferBuilder buffer,
    final BlockPos begin,
    final BlockPos end,
    final int sides,
    final int argb,
    final double delta) {
  if (buffer.getDrawMode() == -1 || sides == 0) {
    return;
  }
  
  final double x0 = begin.getX() - delta;
  final double y0 = begin.getY() - delta;
  final double z0 = begin.getZ() - delta;
  final double x1 = end.getX() + 1 + delta;
  final double y1 = end.getY() + 1 + delta;
  final double z1 = end.getZ() + 1 + delta;
  
  switch (buffer.getDrawMode()) {
    case GL11.GL_QUADS:
      drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
      break;
    
    case GL11.GL_LINES:
      drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
      break;
    
    default:
      throw new IllegalStateException("Unsupported mode!");
  }
}
 
Example 3
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
public EndPortalRenderType(int idx, double posY, Vec3d projectedView, Matrix4 mat, RenderType.State state) {
    super("enderstorage:end_portal", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, false, true, null, null);
    this.idx = idx;
    this.projectedView = projectedView;
    this.mat = mat;
    this.state = state;
    f5 = idx == 0 ? 65F : 16 - idx;
    f6 = idx == 0 ? 0.125F : (idx == 1 ? 0.5F : 0.0625F);
    f7 = idx == 0 ? 0.1F : 1.0F / (16 - idx + 1.0F);
    f8 = (float) (-(posY + surfaceY));
    f9 = (float) (f8 + projectedView.y);
    f10 = (float) (f8 + f5 + projectedView.y);
    f11 = (float) (posY + surfaceY) + (f9 / f10);
}
 
Example 4
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BakedQuadVertexBuilder(int glMode) {
    if (glMode != GL11.GL_QUADS && glMode != GL11.GL_TRIANGLES) {
        throw new IllegalArgumentException("Only GL_QUADS and GL_TRIANGLES supported. Got: " + glMode);
    }
    this.glMode = glMode;
    vSize = glMode == GL11.GL_QUADS ? 4 : 3;
}
 
Example 5
Source File: VAOGLRenderer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Check if the geometry being created can be split at the current index
 * 
 * @param count The current index
 * @param type The type of geometry being built
 * @return True if the geometry can be split at the current index
 */
private boolean isSplittable(int count, int type) {
	switch (type) {
	case GL11.GL_QUADS:
		return count % 4 == 0;
	case GL11.GL_TRIANGLES:
		return count % 3 == 0;
	case GL11.GL_LINE:
		return count % 2 == 0;
	}
	
	return false;
}
 
Example 6
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BakedQuadVertexBuilder() {
    this(GL11.GL_QUADS);
}