Java Code Examples for org.lwjgl.opengl.GL11#glColorMask()
The following examples show how to use
org.lwjgl.opengl.GL11#glColorMask() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: vboWithRGBA.java From ldparteditor with MIT License | 6 votes |
@Override public void drawScene(float mouseX, float mouseY) { final GLCanvas canvas = cp.getCanvas(); if (!canvas.isCurrent()) { canvas.setCurrent(); GL.setCapabilities(cp.getCapabilities()); } GL11.glColorMask(true, true, true, true); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT); Rectangle bounds = cp.getBounds(); GL11.glViewport(0, 0, bounds.width, bounds.height); shaderProgram.use(); GL30.glBindVertexArray(VAO); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3); GL30.glBindVertexArray(0); canvas.swapBuffers(); }
Example 2
Source File: vboWithIndices.java From ldparteditor with MIT License | 6 votes |
@Override public void drawScene(float mouseX, float mouseY) { final GLCanvas canvas = cp.getCanvas(); if (!canvas.isCurrent()) { canvas.setCurrent(); GL.setCapabilities(cp.getCapabilities()); } GL11.glColorMask(true, true, true, true); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT); Rectangle bounds = cp.getBounds(); GL11.glViewport(0, 0, bounds.width, bounds.height); shaderProgram.use(); GL30.glBindVertexArray(VAO); // GL20.glEnableVertexAttribArray(POSITION_SHADER_LOCATION); // <-- Not necessary! GL11.glDrawElements(GL11.GL_TRIANGLES, 6, GL11.GL_UNSIGNED_INT, 0); // GL20.glDisableVertexAttribArray(POSITION_SHADER_LOCATION); // <-- Not necessary! GL30.glBindVertexArray(0); canvas.swapBuffers(); }
Example 3
Source File: CurveRenderState.java From opsu with GNU General Public License v3.0 | 5 votes |
/** * Do the actual drawing of the curve into the currently bound framebuffer. * @param color the color of the curve * @param borderColor the curve border color */ private void renderCurve(Color color, Color borderColor, int to) { staticState.initGradient(); RenderState state = saveRenderState(); staticState.initShaderProgram(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID); GL20.glUseProgram(staticState.program); GL20.glEnableVertexAttribArray(staticState.attribLoc); GL20.glEnableVertexAttribArray(staticState.texCoordLoc); GL20.glUniform1i(staticState.texLoc, 0); GL20.glUniform4f(staticState.colLoc, color.r, color.g, color.b, color.a); GL20.glUniform4f(staticState.colBorderLoc, borderColor.r, borderColor.g, borderColor.b, borderColor.a); float lastSegmentX = to == 0 ? curve[1].x - curve[0].x : curve[to].x - curve[to-1].x; float lastSegmentY = to == 0 ? curve[1].y - curve[0].y : curve[to].y - curve[to-1].y; float lastSegmentInvLen = 1.f/(float)Math.hypot(lastSegmentX, lastSegmentY); GL20.glUniform4f(staticState.endPointLoc, curve[to].x, curve[to].y, lastSegmentX * lastSegmentInvLen, lastSegmentY * lastSegmentInvLen); //stride is 6*4 for the floats (4 bytes) (u,v)(x,y,z,w) //2*4 is for skipping the first 2 floats (u,v) GL20.glVertexAttribPointer(staticState.attribLoc, 4, GL11.GL_FLOAT, false, 6 * 4, 2 * 4); GL20.glVertexAttribPointer(staticState.texCoordLoc, 2, GL11.GL_FLOAT, false, 6 * 4, 0); GL11.glColorMask(false,false,false,false); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, pointIndices[to]); GL11.glColorMask(true,true,true,true); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, pointIndices[to]); GL11.glDepthFunc(GL11.GL_LESS); GL11.glFlush(); GL20.glDisableVertexAttribArray(staticState.texCoordLoc); GL20.glDisableVertexAttribArray(staticState.attribLoc); restoreRenderState(state); }
Example 4
Source File: LwjglRasteriser.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void resetState() { GL11.glColorMask(true, true, true, true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glFrontFace(GL11.GL_CW); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); }
Example 5
Source File: Render.java From mapwriter with MIT License | 5 votes |
public static void setCircularStencil(double x, double y, double r) { GL11.glEnable(GL11.GL_DEPTH_TEST); // disable drawing to the color buffer. // circle will only be drawn to depth buffer. GL11.glColorMask(false, false, false, false); // enable writing to depth buffer GL11.glDepthMask(true); // Clearing the depth buffer causes problems with shader mods. // I guess we just have to hope that the rest of the depth buffer // contains z values greater than 2000 at this stage in the frame // render. // It would be much easier to use the stencil buffer instead, but it is // not specifically requested in the Minecraft LWJGL display setup code. // So the stencil buffer is only available on GL implementations that // set it up by default. // clear depth buffer to z = 3000.0 //GL11.glClearDepth(3000.0); //GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); // always write to depth buffer GL11.glDepthFunc(GL11.GL_ALWAYS); // draw stencil pattern (filled circle at z = 1000.0) Render.setColour(0xffffffff); Render.zDepth = 1000.0; Render.drawCircle(x, y, r); Render.zDepth = 0.0; // re-enable drawing to colour buffer GL11.glColorMask(true, true, true, true); // disable drawing to depth buffer GL11.glDepthMask(false); // only draw pixels with z values that are greater // than the value in the depth buffer. // The overlay is drawn at 2000 so this will pass inside // the circle (2000 > 1000) but not outside (2000 <= 3000). GL11.glDepthFunc(GL11.GL_GREATER); }
Example 6
Source File: OnlineCraft.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
@Override public void drawScreen(int x, int y, float partialTicks) { craftButton.enabled = stacks[9] != null; super.drawScreen(x, y, partialTicks); GL11.glPushMatrix(); RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stacks[i + j * 3], this.guiLeft + 41 + i * 18, this.guiTop + 17 + j * 18); itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stacks[i + j * 3], this.guiLeft + 41 + i * 18, this.guiTop + 17 + j * 18, ""); } } if (stacks[9] != null) { itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stacks[9], this.guiLeft + 135, this.guiTop + 21); itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stacks[9], this.guiLeft + 135, this.guiTop + 21, stacks[9].stackSize > 1 ? String.valueOf(stacks[9].stackSize) : ""); } RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); ItemStack itemStack = null; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (this.guiLeft + 40 + i * 18 <= x && this.guiTop + 16 + j * 18 <= y && this.guiLeft + 40 + i * 18 + 18 > x && this.guiTop + 16 + j * 18 + 18 > y) { GL11.glColorMask(true, true, true, false); this.drawGradientRect(this.guiLeft + 40 + i * 18 + 1, this.guiTop + 16 + j * 18 + 1, this.guiLeft + 40 + i * 18 + 16 + 1, this.guiTop + 16 + j * 18 + 16 + 1, -2130706433, -2130706433); GL11.glColorMask(true, true, true, true); itemStack = stacks[i + j * 3]; } } } craftButton.drawButton(mc, x, y); if (itemStack != null && Wrapper.INSTANCE.player().inventory.getItemStack() == null) { this.renderToolTip(itemStack, x, y); } ItemStack itemstack = Wrapper.INSTANCE.player().inventory.getItemStack(); if (itemstack != null) { String s = ""; if (itemstack.stackSize > 1) { s = "" + itemstack.stackSize; } GL11.glPushMatrix(); RenderHelper.enableGUIStandardItemLighting(); this.drawItemStack(itemstack, x - 8, y - 8, s); GL11.glPopMatrix(); } }
Example 7
Source File: OpenGLHelper.java From Et-Futurum with The Unlicense | 4 votes |
public static void colorMask(boolean r, boolean g, boolean b, boolean a) { GL11.glColorMask(r, g, b, a); }
Example 8
Source File: LwjglRasteriser.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void enableColourWriting(final boolean colourMask, final boolean alphaMask) { GL11.glColorMask(colourMask, colourMask, colourMask, alphaMask); }
Example 9
Source File: ImmediateModeOGLRenderer.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.opengl.renderer.SGL#glColorMask(boolean, boolean, boolean, boolean) */ public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) { GL11.glColorMask(red, green, blue, alpha); }