List of usage examples for org.lwjgl.opengl GL11 glAlphaFunc
public static native void glAlphaFunc(@NativeType("GLenum") int func, @NativeType("GLfloat") float ref);
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void setAlphaFunc(int func, int ref, int mask) { // mask is not supported by OpenGL GL11.glAlphaFunc(alphaFuncToGL[func], ref / 255.0f); }
From source file:kuake2.render.lwjgl.Misc.java
License:Open Source License
void GL_SetDefaultState() { GL11.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //GL11.glClearColor(0, 0, 0, 0); // replaced with black GL11.glCullFace(GL11.GL_FRONT);/*w w w . ja v a 2 s. co m*/ GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.666f); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1, 1, 1, 1); GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GL11.glShadeModel(GL11.GL_FLAT); GL_TextureMode(gl_texturemode.string); GL_TextureAlphaMode(gl_texturealphamode.string); GL_TextureSolidMode(gl_texturesolidmode.string); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL_TexEnv(GL11.GL_REPLACE); if (qglPointParameterfEXT) { // float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value }; FloatBuffer att_buffer = BufferUtils.createFloatBuffer(4); att_buffer.put(0, gl_particle_att_a.value); att_buffer.put(1, gl_particle_att_b.value); att_buffer.put(2, gl_particle_att_c.value); GL11.glEnable(GL11.GL_POINT_SMOOTH); EXTPointParameters.glPointParameterfEXT(EXTPointParameters.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value); EXTPointParameters.glPointParameterfEXT(EXTPointParameters.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value); EXTPointParameters.glPointParameterEXT(EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer); } if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) { GL11.glEnable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT); GL_SetTexturePalette(d_8to24table); } GL_UpdateSwapInterval(); /* * vertex array extension */ GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE0); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); }
From source file:lyonlancer5.xatrocore.lib.internal.MCv18.java
License:Open Source License
@SideOnly(Side.CLIENT) protected static void drawSplashScreen(Minecraft mcIn, TextureManager textureManager) { ScaledResolution scaledresolution = new ScaledResolution(mcIn, mcIn.displayWidth, mcIn.displayHeight); int i = scaledresolution.getScaleFactor(); Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true); framebuffer.bindFramebuffer(false);//from w w w . j a va 2 s . com //GlStateManager.matrixMode(5889); GL11.glMatrixMode(5889); //GlStateManager.loadIdentity(); GL11.glLoadIdentity(); //GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); GL11.glOrtho(0.0D, (double) scaledresolution.getScaledWidth(), (double) scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); //GlStateManager.matrixMode(5888); GL11.glMatrixMode(5888); //GlStateManager.loadIdentity(); GL11.glLoadIdentity(); //GlStateManager.translate(0.0F, 0.0F, -2000.0F); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); //GlStateManager.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //GlStateManager.disableFog(); GL11.glDisable(GL11.GL_FOG); //GlStateManager.disableDepth(); GL11.glDisable(GL11.GL_DEPTH); //GlStateManager.enableTexture2D(); GL11.glEnable(GL11.GL_TEXTURE_2D); InputStream inputstream = null; try { //inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng); inputstream = mcIn.getResourcePackRepository().rprDefaultResourcePack.getInputStream(locationMojangPng); mojangLogo = textureManager.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream))); textureManager.bindTexture(mojangLogo); } catch (IOException ioexception) { //logger.error("Unable to load logo: " + locationMojangPng, ioexception); } finally { IOUtils.closeQuietly(inputstream); } Tessellator tessellator = Tessellator.instance; //WorldRenderer worldrenderer = tessellator.getWorldRenderer(); //worldrenderer.startDrawingQuads(); tessellator.startDrawingQuads(); //worldrenderer.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(16777215); //worldrenderer.addVertexWithUV(0.0D, (double)mcIn.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, (double) mcIn.displayHeight, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV((double)mcIn.displayWidth, (double)mcIn.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV((double) mcIn.displayWidth, (double) mcIn.displayHeight, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV((double) mcIn.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.draw(); //GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //worldrenderer.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(16777215); short short1 = 256; short short2 = 256; mcIn.scaledTessellator((scaledresolution.getScaledWidth() - short1) / 2, (scaledresolution.getScaledHeight() - short2) / 2, 0, 0, short1, short2); //GlStateManager.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //GlStateManager.disableFog(); GL11.glDisable(GL11.GL_FOG); framebuffer.unbindFramebuffer(); framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i); //GlStateManager.enableAlpha(); GL11.glEnable(GL11.GL_ALPHA); //GlStateManager.alphaFunc(516, 0.1F); GL11.glAlphaFunc(516, 0.1F); updateDisplay(mcIn); }
From source file:matteroverdrive.gui.element.ElementStates.java
License:Open Source License
@Override public void drawForeground(int mouseX, int mouseY) { super.drawForeground(mouseX, mouseY); GL11.glColor4d(1, 1, 1, 1);/*from w w w . j av a 2 s . co m*/ GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f); GL11.glCullFace(GL11.GL_BACK); int width = getFontRenderer().getStringWidth(label); getFontRenderer().drawString(label, posX + sizeX + 4, posY - getFontRenderer().FONT_HEIGHT / 2 + sizeY / 2, getTextColor()); }
From source file:matteroverdrive.gui.pages.PageScanInfo.java
License:Open Source License
@Override public void drawForeground(int mouseX, int mouseY) { super.drawForeground(mouseX, mouseY); ItemStack item = pattern.toItemStack(false); if (item != null) { //GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f); List infos = item.getTooltip(null, false); if (MatterHelper.CanScan(item)) { String Matter = "Matter: " + String.valueOf(MatterHelper.getMatterAmountFromItem(item)) + MatterHelper.MATTER_UNIT; infos.add(Matter);/*from w w w . j a v a2s .c om*/ } RenderUtils.DrawMultilineInfo(infos, 50, 98, 8, 200, Color.WHITE.getColor()); } else { String Matter = "Matter: " + String.valueOf(MatterHelper.getMatterAmountFromItem(item)) + MatterHelper.MATTER_UNIT; Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("No Item Selected!", 80, 90, new Color(255, 150, 50).getColor()); } }
From source file:me.sunchiro.game.engine.gl.Graphic.java
License:Open Source License
private synchronized void render() { GL11.glClearColor(bgColor.x, bgColor.y, bgColor.z, 0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL20.glUseProgram(shader.getPID());//from ww w. j a v a 2 s . c o m // GL13.glActiveTexture(GL13.GL_TEXTURE0); GL30.glBindVertexArray(vaoId); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid)); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId); long offset = 0; int shift = 0; GL11.glAlphaFunc(GL11.GL_GREATER, 0.4f); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); for (Drawable object : objects) { Matrix4f finalMVP = new Matrix4f(mvpMat); Matrix4f modelMat = new Matrix4f(); Matrix4f scaler = new Matrix4f(); scaler.scale(object.scale * allScale); modelMat.translate(object.translation); modelMat.rotateXYZ(object.rotation.x, object.rotation.y, object.rotation.z); finalMVP.mul(modelMat); finalMVP.mul(scaler); finalMVP.get(0, matBuff); if (object.isChar) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid_charmap)); } GL20.glUniformMatrix4fv(shader.getMVPLocation(), false, matBuff); GL20.glUniform1i(shader.getInverseLocation(), object.inverseAlpha ? 1 : 0); if (object.isVisible()) GL32.glDrawElementsBaseVertex(GL11.GL_TRIANGLES, object.getIndices().length, GL11.GL_UNSIGNED_BYTE, offset, shift); offset += object.getIndices().length; shift += object.getVertex().length; if (object.isChar) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid)); } } render2d(offset, shift); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); GL30.glBindVertexArray(0); // GL20.glUseProgram(0); glfwSwapBuffers(window); glfwPollEvents(); }
From source file:net.awairo.mcmod.spawnchecker.client.marker.RenderingSupport.java
License:Minecraft Mod Public
/** * ????GL./*w w w . j ava2s . c o m*/ */ public static void beginRendering() { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glDepthMask(false); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); }
From source file:net.kubin.rendering.ChunkMeshRenderer.java
License:Apache License
public static void renderChunkMesh(Chunk chunk, MeshType meshType) { if (chunk.getMesh().getVBO(meshType) <= 0) { return;// www. j a v a 2 s . co m } /* Bind the correct texture */ GL11.glEnable(GL11.GL_TEXTURE_2D); TextureStorage.getTexture("blocks").bind(); if (meshType == MeshType.OPAQUE) { GL11.glDisable(GL11.GL_BLEND); } else if (meshType == MeshType.TRANSLUCENT) { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f); } ChunkMesh mesh = chunk.getMesh(); /* Bind the buffer */ ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, mesh.getVBO(meshType)); /* Enable the different kinds of data in the buffer */ GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); // System.out.println("Chunk Vertices = " + mesh.getVertexCount()); /* Define the starting positions */ GL11.glVertexPointer(POSITION_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, POSITION_OFFSET * FLOAT_SIZE); GL11.glTexCoordPointer(TEX_COORD_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, TEX_COORD_OFFSET * FLOAT_SIZE); GL11.glColorPointer(COLOR_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, COLOR_OFFSET * FLOAT_SIZE); /* Draw the buffer */ GL11.glDrawArrays(GL11.GL_QUADS, 0, mesh.getVertexCount(meshType)); /* Unbind the buffer */ ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0); /* Disable the different kindds of data */ GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (meshType == MeshType.TRANSLUCENT) { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_ALPHA_TEST); } }
From source file:net.lyonlancer5.mcmp.karasu.client.renderer.tileentity.TileEntityBeaconRenderer.java
License:Apache License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTickTime) { TileEntityBeacon beacon = (TileEntityBeacon) tile; float f1 = beacon.func_146002_i(); //OpenGLHelper.alphaFunc(GL11.GL_GREATER, 0.1F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if (f1 > 0.0F) { Tessellator tessellator = Tessellator.instance; List<BeamSegment> list = beacon.getSegments(); int j = 0; for (int i = 0; i < list.size(); i++) { BeamSegment beamsegment = list.get(i); int l = j + beamsegment.getCurrentSegment(); bindTexture(BEAM_TEXTURE);//from w w w . ja v a 2 s . co m GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); //OpenGLHelper.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //OpenGLHelper.disableCull(); GL11.glDisable(GL11.GL_CULL_FACE); //OpenGLHelper.disableBlend(); GL11.glDisable(GL11.GL_BLEND); //OpenGLHelper.depthMask(true); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = tile.getWorldObj().getTotalWorldTime() + partialTickTime; float f3 = -f2 * 0.2F - MathHelper.floor_float(-f2 * 0.1F); double d3 = f2 * 0.025D * -1.5D; tessellator.startDrawingQuads(); double d4 = 0.2D; double d5 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d4; double d6 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d4; double d7 = 0.5D + Math.cos(d3 + Math.PI / 4D) * d4; double d8 = 0.5D + Math.sin(d3 + Math.PI / 4D) * d4; double d9 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d4; double d10 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d4; double d11 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d4; double d12 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d4; double d13 = 0.0D; double d14 = 1.0D; double d15 = -1.0F + f3; double d16 = beamsegment.getCurrentSegment() * f1 * (0.5D / d4) + d15; tessellator.setColorRGBA_F(beamsegment.getSegmentColors()[0], beamsegment.getSegmentColors()[1], beamsegment.getSegmentColors()[2], 0.125F); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d14, d16); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d14, d15); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d13, d15); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d13, d16); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d14, d16); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d14, d15); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d13, d15); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d13, d16); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d14, d16); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d14, d15); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d13, d15); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d13, d16); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d14, d16); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d14, d15); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d13, d15); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d13, d16); tessellator.draw(); //OpenGLHelper.enableBlend(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); //OpenGLHelper.depthMask(false); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(beamsegment.getSegmentColors()[0], beamsegment.getSegmentColors()[1], beamsegment.getSegmentColors()[2], 0.125F); d3 = 0.2D; d4 = 0.2D; d5 = 0.8D; d6 = 0.2D; d7 = 0.2D; d8 = 0.8D; d9 = 0.8D; d10 = 0.8D; d11 = 0.0D; d12 = 1.0D; d13 = -1.0F + f3; d14 = beamsegment.getCurrentSegment() * f1 + d13; tessellator.addVertexWithUV(x + d3, y + l, z + d4, d12, d14); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d12, d13); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d11, d13); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d11, d14); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d12, d14); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d12, d13); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d11, d13); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d11, d14); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d12, d14); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d12, d13); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d11, d13); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d11, d14); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d12, d14); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d12, d13); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d11, d13); tessellator.addVertexWithUV(x + d3, y + l, z + d4, d11, d14); tessellator.draw(); //OpenGLHelper.enableLighting(); GL11.glEnable(GL11.GL_LIGHTING); //OpenGLHelper.enableTexture2D(); GL11.glEnable(GL11.GL_TEXTURE_2D); //OpenGLHelper.depthMask(true); j = l; } } }
From source file:net.malisis.core.renderer.MalisisRenderer.java
License:Open Source License
/** * Renders a {@link TileEntitySpecialRenderer}. * * @param te the TileEntity//w ww. j a va 2s . co m * @param x the x * @param y the y * @param z the z * @param partialTick the partial tick */ @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) { set(te, partialTick); prepare(RenderType.TESR_WORLD, x, y, z); render(); if (getBlockDamage) { destroyBlockProgress = getBlockDestroyProgress(); if (destroyBlockProgress != null) { next(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR, GL11.GL_ONE, GL11.GL_ZERO); GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); t.disableColor(); renderDestroyProgress(); next(); GL11.glDisable(GL11.GL_BLEND); } } clean(); }