List of usage examples for org.lwjgl.opengl GL11 glCullFace
public static void glCullFace(@NativeType("GLenum") int mode)
From source file:com.grillecube.client.renderer.world.TerrainMesh.java
@Override protected void preDraw() { if (this.cull()) { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); } else {//www . j av a 2 s . com GL11.glDisable(GL11.GL_CULL_FACE); } }
From source file:com.grillecube.engine.renderer.model.ModelRenderer.java
/** render world terrains */ @Override//from w ww .j av a 2 s .c o m public void render() { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); this.render(super.getCamera()); GL11.glDisable(GL11.GL_CULL_FACE); }
From source file:com.grillecube.engine.renderer.world.terrain.TerrainRenderer.java
@Override public void render() { if (!this._can_render) { return;//from ww w.ja va 2s. c o m } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (this.getParent().getGLFWWindow().isKeyPressed(GLFW.GLFW_KEY_F)) { GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); } this.render(super.getCamera()); GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); }
From source file:com.opengrave.og.engine.Node.java
License:Open Source License
public void renderSemiTransparent(Matrix4f matrix) { Util.checkErr();// www .j av a2 s .co m doRenderSemiTransparent(matrix); if (MainThread.main.input.getLastHovered() != null) { Pickable lr = MainThread.main.input.getLastHovered().getRenderable(); if (this instanceof BaseObject && lr instanceof BaseObject) { if (lr == this) { BaseObject notThis = (BaseObject) this; if (notThis.drawOutline) { // Setup for outline draw GL11.glDepthFunc(GL11.GL_LESS); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_LINE); GL11.glLineWidth(10f); GL11.glCullFace(GL11.GL_FRONT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Draw RenderStyle rs = notThis.getRenderStyle(); notThis.setRenderStyle(RenderStyle.HALO); doRender(matrix); notThis.setRenderStyle(rs); // Return to correct state GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_FILL); GL11.glLineWidth(1f); GL11.glCullFace(GL11.GL_BACK); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); } } } } Util.checkErr(); for (Node node : children) { Matrix4f childMatrix = matrix.mult(node.getMatrix(), null); node.renderSemiTransparent(childMatrix); Util.checkErr(); } }
From source file:com.opengrave.og.engine.RenderView.java
License:Open Source License
private void prepare3DShadow() { GL11.glDisable(GL11.GL_BLEND);/*from w w w .j a va2 s .co m*/ GL11.glDepthFunc(GL11.GL_LESS); // GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); // GL11.glPolygonOffset(1.1f, 10f); GL11.glCullFace(GL11.GL_FRONT); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:com.opengrave.og.engine.RenderView.java
License:Open Source License
private void prepare3DOpaque() { GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glDisable(GL11.GL_BLEND);/* w ww . j a v a 2s.c om*/ GL11.glDepthFunc(GL11.GL_LESS); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:com.runescape.client.revised.client.lwjgl.RenderUtilities.java
License:Open Source License
public static void initializeGraphics() { GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); GL11.glFrontFace(GL11.GL_CW);/* w ww . j a v a 2s . c o m*/ GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL30.GL_FRAMEBUFFER_SRGB); // TODO: Depth clamp }
From source file:com.runescape.client.revised.editor.modelviewer.Main.java
License:Open Source License
public static void initialize(final Canvas modelCanvas) { try {//from w w w. j a v a 2 s. c om Display.setParent(modelCanvas); Display.create(new PixelFormat(8, 24, 8, 8)); Display.makeCurrent(); } catch (final LWJGLException lwjgle) { try { Display.create(new PixelFormat(8, 24, 8, 0)); } catch (final LWJGLException e) { e.printStackTrace(); } } Display.setVSyncEnabled(false); Display.setSwapInterval(0); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClearDepth(1.0F); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_NORMALIZE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_POINT_SMOOTH); GL11.glEnable(GL11.GL_POLYGON_SMOOTH); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE); GL11.glCullFace(GL11.GL_BACK); }
From source file:com.rvantwisk.cnctools.controls.opengl.OpenGLRenderer.java
License:Open Source License
protected void loop() { final ReadonlyCamera localCam; synchronized (this) { localCam = this.camera; if (actors.size() > 0) { for (AbstractActor actor : actors) { // CHeck if a existing axctor already exists, if so destroy it if (activeActors.containsKey(actor.getName())) { final AbstractActor existingActor = activeActors.get(actor.getName()); existingActor.destroy(); }//from w w w . j a v a2 s . com // Add a new actor actor.initialize(); activeActors.put(actor.getName(), actor); } actors.clear(); } } viewAxis.setCamera(localCam); viewModel.setCamera(localCam); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL12.GL_RESCALE_NORMAL); // Draw axis in lower left corner viewAxis.begin(); drawAxis(25f); viewAxis.end(); // Prepare actors for next drawing sequence for (final AbstractActor actor : activeActors.values()) { actor.prepare(); } viewModel.begin(); viewModel.display_transform(); // Draw the actor for (final AbstractActor actor : activeActors.values()) { actor.draw(); } viewModel.end(); }
From source file:com.shinoow.abyssalcraft.client.model.entity.ModelDragonBoss.java
License:Apache License
@Override public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { GL11.glPushMatrix();/*from w ww.ja v a 2s. c o m*/ EntityDragonBoss entitydragon = (EntityDragonBoss) par1Entity; float f6 = entitydragon.prevAnimTime + (entitydragon.animTime - entitydragon.prevAnimTime) * partialTicks; jaw.rotateAngleX = (float) (Math.sin(f6 * (float) Math.PI * 2.0F) + 1.0D) * 0.2F; float f7 = (float) (Math.sin(f6 * (float) Math.PI * 2.0F - 1.0F) + 1.0D); f7 = (f7 * f7 * 1.0F + f7 * 2.0F) * 0.05F; GL11.glTranslatef(0.0F, f7 - 2.0F, -3.0F); GL11.glRotatef(f7 * 2.0F, 1.0F, 0.0F, 0.0F); float f8 = -30.0F; float f9 = 0.0F; float f10 = 1.5F; double[] adouble = entitydragon.getMovementOffsets(6, partialTicks); float f11 = updateRotations(entitydragon.getMovementOffsets(5, partialTicks)[0] - entitydragon.getMovementOffsets(10, partialTicks)[0]); float f12 = updateRotations(entitydragon.getMovementOffsets(5, partialTicks)[0] + f11 / 2.0F); f8 += 2.0F; float f13 = f6 * (float) Math.PI * 2.0F; f8 = 20.0F; float f14 = -12.0F; float f15; for (int i = 0; i < 5; ++i) { double[] adouble1 = entitydragon.getMovementOffsets(5 - i, partialTicks); f15 = (float) Math.cos(i * 0.45F + f13) * 0.15F; neck.rotateAngleY = updateRotations(adouble1[0] - adouble[0]) * (float) Math.PI / 180.0F * f10; neck.rotateAngleX = f15 + (float) (adouble1[1] - adouble[1]) * (float) Math.PI / 180.0F * f10 * 5.0F; neck.rotateAngleZ = -updateRotations(adouble1[0] - f12) * (float) Math.PI / 180.0F * f10; neck.rotationPointY = f8; neck.rotationPointZ = f14; neck.rotationPointX = f9; f8 = (float) (f8 + Math.sin(neck.rotateAngleX) * 10.0D); f14 = (float) (f14 - Math.cos(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10.0D); f9 = (float) (f9 - Math.sin(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10.0D); neck.render(par7); } head.rotationPointY = f8; head.rotationPointZ = f14; head.rotationPointX = f9; double[] adouble2 = entitydragon.getMovementOffsets(0, partialTicks); head.rotateAngleY = updateRotations(adouble2[0] - adouble[0]) * (float) Math.PI / 180.0F * 1.0F; head.rotateAngleZ = -updateRotations(adouble2[0] - f12) * (float) Math.PI / 180.0F * 1.0F; head.render(par7); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 1.0F, 0.0F); GL11.glRotatef(-f11 * f10 * 1.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -1.0F, 0.0F); body.rotateAngleZ = 0.0F; body.render(par7); for (int j = 0; j < 2; ++j) { GL11.glEnable(GL11.GL_CULL_FACE); f15 = f6 * (float) Math.PI * 2.0F; wing.rotateAngleX = 0.125F - (float) Math.cos(f15) * 0.2F; wing.rotateAngleY = 0.25F; wing.rotateAngleZ = (float) (Math.sin(f15) + 0.125D) * 0.8F; wingTip.rotateAngleZ = -((float) (Math.sin(f15 + 2.0F) + 0.5D)) * 0.75F; rearLeg.rotateAngleX = 1.0F + f7 * 0.1F; rearLegTip.rotateAngleX = 0.5F + f7 * 0.1F; rearFoot.rotateAngleX = 0.75F + f7 * 0.1F; frontLeg.rotateAngleX = 1.3F + f7 * 0.1F; frontLegTip.rotateAngleX = -0.5F - f7 * 0.1F; frontFoot.rotateAngleX = 0.75F + f7 * 0.1F; wing.render(par7); frontLeg.render(par7); rearLeg.render(par7); GL11.glScalef(-1.0F, 1.0F, 1.0F); if (j == 0) GL11.glCullFace(GL11.GL_FRONT); } GL11.glPopMatrix(); GL11.glCullFace(GL11.GL_BACK); GL11.glDisable(GL11.GL_CULL_FACE); float f16 = -((float) Math.sin(f6 * (float) Math.PI * 2.0F)) * 0.0F; f13 = f6 * (float) Math.PI * 2.0F; f8 = 10.0F; f14 = 60.0F; f9 = 0.0F; adouble = entitydragon.getMovementOffsets(11, partialTicks); for (int k = 0; k < 12; ++k) { adouble2 = entitydragon.getMovementOffsets(12 + k, partialTicks); f16 = (float) (f16 + Math.sin(k * 0.45F + f13) * 0.05000000074505806D); neck.rotateAngleY = (updateRotations(adouble2[0] - adouble[0]) * f10 + 180.0F) * (float) Math.PI / 180.0F; neck.rotateAngleX = f16 + (float) (adouble2[1] - adouble[1]) * (float) Math.PI / 180.0F * f10 * 5.0F; neck.rotateAngleZ = updateRotations(adouble2[0] - f12) * (float) Math.PI / 180.0F * f10; neck.rotationPointY = f8; neck.rotationPointZ = f14; neck.rotationPointX = f9; f8 = (float) (f8 + Math.sin(neck.rotateAngleX) * 10.0D); f14 = (float) (f14 - Math.cos(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10.0D); f9 = (float) (f9 - Math.sin(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10.0D); neck.render(par7); } GL11.glPopMatrix(); }