List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:co.uk.silvania.rpgcore.client.skillgui.GuiScrollingList_Mod.java
License:Open Source License
public void drawScreen(int mouseX, int mouseY, float p_22243_3_) { this.mouseX = mouseX; this.mouseY = mouseY; this.drawBackground(); int listLength = this.getSize(); int scrollBarXStart = this.left + this.listWidth - 6; int scrollBarXEnd = scrollBarXStart + 6; int boxLeft = this.left; int boxRight = scrollBarXStart - 1; int var10; int var11; int var13; int var19; var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4; var11 = var10 / this.slotHeight; //Tells the GUI which element we're hovering over, for tooltip rendering. if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) { hoverElement = var11; }//from w w w . jav a2 s. c o m if (Mouse.isButtonDown(0)) { if (this.initialMouseClickY == -1.0F) { boolean var7 = true; if (mouseY >= this.top && mouseY <= this.bottom) { var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4; var11 = var10 / this.slotHeight; if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) { boolean var12 = var11 == this.selectedIndex && System.currentTimeMillis() - this.lastClickTime < 250L; this.elementClicked(var11, var12); this.selectedIndex = var11; this.lastClickTime = System.currentTimeMillis(); } else if (mouseX >= boxLeft && mouseX <= boxRight && var10 < 0) { this.func_27255_a(mouseX - boxLeft, mouseY - this.top + (int) this.scrollDistance - 4); var7 = false; } if (mouseX >= scrollBarXStart && mouseX <= scrollBarXEnd) { this.scrollFactor = -1.0F; var19 = this.getContentHeight() - (this.bottom - this.top - 4); if (var19 < 1) { var19 = 1; } var13 = (int) ((float) ((this.bottom - this.top) * (this.bottom - this.top)) / (float) this.getContentHeight()); if (var13 < 32) { var13 = 32; } if (var13 > this.bottom - this.top - 8) { var13 = this.bottom - this.top - 8; } this.scrollFactor /= (float) (this.bottom - this.top - var13) / (float) var19; } else { this.scrollFactor = 1.0F; } if (var7) { this.initialMouseClickY = (float) mouseY; } else { this.initialMouseClickY = -2.0F; } } else { this.initialMouseClickY = -2.0F; } } else if (this.initialMouseClickY >= 0.0F) { this.scrollDistance -= ((float) mouseY - this.initialMouseClickY) * this.scrollFactor; this.initialMouseClickY = (float) mouseY; } } else { while (Mouse.next()) { int var16 = Mouse.getEventDWheel(); if (var16 != 0) { if (var16 > 0) { var16 = -1; } else if (var16 < 0) { var16 = 1; } this.scrollDistance += (float) (var16 * this.slotHeight / 2); } } this.initialMouseClickY = -1.0F; } this.applyScrollLimits(); Tessellator var18 = Tessellator.instance; if (this.client.theWorld != null) { this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680); } else { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); this.client.renderEngine.bindTexture(Gui.optionsBackground); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float var17 = 32.0F; var18.startDrawingQuads(); var18.setColorOpaque_I(2105376); var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, (double) ((float) this.left / var17), (double) ((float) (this.bottom + (int) this.scrollDistance) / var17)); var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, (double) ((float) this.right / var17), (double) ((float) (this.bottom + (int) this.scrollDistance) / var17)); var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, (double) ((float) this.right / var17), (double) ((float) (this.top + (int) this.scrollDistance) / var17)); var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / var17), (double) ((float) (this.top + (int) this.scrollDistance) / var17)); var18.draw(); } //boxRight = this.listWidth / 2 - 92 - 16; var10 = this.top + 4 - (int) this.scrollDistance; if (this.field_27262_q) { this.func_27260_a(boxRight, var10, var18); } int var14; for (var11 = 0; var11 < listLength; ++var11) { var19 = var10 + var11 * this.slotHeight + this.field_27261_r; var13 = this.slotHeight - 4; if (var19 <= this.bottom && var19 + var13 >= this.top) { if (this.field_25123_p && this.isSelected(var11)) { var14 = boxLeft; int var15 = boxRight; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); var18.startDrawingQuads(); var18.setColorOpaque_I(8421504); var18.addVertexWithUV((double) var14, (double) (var19 + var13 + 2), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) var15, (double) (var19 + var13 + 2), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) var15, (double) (var19 - 2), 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) var14, (double) (var19 - 2), 0.0D, 0.0D, 0.0D); var18.setColorOpaque_I(0); var18.addVertexWithUV((double) (var14 + 1), (double) (var19 + var13 + 1), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) (var15 - 1), (double) (var19 + var13 + 1), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) (var15 - 1), (double) (var19 - 1), 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) (var14 + 1), (double) (var19 - 1), 0.0D, 0.0D, 0.0D); var18.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } this.drawSlot(var11, boxRight, var19, var13, var18); } } GL11.glDisable(GL11.GL_DEPTH_TEST); byte var20 = 4; if (this.client.theWorld == null) { this.overlayBackground(0, this.top, 255, 255); this.overlayBackground(this.bottom, this.listHeight, 255, 255); } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV((double) this.left, (double) (this.top + var20), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) this.right, (double) (this.top + var20), 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV((double) this.right, (double) (this.bottom - var20), 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) this.left, (double) (this.bottom - var20), 0.0D, 0.0D, 0.0D); var18.draw(); var19 = this.getContentHeight() - (this.bottom - this.top - 4); if (var19 > 0) { var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); if (var13 < 32) { var13 = 32; } if (var13 > this.bottom - this.top - 8) { var13 = this.bottom - this.top - 8; } var14 = (int) this.scrollDistance * (this.bottom - this.top - var13) / var19 + this.top; if (var14 < this.top) { var14 = this.top; } var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV((double) scrollBarXStart, (double) this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) this.bottom, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) scrollBarXStart, (double) this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(8421504, 255); var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) (var14 + var13), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(12632256, 255); var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13 - 1), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) (var14 + var13 - 1), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D); var18.draw(); } this.func_27257_b(mouseX, mouseY); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); }
From source file:colonialdisplay.AntDisplayGL.java
private void initTextures() { // enable alpha blending GL11.glEnable(GL11.GL_BLEND);// ww w . j ava2s.c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); tmap = new TextureMapper(); tmap.initSheet(this.getClass().getResource("/colonialimages/spritesheethighres_5_2_2014.png"), "PNG"); tmap.addSpriteLocation("sand", new Rectangle2D.Float(0f, .625f, .25f, .125f)); tmap.addSpriteLocation("leaf", new Rectangle2D.Float(.25f, .625f, .25f, .125f)); tmap.addSpriteLocation("stream", new Rectangle2D.Float(.5f, .5f, .25f, .125f)); tmap.addSpriteLocation("brownleaf", new Rectangle2D.Float(0f, .75f, .25f, .125f)); tmap.addSpriteLocation("redleaf", new Rectangle2D.Float(.25f, .75f, .25f, .125f)); tmap.addSpriteLocation("anthill", new Rectangle2D.Float(.25f, .5f, .25f, .125f)); tmap.addSpriteLocation("antNorth", new Rectangle2D.Float(.25f, 0, .25f, .125f)); tmap.addSpriteLocation("antNorthEast", new Rectangle2D.Float(0, .125f, .25f, .125f)); tmap.addSpriteLocation("antSouthEast", new Rectangle2D.Float(.25f, .125f, .25f, .125f)); tmap.addSpriteLocation("antSouth", new Rectangle2D.Float(.5f, 0, .25f, .125f)); tmap.addSpriteLocation("antSouthWest", new Rectangle2D.Float(.75f, 0, .25f, .125f)); tmap.addSpriteLocation("antEast", new Rectangle2D.Float(0, 0, .25f, .125f)); tmap.addSpriteLocation("antWest", new Rectangle2D.Float(.75f, .125f, .25f, .125f)); tmap.addSpriteLocation("antNorthWest", new Rectangle2D.Float(.25f, .125f, .25f, .125f)); tmap.addSpriteLocation("builderAntNorth", new Rectangle2D.Float(.5f, .625f, .25f, .125f)); tmap.addSpriteLocation("builderAntNorthEast", new Rectangle2D.Float(.75f, .5f, .25f, .125f)); tmap.addSpriteLocation("builderAntSouthEast", new Rectangle2D.Float(.25f, .875f, .25f, .125f)); tmap.addSpriteLocation("builderAntSouth", new Rectangle2D.Float(.5f, .75f, .25f, .125f)); tmap.addSpriteLocation("builderAntSouthWest", new Rectangle2D.Float(.5f, .875f, .25f, .125f)); tmap.addSpriteLocation("builderAntEast", new Rectangle2D.Float(0, .875f, .25f, .125f)); tmap.addSpriteLocation("builderAntWest", new Rectangle2D.Float(.75f, .75f, .25f, .125f)); tmap.addSpriteLocation("builderAntNorthWest", new Rectangle2D.Float(.75f, .625f, .25f, .125f)); tmap.addSpriteLocation("pheromoneReturn1", new Rectangle2D.Float(.25f, .375f, .25f, .125f)); tmap.addSpriteLocation("pheromoneReturn2", new Rectangle2D.Float(.5f, .375f, .25f, .125f)); tmap.addSpriteLocation("pheromoneReturn3", new Rectangle2D.Float(.75f, .25f, .25f, .125f)); tmap.addSpriteLocation("pheromoneReturn4", new Rectangle2D.Float(.75f, .375f, .25f, .125f)); tmap.addSpriteLocation("pheromoneFood1", new Rectangle2D.Float(0, .25f, .25f, .125f)); tmap.addSpriteLocation("pheromoneFood2", new Rectangle2D.Float(0, .375f, .25f, .125f)); tmap.addSpriteLocation("pheromoneFood3", new Rectangle2D.Float(.25f, .25f, .25f, .125f)); tmap.addSpriteLocation("pheromoneFood4", new Rectangle2D.Float(.5f, .25f, .25f, .125f)); tmap.addSpriteLocation("pheromoneNone", new Rectangle2D.Float(.75f, .875f, .25f, .125f)); tmap.addSpriteLocation("pheromoneDanger", new Rectangle2D.Float(0, .5f, .25f, .125f)); /* tmap.initSheet("src/colonialimages/spritesheet2.png", "PNG"); tmap.addSpriteLocation("sand", new Rectangle2D.Float(.5f,.5f,.25f,.25f)); tmap.addSpriteLocation("leaf", new Rectangle2D.Float(.25f,.5f,.25f,.25f)); tmap.addSpriteLocation("anthill", new Rectangle2D.Float(0,.5f,.25f,.25f)); tmap.addSpriteLocation("antNorth", new Rectangle2D.Float(.25f,0,.25f,.25f)); tmap.addSpriteLocation("antNorthEast", new Rectangle2D.Float(.5f,0,.25f,.25f)); tmap.addSpriteLocation("antSouthEast", new Rectangle2D.Float(.25f,.25f,.25f,.25f)); tmap.addSpriteLocation("antSouth", new Rectangle2D.Float(0,.25f,.25f,.25f)); tmap.addSpriteLocation("antSouthWest", new Rectangle2D.Float(.5f,.25f,.25f,.25f)); tmap.addSpriteLocation("antEast", new Rectangle2D.Float(0,0,.25f,.25f)); tmap.addSpriteLocation("antWest", new Rectangle2D.Float(.75f,.25f,.25f,.25f)); tmap.addSpriteLocation("antNorthWest", new Rectangle2D.Float(.75f,0,.25f,.25f)); tmap.addSpriteLocation("pheromoneReturn", new Rectangle2D.Float(.25f,.75f,.25f,.25f)); tmap.addSpriteLocation("pheromoneFood", new Rectangle2D.Float(0,.75f,.25f,.25f)); tmap.addSpriteLocation("pheromoneNone", new Rectangle2D.Float(.5f,.75f,.25f,.25f)); */ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:colonialdisplay.AntDisplayGL.java
private void drawForeGround() { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND);/* ww w . j a v a 2 s. com*/ ArrayList<Ant> ants = e.getTestAnts(); for (Ant ant : ants) { String r = ant.getTexture(); Rectangle bounds = ant.getScreenPosition(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, tmap.getSheetID()); drawTile(bounds, tmap.getSpriteLocation(r)); } }
From source file:com.a2client.corex.Render.java
License:Open Source License
static public void setBlendType(Const.BLEND_TYPE v) { // GL11.glDisable(GL11.GL_BLEND); if (blend_type != v) { if (blend_type == Const.BLEND_TYPE.btNone) GL11.glEnable(GL11.GL_BLEND); blend_type = v;/*from w w w . jav a 2 s . c o m*/ switch (v) { case btNormal: GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); break; case btAdd: GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); break; case btMult: GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_COLOR); break; default: GL11.glDisable(GL11.GL_BLEND); } } }
From source file:com.aelitis.azureus.plugins.view3d.ViewTest2.java
License:Open Source License
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite comp = new Composite(shell, SWT.NONE); comp.setLayout(new FillLayout()); GLData data = new GLData(); data.doubleBuffer = true;/* www . jav a 2s .c o m*/ data.accumAlphaSize = 8; data.accumBlueSize = 8; data.accumGreenSize = 8; data.accumRedSize = 8; final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } canvas.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glViewport(0, 0, bounds.width, bounds.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); } }); GL11.glLineWidth(1); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glShadeModel(GL11.GL_FLAT); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearAccum(0.0f, 0.0f, 0.0f, 0.0f); shell.setText("SWT/LWJGL Example"); shell.setSize(640, 480); shell.open(); final Runnable run = new Runnable() { float rot = 0; public void run() { if (!canvas.isDisposed()) { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } int ACSIZE = 8; int[] viewport = getViewport(); GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT); for (int jitter = 0; jitter < ACSIZE; jitter++) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); double jit_x = jits[jitter][0]; double jit_y = jits[jitter][1]; accPerspective(50.0, (double) viewport[2] / (double) viewport[3], 1.0, 15.0, jit_x, jit_y, 0.0, 0.0, 1.0); { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(.3f, .5f, .8f, 1.0f); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GL11.glColor3f(0.9f, 0.9f, 0.9f); drawCylinder(2, 3, 50, 0); drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); } GL11.glAccum(GL11.GL_ACCUM, 1.0f / ACSIZE); } GL11.glAccum(GL11.GL_RETURN, 1.0f); GL11.glFlush(); rot += 0.1; canvas.swapBuffers(); display.asyncExec(this); } } }; canvas.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { run.run(); } }); display.asyncExec(run); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:com.ardor3d.scene.state.lwjgl.LwjglBlendStateUtil.java
License:Open Source License
protected static void applyBlendFunctions(final boolean enabled, final BlendState state, final BlendStateRecord record, final ContextCapabilities caps) { if (record.isValid()) { if (enabled) { final int glSrcRGB = getGLSrcValue(state.getSourceFunctionRGB(), caps); final int glDstRGB = getGLDstValue(state.getDestinationFunctionRGB(), caps); if (caps.isSeparateBlendFunctionsSupported()) { final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); if (record.srcFactorRGB != glSrcRGB || record.dstFactorRGB != glDstRGB || record.srcFactorAlpha != glSrcAlpha || record.dstFactorAlpha != glDstAlpha) { EXTBlendFuncSeparate.glBlendFuncSeparateEXT(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); record.srcFactorRGB = glSrcRGB; record.dstFactorRGB = glDstRGB; record.srcFactorAlpha = glSrcAlpha; record.dstFactorAlpha = glDstAlpha; }//from w ww . java 2 s . c om } else if (record.srcFactorRGB != glSrcRGB || record.dstFactorRGB != glDstRGB) { GL11.glBlendFunc(glSrcRGB, glDstRGB); record.srcFactorRGB = glSrcRGB; record.dstFactorRGB = glDstRGB; } } } else { if (enabled) { final int glSrcRGB = getGLSrcValue(state.getSourceFunctionRGB(), caps); final int glDstRGB = getGLDstValue(state.getDestinationFunctionRGB(), caps); if (caps.isSeparateBlendFunctionsSupported()) { final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); EXTBlendFuncSeparate.glBlendFuncSeparateEXT(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); record.srcFactorRGB = glSrcRGB; record.dstFactorRGB = glDstRGB; record.srcFactorAlpha = glSrcAlpha; record.dstFactorAlpha = glDstAlpha; } else { GL11.glBlendFunc(glSrcRGB, glDstRGB); record.srcFactorRGB = glSrcRGB; record.dstFactorRGB = glDstRGB; } } } }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java
License:Apache License
public void glBlendFunc(int sfactor, int dfactor) { GL11.glBlendFunc(sfactor, dfactor); }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java
License:Apache License
public final void glBlendFunc(int sfactor, int dfactor) { GL11.glBlendFunc(sfactor, dfactor); }
From source file:com.blogspot.jabelarminecraft.magicbeans.renderers.RenderMysteriousStranger.java
License:Open Source License
@Override public void passSpecialRender(EntityLivingBase parEntity, double parX, double parY, double parZ) { super.passSpecialRender(parEntity, parX, parY, parZ); if (parEntity.ticksExisted < 20 * 2) { GL11.glPushMatrix();//from w w w. j av a 2 s . com GL11.glTranslated(parX, parY + parEntity.height / 2, parZ); GL11.glScalef(3.0F, 3.0F, 3.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, (40.0F - parEntity.ticksExisted) / 40.0F); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glCallList(ClientProxy.sphereIdOutside); GL11.glCallList(ClientProxy.sphereIdInside); GL11.glPopMatrix(); } }
From source file:com.bluepowermod.client.render.RenderLamp.java
License:Open Source License
/******* TESR ***********/ @Override// www .ja v a 2 s. c o m public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { if (pass != 0) { BlockLamp bLamp = (BlockLamp) te.getBlockType(); int power = ((TileLamp) te).getPower(); int color = bLamp.getColor(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); int redMask = 0xFF0000, greenMask = 0xFF00, blueMask = 0xFF; int r = (color & redMask) >> 16; int g = (color & greenMask) >> 8; int b = (color & blueMask); if (bLamp.isInverted()) { power = 15 - power; } // power = 15; Vec3i vector = new Vec3i(te); Vec3dCube box = new Vec3dCube(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5).expand(0.8 / 16D); boolean[] renderFaces = new boolean[] { true, true, true, true, true, true }; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { Vec3i v = vector.getRelative(d); Block bl = v.getBlock(); if (bl instanceof BlockLamp && ((BlockLamp) bl).getPower(v.getWorld(), v.getX(), v.getY(), v.getZ()) > 0) { if (d.offsetX < 0) { box.getMin().setX(-0.5); renderFaces[2] = false; } else if (d.offsetY < 0) { box.getMin().setY(-0.5); renderFaces[1] = false; } else if (d.offsetZ < 0) { box.getMin().setZ(-0.5); renderFaces[4] = false; } else if (d.offsetX > 0) { box.getMax().setX(0.5); renderFaces[3] = false; } else if (d.offsetY > 0) { box.getMax().setY(0.5); renderFaces[0] = false; } else if (d.offsetZ > 0) { box.getMax().setZ(0.5); renderFaces[5] = false; } } } box.getMin().add(0.5, 0.5, 0.5); box.getMax().add(0.5, 0.5, 0.5); GL11.glTranslated(x, y, z); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); // GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBegin(GL11.GL_QUADS); double powerDivision = power / 18D; com.bluepowermod.client.render.RenderHelper.drawColoredCube(box, r / 256D, g / 256D, b / 256D, powerDivision * 0.625D, renderFaces); GL11.glEnd(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); GL11.glTranslated(-x, -y, -z); } }