List of usage examples for org.lwjgl.opengl GL11 glPopAttrib
public static native void glPopAttrib();
From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java
License:Open Source License
private void drawCircle() { GL11.glBegin(GL11.GL_TRIANGLE_FAN);/* w ww . j a va 2 s. c om*/ if (customColor) { GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor3f(innerColor.r, innerColor.g, innerColor.b); } GL11.glVertex3f(0.0f, 0.0f, 0.0f); // center float step = 2f * (float) Math.PI / (float) quality; if (customColor) { GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a); } for (int i = 0; i <= quality; i++) { GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f); } if (customColor) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPopAttrib(); } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java
License:Open Source License
private void drawExternCircle() { float step = 2f * (float) Math.PI / (float) quality; if (customColor) { GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }/*from w w w. ja v a 2 s .c o m*/ GL11.glBegin(GL11.GL_TRIANGLE_STRIP); for (int i = 0; i <= quality; i++) { if (customColor) { GL11.glColor4f(innerColor.r, innerColor.g, innerColor.b, innerColor.a); } GL11.glVertex3f((float) (innerRadius * Math.cos(step * i)), (float) (innerRadius * Math.sin(step * i)), 0f); if (customColor) { GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a); } GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f); } GL11.glEnd(); if (customColor) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPopAttrib(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DColorElement.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (childElement == null) { return;/*from www . j a v a2 s . co m*/ } GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glColor4f(color.r, color.g, color.b, color.a); float[] matDiffuse = { color.r, color.g, color.b, color.a }; //TODO repair //GL12.glMaterialfv(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE, matDiffuse, 0); childElement.display(camera); GL11.glPopAttrib(); }
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;/*from w w w . j a va 2 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.element.V3DShaderElement.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (childElement == null) { return;/*from w ww. j a v a2s .c o m*/ } GL11.glPushAttrib(GL11.GL_CURRENT_BIT); shader.begin(); childElement.display(camera); shader.end(); GL11.glPopAttrib(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DSprite.java
License:Open Source License
@Override protected void doDisplay(V3DCamera camera) { if (!enableColor) { GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glColor4f(1, 1, 1, opacity); }//from w w w . ja va 2 s . c o m GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); GL11.glEnable(GL11.GL_ALPHA_TEST); if (disableRotation) { camera.disableRotation(); } float w = 0.5f * size.x * image.getWidth(); float h = 0.5f * size.y * image.getHeight(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getID()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-w, -h, 0.0f); GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(w, -h, 0.0f); GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(w, h, 0.0f); GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-w, h, 0.0f); GL11.glEnd(); if (disableRotation) { camera.enableRotation(); } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); if (!enableColor) { GL11.glPopAttrib(); } }
From source file:hellfirepvp.astralsorcery.client.effect.block.EffectTranslucentFallingBlock.java
License:Open Source License
@Override public void render(float pTicks) { TextureHelper.refreshTextureBindState(); TextureHelper.setActiveTextureToAtlasSprite(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//w w w.jav a 2s. com GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_BLEND); Blending.ADDITIVEDARK.apply(); if (disableDepth) { GL11.glDisable(GL11.GL_DEPTH_TEST); } GL11.glDisable(GL11.GL_CULL_FACE); RenderingUtils.removeStandartTranslationFromTESRMatrix(pTicks); Vector3 translateTo = getInterpolatedPosition(pTicks); GL11.glTranslated(translateTo.getX(), translateTo.getY(), translateTo.getZ()); float alpha = alphaFunction.getAlpha(age, maxAge); alpha *= alphaMultiplier; GL11.glColor4f(1F, 1F, 1F, alpha); float scaleF = this.scale; scaleF = scaleFunction.getScale(this, pTicks, scaleF); GL11.glTranslated(0.5, 0.5, 0.5); GL11.glScaled(scaleF, scaleF, scaleF); GL11.glTranslated(-0.5, -0.5, -0.5); Vector3 rotation = getInterpolatedRotation(pTicks); GL11.glTranslated(0.5, 0.5, 0.5); GL11.glRotated(rotation.getX(), 1, 0, 0); GL11.glRotated(rotation.getY(), 0, 1, 0); GL11.glRotated(rotation.getZ(), 0, 0, 1); GL11.glTranslated(-0.5, -0.5, -0.5); Tessellator tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); IBlockAccess world = new AirBlockRenderWorld(Biomes.PLAINS, Minecraft.getMinecraft().world.getWorldType()); Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(this.blockState, BlockPos.ORIGIN, world, vb); tes.draw(); GL11.glEnable(GL11.GL_CULL_FACE); if (disableDepth) { GL11.glEnable(GL11.GL_DEPTH_TEST); } Blending.DEFAULT.apply(); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); GL11.glPopAttrib(); TextureHelper.refreshTextureBindState(); }
From source file:hellfirepvp.astralsorcery.client.effect.EffectHandler.java
License:Open Source License
@SubscribeEvent public void onOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) { acceptsNewParticles = false;//ww w . java 2 s. co m Map<Integer, List<IComplexEffect>> layeredEffects = complexEffects .get(IComplexEffect.RenderTarget.OVERLAY_TEXT); for (int i = 0; i <= 2; i++) { for (IComplexEffect effect : layeredEffects.get(i)) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); effect.render(event.getPartialTicks()); GL11.glPopAttrib(); GL11.glPopMatrix(); } } acceptsNewParticles = true; } }
From source file:hellfirepvp.astralsorcery.client.effect.EffectHandler.java
License:Open Source License
@SubscribeEvent(priority = EventPriority.LOW) public void onRender(RenderWorldLastEvent event) { TESRPrismLens.renderColoredPrismsLast(); float pTicks = event.getPartialTicks(); acceptsNewParticles = false;//from www.j a va 2s . c o m for (CompoundObjectEffect.ObjectGroup og : objects.keySet()) { og.prepareGLContext(); for (CompoundObjectEffect effect : objects.get(og)) { effect.render(pTicks); } og.revertGLContext(); } if (uiGateway != null) { if (renderGateway) { uiGateway.renderIntoWorld(pTicks); } if (ClientGatewayHandler.focusingEntry != null) { renderGatewayTarget(pTicks); } } EntityFXFacingParticle.renderFast(pTicks, fastRenderParticles); EffectLightning.renderFast(pTicks, fastRenderLightnings); Map<Integer, List<IComplexEffect>> layeredEffects = complexEffects .get(IComplexEffect.RenderTarget.RENDERLOOP); for (int i = 0; i <= 2; i++) { for (IComplexEffect effect : layeredEffects.get(i)) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); effect.render(pTicks); GL11.glPopAttrib(); GL11.glPopMatrix(); } } acceptsNewParticles = true; TESRMapDrawingTable.renderRemainingGlasses(pTicks); TESRTranslucentBlock.renderTranslucentBlocks(); }
From source file:hellfirepvp.astralsorcery.client.effect.fx.EntityFXFacingParticle.java
License:Open Source License
public static void renderFast(float parTicks, List<EntityFXFacingParticle> particles) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glDisable(GL11.GL_ALPHA_TEST);/*from www. j a v a2 s .c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); staticFlareTex.bind(); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); for (EntityFXFacingParticle particle : new ArrayList<>(particles)) { if (particle == null) continue; particle.renderFast(parTicks, vb); } t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopAttrib(); }