List of usage examples for org.lwjgl.opengl GL11 glDepthFunc
public static void glDepthFunc(@NativeType("GLenum") int func)
From source file:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
public void initTexturedRendering() { // GL11.glDepthMask(true); // GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing // GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do GL11.glDepthMask(true);//from w w w .j a va 2 s. c o m GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do GL11.glDisable(GL11.GL_BLEND); ARBMultitexture.glActiveTextureARB(ARBMultitexture.GL_TEXTURE0_ARB); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); }
From source file:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
public void initBlendedRendering() { GL11.glDepthMask(false);/* w ww .j a va2 s . c o m*/ GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do GL11.glEnable(GL11.GL_BLEND); // Enable Blending GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); // Type Of Blending To Perform // GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST); // Really Nice Point Smoothing }
From source file:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
public void disableBlendedRendering() { GL11.glDepthMask(true);// ww w. j a va 2 s . c o m GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do // GL11.glHint (GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); // Set Perspective Calculations To Most Accurate GL11.glDisable(GL11.GL_BLEND); }
From source file:forestry.core.render.CrateRenderingHandler.java
License:Open Source License
private void renderIn3D(ItemStack stack) { GL11.glPushMatrix();//w w w. jav a2 s. c o m Tessellator tessellator = Tessellator.instance; if (RenderManager.instance.renderEngine == null) { return; } int meta = stack.getItemDamage(); for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) { IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass); if (icon == null) { continue; } if (renderItem.renderWithColor) { int color = stack.getItem().getColorFromItemStack(stack, pass); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; GL11.glColor4f(c1, c2, c3, 1.0F); } float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); if (stack.getItemSpriteNumber() == 0) { RenderManager.instance.renderEngine.bindTexture(BLOCK_TEXTURE); } else { RenderManager.instance.renderEngine.bindTexture(ITEM_TEXTURE); } ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), PIXEL); if (stack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(GLINT_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, PIXEL); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, PIXEL); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DNoDepthElement.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (childElement == null) { return;/* w ww.j a va2 s .c o m*/ } GL11.glPushAttrib(GL11.GL_DEPTH_BUFFER_BIT); GL11.glDepthFunc(GL11.GL_ALWAYS); GL11.glDisable(GL11.GL_DEPTH_TEST); childElement.display(camera); GL11.glPopAttrib(); }
From source file:fr.def.iss.vd2.lib_v3d.V3DCanvas.java
License:Open Source License
/** * Sets up the screen./*from w ww .ja v a 2 s . c om*/ * * @see javax.media.openGL11.GLEventListener#init(javax.media.openGL11.GLAutoDrawable) */ public void init() { try { frame = new JFrame("Space agencies"); //frame.setSize(width,height); //frame.setUndecorated(true); //here frame.setVisible(true); //frame.setAlwaysOnTop(true); frame.setLocation(0, 0); Canvas canvas = new Canvas(); canvas.setMinimumSize(new Dimension(800, 600)); canvas.setPreferredSize(new Dimension(width, height)); frame.add(canvas); frame.pack(); frame.addWindowListener(generateWindowListener()); frame.getContentPane().addHierarchyBoundsListener(new HierarchyBoundsListener() { @Override public void ancestorMoved(HierarchyEvent e) { } @Override public void ancestorResized(HierarchyEvent e) { width = frame.getContentPane().getWidth(); height = frame.getContentPane().getHeight(); reshape(0, 0, width, height); } }); Display.setDisplayMode(new DisplayMode(width, height)); //Display.setFullscreen(true); Display.setVSyncEnabled(false); Display.setTitle("Space agencies"); Display.setParent(canvas); Display.create(); canvas.requestFocus(); } catch (Exception e) { System.out.println("Error setting up display" + e); System.exit(0); } // Enable z- (depth) buffer for hidden surface removal. GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_POINT_SMOOTH); if (polygonOffset) { GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glPolygonOffset(1.0f, 1.0f); } GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); // Enables Clearing Of The Depth Buffer GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); // Enable smooth shading. GL11.glShadeModel(GL11.GL_SMOOTH); // Define "clear" color. GL11.glClearColor(0f, 0f, 0.4f, 0f); // We want a nice perspective. GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glFlush(); TextureManager.clearCache(); initied = true; // new LWJGLBinding(); }
From source file:go.graphics.swing.opengl.LWJGLDrawContext.java
License:Open Source License
public LWJGLDrawContext(GLCapabilities glcaps) { this.glcaps = glcaps; GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND);/*from w ww.j ava 2s . c om*/ GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); canUseVBOs = glcaps.GL_ARB_vertex_buffer_object; }
From source file:gravestone.models.block.memorials.ModelCreeperStatueMemorial.java
License:LGPL
private void renderCreeperCharging() { float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F; float scale = 1.2F; float f4 = 0.5F; GL11.glTranslated(0, -0.5, 0);// w w w .j a va2 s .c o m GL11.glScalef(scale, scale, scale); TileEntityGSMemorialRenderer.instance.bindTextureByName(Resources.CREEPER_AURA); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); for (int var21 = 0; var21 < 3; ++var21) { GL11.glLoadIdentity(); float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15; GL11.glTranslatef(0, var23, 0); renderCreeper(); } GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glTranslated(0, -0.19, 0); }
From source file:gravestone.models.block.ModelGraveStone.java
License:LGPL
protected void renderEnchantment() { float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F; TileEntityGSGraveStoneRenderer.instance.bindTextureByName(Resources.SWORD_AURA); GL11.glEnable(GL11.GL_BLEND);//from ww w . j a v a2 s .com GL11.glDepthMask(true); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); for (int var21 = 0; var21 < 3; var21++) { GL11.glDisable(GL11.GL_LIGHTING); float var22 = 0.76F; GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15; float var24 = 0.33333334F; GL11.glScalef(var24, var24, var24); GL11.glRotatef(30 - (float) var21 * 60, 0, 0, 1); GL11.glTranslatef(0, var23, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); renderAll(); } GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glDepthMask(true); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:illarion.graphics.lwjgl.MaskUtilLWJGL.java
License:Open Source License
/** * Start defining a mask. After calling this you need to use the drawer * functions to mask out the needed areas. *//*from ww w .j a v a 2 s .c o m*/ @Override public void defineMask() { GL11.glDepthMask(true); GL11.glClearDepth(1); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glDepthFunc(GL11.GL_ALWAYS); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glColorMask(false, false, false, false); }