List of usage examples for org.lwjgl.opengl GL11 glScissor
public static void glScissor(@NativeType("GLint") int x, @NativeType("GLint") int y, @NativeType("GLsizei") int width, @NativeType("GLsizei") int height)
From source file:net.mechanicalcat.pycode.gui.GuiTextArea.java
License:Open Source License
public void drawEditor() { String content = getString(); // first up, determine the scroll offset int xoff = textXOffset / SCROLL_SCALE; int yoff = textYOffset / SCROLL_SCALE; if (yoff > 0) { yoff = 0;/*from ww w .j a v a 2 s . c o m*/ textYOffset = 0; } else { int totHeight = -this.fontRenderer.FONT_HEIGHT * this.lines.length; if (totHeight < height && yoff < totHeight + height) { yoff = totHeight + height; textYOffset = yoff * SCROLL_SCALE; } } if (xoff < 0) { xoff = 0; textXOffset = 0; } else { int maxWidth = 0; for (String line : this.lines) { int w = this.fontRenderer.getStringWidth(line); if (w > maxWidth) maxWidth = w; } if (maxWidth > width && xoff > maxWidth - width) { xoff = maxWidth - width; textXOffset = xoff * SCROLL_SCALE; } } // offset rendering by the scroll offset GlStateManager.pushMatrix(); GlStateManager.translate(-xoff, yoff, 0); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor(xScissor, yScissor, wScissor, hScissor); // draw cursor int cursorPos; if (this.cursorRow == this.lines.length) { cursorPos = 0; // current line is empty } else { cursorPos = this.fontRenderer .getStringWidth(this.lines[this.cursorRow].substring(0, this.cursorColumn)); } int cursor_x = this.xPosition + cursorPos; int cursor_y = this.yPosition + this.cursorRow * this.fontRenderer.FONT_HEIGHT + 1; if (this.cursorCounter / 6 % 2 == 0) { this.fontRenderer.drawString("_", cursor_x, cursor_y, 0); } else { this.fontRenderer.drawString("_", cursor_x, cursor_y, 0x55000000); } // draw content int x = this.xPosition; int y = this.yPosition; for (String s : this.lines) { this.fontRenderer.drawString(s, x, y, 0); y += this.fontRenderer.FONT_HEIGHT; } // reset state GlStateManager.popMatrix(); GL11.glPopAttrib(); }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 scissor(int x, int y, int width, int height) { GL11.glScissor(x, y, width, height); return this; }
From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java
License:Open Source License
public void setScissor(int x, int width, int y, int height) { GL11.glScissor(x, y, width, height); }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_SetupFrame/*from ww w . j a va 2s .c om*/ */ void R_SetupFrame() { r_framecount++; // build the transformation matrix for the given view angles Math3D.VectorCopy(r_newrefdef.vieworg, r_origin); Math3D.AngleVectors(r_newrefdef.viewangles, vpn, vright, vup); // current viewcluster mleaf_t leaf; if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) { r_oldviewcluster = r_viewcluster; r_oldviewcluster2 = r_viewcluster2; leaf = Mod_PointInLeaf(r_origin, r_worldmodel); r_viewcluster = r_viewcluster2 = leaf.cluster; // check above and below so crossing solid water doesn't draw wrong if (leaf.contents == 0) { // look down a bit Math3D.VectorCopy(r_origin, temp); temp[2] -= 16; leaf = Mod_PointInLeaf(temp, r_worldmodel); if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2)) { r_viewcluster2 = leaf.cluster; } } else { // look up a bit Math3D.VectorCopy(r_origin, temp); temp[2] += 16; leaf = Mod_PointInLeaf(temp, r_worldmodel); if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2)) { r_viewcluster2 = leaf.cluster; } } } System.arraycopy(r_newrefdef.blend, 0, v_blend, 0, 4); c_brush_polys = 0; c_alias_polys = 0; // clear out the portion of the screen that the NOWORLDMODEL defines if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) { GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glClearColor(0.3f, 0.3f, 0.3f, 1.0f); GL11.glScissor(r_newrefdef.x, vid.height - r_newrefdef.height - r_newrefdef.y, r_newrefdef.width, r_newrefdef.height); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(1.0f, 0.0f, 0.5f, 0.5f); GL11.glDisable(GL11.GL_SCISSOR_TEST); } }
From source file:org.jogamp.glg2d.GLGraphics2D.java
License:Apache License
protected void scissor(boolean enable) { if (enable) { GL11.glScissor(clip.x, canvasHeight - clip.y - clip.height, Math.max(clip.width, 0), Math.max(clip.height, 0)); GL11.glEnable(GL11.GL_SCISSOR_TEST); } else {//from ww w .ja v a 2s . c om clip = null; GL11.glDisable(GL11.GL_SCISSOR_TEST); } }
From source file:org.oscim.gdx.LwjglGL20.java
License:Apache License
public void scissor(int x, int y, int width, int height) { GL11.glScissor(x, y, width, height); }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
private void scissorWidget(Widget widget) { double x = widget.getActualX() + widget.getWidth(), y = widget.getActualY() + widget.getHeight(), width = widget.getWidth(), height = widget.getHeight(); double screenHeight; screenHeight = getScreenHeight();/*from ww w . ja va 2s . co m*/ int windowWidth = SpoutClient.getHandle().displayWidth, windowHeight = SpoutClient.getHandle().displayHeight; ScaledResolution scale = new ScaledResolution(SpoutClient.getHandle().gameSettings, windowWidth, windowHeight); double scaleFactor = scale.getScaleFactor(); height = height * scaleFactor; width = width * scaleFactor; x *= scaleFactor; y *= scaleFactor; screenHeight *= scaleFactor; x = x - width; y = screenHeight - y; GL11.glScissor((int) x, (int) y, (int) width, (int) height); }
From source file:processing.lwjgl.PGL.java
License:Open Source License
public void scissor(int x, int y, int w, int h) { GL11.glScissor(x, y, w, h); }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void scissor(int x, int y, int w, int h) { float f = Display.getPixelScaleFactor(); GL11.glScissor((int) (f * x), (int) (f * y), (int) f * w, (int) (f * h)); }
From source file:src.graphics.widgets.Text.java
License:Open Source License
/** Draws this text object. *//* w w w .ja v a2s .c o m*/ protected void render() { if (allEntries.size() == 0) return; // // First, determine a 'viewing window' for the text, if larger than the // visible pane- final Box2D textArea = new Box2D().set(0, 0, xdim(), ydim()); if (scrollbar != null) { final float lineHigh = 0;// alphabet.map[' '].height * scale ; textArea.ypos((0 - lineHigh) - (fullSize.ydim() - ydim()) * (1 - scrollbar.scrollPos())); } // // See what was clicked, if anything- // TODO: Move this to the selection method? final Clickable link = getTextLink(myHUD.mousePos(), textArea); final Batch<ImageEntry> bullets = new Batch<ImageEntry>(); // // Begin the rendering pass... alphabet.fontTex.bindTex(); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor((int) xpos(), (int) ypos(), (int) xdim(), (int) ydim()); GL11.glBegin(GL11.GL_QUADS); for (Box2D entry : allEntries) { if (entry instanceof TextEntry) { renderText(textArea, (TextEntry) entry, link); } else bullets.add((ImageEntry) entry); } GL11.glEnd(); for (ImageEntry entry : bullets) { renderImage(textArea, entry); } GL11.glDisable(GL11.GL_SCISSOR_TEST); // TODO: Move this to the selection method? if (myHUD.mouseClicked() && link != null) link.whenClicked(); }