List of usage examples for org.lwjgl.opengl GL11 GL_DST_COLOR
int GL_DST_COLOR
To view the source code for org.lwjgl.opengl GL11 GL_DST_COLOR.
Click Source Link
From source file:com.ardor3d.scene.state.lwjgl.LwjglBlendStateUtil.java
License:Open Source License
protected static int getGLSrcValue(final SourceFunction function, final ContextCapabilities caps) { switch (function) { case Zero://from www. j a va 2s. c o m return GL11.GL_ZERO; case DestinationColor: return GL11.GL_DST_COLOR; case OneMinusDestinationColor: return GL11.GL_ONE_MINUS_DST_COLOR; case SourceAlpha: return GL11.GL_SRC_ALPHA; case OneMinusSourceAlpha: return GL11.GL_ONE_MINUS_SRC_ALPHA; case DestinationAlpha: return GL11.GL_DST_ALPHA; case OneMinusDestinationAlpha: return GL11.GL_ONE_MINUS_DST_ALPHA; case SourceAlphaSaturate: return GL11.GL_SRC_ALPHA_SATURATE; case ConstantColor: if (caps.isConstantBlendColorSupported()) { return EXTBlendColor.GL_CONSTANT_COLOR_EXT; } // FALLS THROUGH case OneMinusConstantColor: if (caps.isConstantBlendColorSupported()) { return EXTBlendColor.GL_ONE_MINUS_CONSTANT_COLOR_EXT; } // FALLS THROUGH case ConstantAlpha: if (caps.isConstantBlendColorSupported()) { return EXTBlendColor.GL_CONSTANT_ALPHA_EXT; } // FALLS THROUGH case OneMinusConstantAlpha: if (caps.isConstantBlendColorSupported()) { return EXTBlendColor.GL_ONE_MINUS_CONSTANT_ALPHA_EXT; } // FALLS THROUGH case One: return GL11.GL_ONE; } throw new IllegalArgumentException("Invalid source function type: " + function); }
From source file:com.dinasgames.engine.graphics.RenderTarget.java
public int factorToGlConstant(BlendMode.Factor blendFactor) { switch (blendFactor) { case Zero:/*w ww . jav a 2 s . c o m*/ return GL11.GL_ZERO; case One: return GL11.GL_ONE; case SrcColor: return GL11.GL_SRC_COLOR; case OneMinusSrcColor: return GL11.GL_ONE_MINUS_SRC_COLOR; case DstColor: return GL11.GL_DST_COLOR; case OneMinusDstColor: return GL11.GL_ONE_MINUS_DST_COLOR; case SrcAlpha: return GL11.GL_SRC_ALPHA; case OneMinusSrcAlpha: return GL11.GL_ONE_MINUS_SRC_ALPHA; case DstAlpha: return GL11.GL_DST_ALPHA; case OneMinusDstAlpha: return GL11.GL_ONE_MINUS_DST_ALPHA; } return -1; }
From source file:com.replaymod.pixelcam.renderer.PathVisualizer.java
License:Apache License
@SubscribeEvent public void onRender(RenderWorldLastEvent event) { if (pathVisibility == PathVisibility.NONE || cameraPath.getPointCount() == 0 || PixelCamMod.instance.camCommand.isTravelling()) return;/* w w w . j a v a 2 s .com*/ Entity entity = mc.getRenderViewEntity(); float partial = event.getPartialTicks(); double doubleX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partial; double doubleY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partial; double doubleZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partial; Position prev = null; GlStateManager.pushAttrib(); GlStateManager.enableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (pathVisibility == PathVisibility.LINEAR || pathVisibility == PathVisibility.BOTH) { for (Position pos : cameraPath.getPoints()) { if (prev != null) drawConnection(doubleX, doubleY, doubleZ, prev, pos, Color.RED); prev = pos; } } if (pathVisibility == PathVisibility.SPLINE || pathVisibility == PathVisibility.BOTH) { Interpolation<Position> interpolation = cameraPath.getInterpolation(InterpolationType.SPLINE); prev = null; for (int i = 0; i < cameraPath.getPointCount(); i++) { //draw 100 connection lines between the two points for (int j = 0; j < 100; j++) { float k = (i / (float) cameraPath.getPointCount()) + (j / 100f * 1f / cameraPath.getPointCount()); Position pos = new Position(); interpolation.applyPoint(k, pos); if (prev != null) drawConnection(doubleX, doubleY, doubleZ, prev, pos, Color.GREEN); prev = pos; } } } GlStateManager.blendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR); int index = 1; for (Position pos : cameraPath.getPoints()) { drawPoint(doubleX, doubleY, doubleZ, pos, index); index++; } GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.popAttrib(); }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
private static int translateScaleFactor(int scaleFactor) { switch (scaleFactor) { case GLContext.GL_ZERO: return GL11.GL_ZERO; case GLContext.GL_ONE: return GL11.GL_ONE; case GLContext.GL_SRC_COLOR: return GL11.GL_SRC_COLOR; case GLContext.GL_ONE_MINUS_SRC_COLOR: return GL11.GL_ONE_MINUS_SRC_COLOR; case GLContext.GL_DST_COLOR: return GL11.GL_DST_COLOR; case GLContext.GL_ONE_MINUS_DST_COLOR: return GL11.GL_ONE_MINUS_DST_COLOR; case GLContext.GL_SRC_ALPHA: return GL11.GL_SRC_ALPHA; case GLContext.GL_ONE_MINUS_SRC_ALPHA: return GL11.GL_ONE_MINUS_SRC_ALPHA; case GLContext.GL_DST_ALPHA: return GL11.GL_DST_ALPHA; case GLContext.GL_ONE_MINUS_DST_ALPHA: return GL11.GL_ONE_MINUS_DST_ALPHA; case GLContext.GL_CONSTANT_COLOR: return GL14.GL_CONSTANT_COLOR; case GLContext.GL_ONE_MINUS_CONSTANT_COLOR: return GL14.GL_ONE_MINUS_CONSTANT_COLOR; case GLContext.GL_CONSTANT_ALPHA: return GL14.GL_CONSTANT_ALPHA; case GLContext.GL_ONE_MINUS_CONSTANT_ALPHA: return GL14.GL_ONE_MINUS_CONSTANT_ALPHA; case GLContext.GL_SRC_ALPHA_SATURATE: return GL11.GL_SRC_ALPHA_SATURATE; default:/* w ww.ja v a 2 s .c om*/ // don't know what to do, just return zero return GL11.GL_ZERO; } }
From source file:eplus.renders.TableEntityItemRenderer.java
License:LGPL
/** * Render the item's icon or block into the GUI, including the glint effect. *///from www . j a va2 s . c o m public void renderItemAndEffectIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) { if (par3ItemStack != null) { if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5)) { this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); } if (par3ItemStack.hasEffect()) { GL11.glDepthFunc(GL11.GL_GREATER); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); par2RenderEngine.bindTexture("%blur%/misc/glint.png"); this.zLevel -= 50.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); this.zLevel += 50.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } }
From source file:net.famzangl.minecraft.minebot.ai.render.RenderHelper.java
License:Open Source License
private void preRender() { GlStateManager.disableTexture2D();/* ww w. jav a 2 s .c om*/ GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR, 1, 0); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableAlpha(); GlStateManager.pushMatrix(); }
From source file:net.malisis.core.renderer.MalisisRenderer.java
License:Open Source License
/** * Renders a {@link TileEntitySpecialRenderer}. * * @param te the TileEntity//from ww w . j a v a 2 s .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(); }
From source file:net.neilcsmith.praxis.video.opengl.ops.AbstractBlitOp.java
License:Open Source License
void setupBlending(GLRenderer renderer, BlendMode mode, float opacity) {// boolean srcAlpha, boolean dstAlpha) { // renderer.enableBlending(); switch (mode) { case Normal:/*from w w w.java 2s. c o m*/ renderer.setBlendFunction(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); break; case Add: renderer.setBlendFunction(GL11.GL_ONE, GL11.GL_ONE); break; case Multiply: renderer.setBlendFunction(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA); break; case Mask: renderer.setBlendFunction(GL11.GL_ZERO, GL11.GL_SRC_COLOR); break; default: throw new IllegalArgumentException(); } renderer.setColor(new Color(opacity, opacity, opacity, opacity)); }
From source file:org.illarion.engine.backend.slick.SlickGraphics.java
License:Open Source License
@Override public void setBlendingMode(@Nonnull final BlendingMode mode) { if (slickGraphicsImpl == null) { throw new IllegalStateException("Using graphics outside of the render loop is not allowed."); }//from www . ja v a 2s.c om switch (mode) { case AlphaBlend: slickGraphicsImpl.setDrawMode(org.newdawn.slick.Graphics.MODE_NORMAL); Renderer.get().glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); break; case Multiply: slickGraphicsImpl.setDrawMode(org.newdawn.slick.Graphics.MODE_NORMAL); Renderer.get().glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_ZERO); break; } }
From source file:org.spoutcraft.client.gui.minimap.MapRenderer.java
License:Open Source License
private void renderMap() { GL11.glDisable(2929);//from w w w.ja v a 2 s. c o m GL11.glEnable(3042); GL11.glDepthMask(false); GL11.glBlendFunc(770, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (MinimapConfig.getInstance().isEnabled()) { if (MinimapConfig.getInstance().isSquare()) { // Scale GL11.glPushMatrix(); switch (MinimapConfig.getInstance().getZoom()) { case 0: GL11.glScalef(8F, 8F, 1F); GL11.glTranslatef(56, 0, 0F); break; case 1: GL11.glScalef(4F, 4F, 1F); GL11.glTranslatef(48, 0, 0F); break; case 2: GL11.glScalef(2F, 2F, 1F); GL11.glTranslatef(32, 0, 0F); break; } map.loadColorImage(); drawOnMap(); if (MinimapConfig.getInstance().isHeightmap()) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR); map.loadHeightImage(); drawOnMap(); } GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); renderEntities(); try { GL11.glPushMatrix(); GL11.glScalef(1.8f, 1.8f, 1.0f); GL11.glTranslatef(27, -1, 0F); // don't ask if (MinimapConfig.getInstance().isShowBackground()) { texman.loadMinimap(); } else { GL11.glScalef(138F / 256F, 138F / 256F, 1F); GL11.glTranslatef(-54, 0, 0); texman.loadWhiteMinimap(); } drawOnMap(); } catch (Exception e) { // System.err.println("error: minimap overlay not found!"); // e.printStackTrace(); } finally { GL11.glPopMatrix(); } renderWaypoints(); try { GL11.glPushMatrix(); texman.loadMMArrow(); GL11.glTranslatef(-34.0F, 30.0F, 0.0F); GL11.glRotatef(-this.direction + 90F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(32.0F, -(32.0F), 0.0F); drawOnMap(); } catch (Exception e) { // System.err.println("Error: minimap arrow not found!"); e.printStackTrace(); } finally { GL11.glPopMatrix(); } GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // render directions with fudge factor to make them line up GL11.glPushMatrix(); GL11.glTranslatef(-2, 2, 0.0F); drawDirections(); drawFocusSquare(); GL11.glPopMatrix(); } else { GL11.glPushMatrix(); map.loadColorImage(); GL11.glTranslatef(-32.0f, 32.0F, 0.0F); GL11.glRotatef(this.direction + 90.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(32.0F, -(32.0F), 0.0F); switch (MinimapConfig.getInstance().getZoom()) { case 0: GL11.glScalef(8F, 8F, 1F); GL11.glTranslatef(56.25F, 0.25F, 0F); break; case 1: GL11.glScalef(4F, 4F, 1F); GL11.glTranslatef(48.5F, 0.5F, 0F); break; case 2: GL11.glScalef(2F, 2F, 1F); GL11.glTranslatef(33F, 1F, 0F); break; case 3: GL11.glTranslatef(2F, 2F, 0F); break; } drawOnMap(); if (MinimapConfig.getInstance().isHeightmap()) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR); map.loadHeightImage(); drawOnMap(); } GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); renderWaypoints(); renderEntities(); drawRound(); drawDirections(); GL11.glPushMatrix(); drawFocusRound(); GL11.glPopMatrix(); } } }