/** * Renders a quad filling the whole currently set viewport. */ public static void renderFullscreenQuad() { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); renderQuad(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
public void renderMark(Vector3i blockPos) { Vector3f cameraPos = getCameraPosition(); glPushMatrix(); glTranslated(blockPos.x - cameraPos.x, blockPos.y - cameraPos.y, blockPos.z - cameraPos.z); glMatrixMode(GL_MODELVIEW); overlayMesh.render(); glPopMatrix(); }
public void renderMark2(Vector3i blockPos) { Vector3f cameraPos = getCameraPosition(); glPushMatrix(); glTranslated(blockPos.x - cameraPos.x, blockPos.y - cameraPos.y, blockPos.z - cameraPos.z); glMatrixMode(GL_MODELVIEW); overlayMesh2.render(); glPopMatrix(); }
private void renderChunkBoundingBox(RenderableChunk chunk, Vector3f chunkPosition, Vector3f cameraPosition) { GL11.glPushMatrix(); // chunkPositionRelativeToCamera = chunkCoordinates * chunkDimensions - cameraCoordinate final Vector3f chunkPositionRelativeToCamera = new Vector3f(chunkPosition.x * ChunkConstants.SIZE_X - cameraPosition.x, chunkPosition.y * ChunkConstants.SIZE_Y - cameraPosition.y, chunkPosition.z * ChunkConstants.SIZE_Z - cameraPosition.z); GL11.glTranslatef(chunkPositionRelativeToCamera.x, chunkPositionRelativeToCamera.y, chunkPositionRelativeToCamera.z); new AABBRenderer(chunk.getAABB()).renderLocally(1f); GL11.glPopMatrix(); // Resets the matrix stack after the rendering of a chunk. }
/** * Renders the phase-appropriate mesh of the chunk. I.e. if the RenderPhase is OPAQUE only the opaque mesh * is rendered: other meshes stored in an instance of this class are rendered in separate rendering steps. * * @param phase a RenderPhase value * @param chunkPosition a Vector3f storing the world position of the chunk. * @param cameraPosition a Vector3f storing the world position of the point of view from which the chunk is rendered. * @return Returns an integer representing the number of triangles rendered. */ public int render(ChunkMesh.RenderPhase phase, Vector3f chunkPosition, Vector3f cameraPosition) { GL11.glPushMatrix(); // chunkPositionRelativeToCamera = chunkCoordinates * chunkDimensions - cameraCoordinate final Vector3f chunkPositionRelativeToCamera = new Vector3f(chunkPosition.x * ChunkConstants.SIZE_X - cameraPosition.x, chunkPosition.y * ChunkConstants.SIZE_Y - cameraPosition.y, chunkPosition.z * ChunkConstants.SIZE_Z - cameraPosition.z); GL11.glTranslatef(chunkPositionRelativeToCamera.x, chunkPositionRelativeToCamera.y, chunkPositionRelativeToCamera.z); render(phase); // this is where the chunk is actually rendered GL11.glPopMatrix(); return triangleCount(); }
@Override public void drawMaterialAt(Material material, Rect2i drawRegion) { glPushMatrix(); glTranslatef(drawRegion.minX(), drawRegion.minY(), 0f); glScalef(drawRegion.width(), drawRegion.height(), 1); billboard.render(); glPopMatrix(); }
public void renderLocally(float lineThickness) { CoreRegistry.get(ShaderManager.class).enableDefault(); if (displayListWire == -1) { generateDisplayListWire(); } glPushMatrix(); glTranslated(0f, aabb.getCenter().y, 0f); glLineWidth(lineThickness); glCallList(displayListWire); glPopMatrix(); }
public void renderSolid() { CoreRegistry.get(ShaderManager.class).enableDefault(); glPushMatrix(); Vector3f cameraPosition = CoreRegistry.get(LocalPlayer.class).getViewPosition(); glTranslated(aabb.getCenter().x - cameraPosition.x, -cameraPosition.y, aabb.getCenter().z - cameraPosition.z); renderSolidLocally(); glPopMatrix(); }
public void renderSolidLocally() { CoreRegistry.get(ShaderManager.class).enableDefault(); if (displayListSolid == -1) { generateDisplayListSolid(); } glEnable(GL_BLEND); glPushMatrix(); glTranslated(0f, aabb.getCenter().y, 0f); glScalef(1.5f, 1.5f, 1.5f); glCallList(displayListSolid); glPopMatrix(); glDisable(GL_BLEND); }
/** * Renders this AABB. * <br><br> * * @param lineThickness The thickness of the line */ @Override public void render(float lineThickness) { CoreRegistry.get(ShaderManager.class).enableDefault(); glPushMatrix(); Vector3f cameraPosition = CoreRegistry.get(LocalPlayer.class).getViewPosition(); glTranslated(aabb.getCenter().x - cameraPosition.x, -cameraPosition.y, aabb.getCenter().z - cameraPosition.z); renderLocally(lineThickness); glPopMatrix(); }
private void renderBoneOrientation(EntityRef boneEntity) { LocationComponent loc = boneEntity.getComponent(LocationComponent.class); if (loc == null) { return; } glPushMatrix(); Vector3f worldPosA = loc.getWorldPosition(); Quat4f worldRot = loc.getWorldRotation(); Vector3f offset = new Vector3f(0, 0, 0.1f); worldRot.rotate(offset, offset); offset.add(worldPosA); glBegin(GL11.GL_LINES); glVertex3f(worldPosA.x, worldPosA.y, worldPosA.z); glVertex3f(offset.x, offset.y, offset.z); glEnd(); loc.getChildren().forEach(this::renderBoneOrientation); glPopMatrix(); }
@Override public void preRender() { glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 2048f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); modelView = new Matrix4f(); modelView.setIdentity(); modelView.setTranslation(new Vector3f(0, 0, -1024f)); MatrixUtils.matrixToFloatBuffer(modelView, matrixBuffer); glLoadMatrix(matrixBuffer); matrixBuffer.rewind(); glScalef(uiScale, uiScale, uiScale); requestedCropRegion = Rect2i.createFromMinAndSize(0, 0, Display.getWidth(), Display.getHeight()); currentTextureCropRegion = requestedCropRegion; textureMat.setFloat4(CROPPING_BOUNDARIES_PARAM, requestedCropRegion.minX(), requestedCropRegion.maxX(), requestedCropRegion.minY(), requestedCropRegion.maxY()); }
glPushMatrix(); glTranslatef(-camera.x(), -camera.y(), -camera.z());
glClear(GL11.GL_DEPTH_BUFFER_BIT); glMatrixMode(GL11.GL_MODELVIEW); glPushMatrix(); glLoadMatrix(matrixBuffer);
/** * @see org.newdawn.slick.opengl.renderer.SGL#glPushMatrix() */ public void glPushMatrix() { GL11.glPushMatrix(); }
GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL);
private static void renderPlayerLook(EntityPlayer player, ItemStack stack) { List<BlockPos> coords = ItemAstrolabe.getBlocksToPlace(stack, player); if (ItemAstrolabe.hasBlocks(stack, player, coords)) { Block block = ItemAstrolabe.getBlock(stack); int meta = ItemAstrolabe.getBlockMeta(stack); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ShaderHelper.useShader(ShaderHelper.alpha, shader -> { int alpha = ARBShaderObjects.glGetUniformLocationARB(shader, "alpha"); ARBShaderObjects.glUniform1fARB(alpha, 0.4F); }); for(BlockPos coord : coords) renderBlockAt(block, meta, coord); ShaderHelper.releaseShader(); GL11.glPopMatrix(); } }
@Override protected void preRenderCallback(@Nonnull EntityDireWolf entity, float partialTick) { if (debugCounter == 4) { System.out.println("RenderDirewolf.preRenderCallback: "); mainModel = new ModelDireWolf(); debugCounter++; } float scale = 1.25f; GL11.glPushMatrix(); GL11.glTranslatef(0.1f, 0, 0); GL11.glScalef(scale - 0.1f, scale, scale); }
@Override public void renderHeadUpDisplay(double d, boolean day, boolean shifted, Minecraft mc, IHUDConfig config) { for (IHUDButton button : buttons) { GL11.glPushMatrix(); button.renderAlways(shifted); if (button.shouldRenderButton()) { button.renderButton(button.isFocused(), button.isblockFocused(), shifted); } GL11.glPopMatrix(); } }