List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void fillRectangle(double x, double y, double width, double height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*from ww w.j a v a 2 s . c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2d(x, y); GL11.glVertex2d(x, y + height); GL11.glVertex2d(x + width, y + height); GL11.glVertex2d(x + width, y); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawRectangle(double x, double y, double width, double height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/* w w w .j av a 2 s. c om*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_LINES); { GL11.glVertex2d(x, y); GL11.glVertex2d(x, y + height); GL11.glVertex2d(x, y + height); GL11.glVertex2d(x + width, y + height); GL11.glVertex2d(x + width, y + height); GL11.glVertex2d(x + width, y); GL11.glVertex2d(x + width, y); GL11.glVertex2d(x, y); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawTexture(Texture texture, double x, double y, double width, double height) { GL11.glEnable(GL11.GL_TEXTURE_2D);// w w w . ja va 2 s . c o m GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 1); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(0, 0); GL11.glVertex2d(x, y); GL11.glTexCoord2f(0, texture.getHeight()); GL11.glVertex2d(x, y + height); GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.glVertex2d(x + width, y + height); GL11.glTexCoord2f(texture.getWidth(), 0); GL11.glVertex2d(x + width, y); } GL11.glEnd(); modInterface.bindMinecraftTextures(); }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static void glBegin(int geomType) { GL11.glBegin(geomType); }
From source file:itdelatrisu.opsu.render.CurveRenderState.java
License:Open Source License
/** * Draw a curve to the screen that's tinted with `color`. The first time * this is called this caches the image result of the curve and on subsequent * runs it just draws the cached copy to the screen. * @param color tint of the curve//from w w w .j a va 2s . c om * @param borderColor the curve border color * @param curve the points along the curve to be drawn */ public void draw(Color color, Color borderColor, Vec2f[] curve) { float alpha = color.a; // if this curve hasn't been drawn, draw it and cache the result if (fbo == null) { FrameBufferCache cache = FrameBufferCache.getInstance(); Rendertarget mapping = cache.get(hitObject); if (mapping == null) mapping = cache.insert(hitObject); fbo = mapping; int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT); int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); //glGetInteger requires a buffer of size 16, even though just 4 //values are returned in this specific case IntBuffer oldViewport = BufferUtils.createIntBuffer(16); GL11.glGetInteger(GL11.GL_VIEWPORT, oldViewport); EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo.getID()); GL11.glViewport(0, 0, fbo.width, fbo.height); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); Colors.WHITE_FADE.a = 1.0f; this.draw_curve(color, borderColor, curve); color.a = 1f; GL11.glBindTexture(GL11.GL_TEXTURE_2D, oldTex); EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, oldFb); GL11.glViewport(oldViewport.get(0), oldViewport.get(1), oldViewport.get(2), oldViewport.get(3)); Colors.WHITE_FADE.a = alpha; } // draw a fullscreen quad with the texture that contains the curve GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_1D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.getTextureID()); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha); GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex2i(fbo.width, 0); GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex2i(0, fbo.height); GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex2i(fbo.width, fbo.height); GL11.glEnd(); }
From source file:itemrender.client.RenderTickHandler.java
License:MIT License
@SubscribeEvent public void tick(TickEvent.RenderTickEvent event) { if (event.phase == TickEvent.Phase.END) if (keybindToRender != null && renderPreview) { int originalTexture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); // Bind framebuffer texture keybindToRender.fbo.bind();/*from ww w .ja v a2 s. co m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(0, 128); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(128, 128); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(128, 0); GL11.glEnd(); // Restore old texture GlStateManager.bindTexture(originalTexture); } }
From source file:kinect.KinectModule.java
License:Open Source License
/** * Mthode de dessin de cercle OPenGL//from www .j a v a2s .c o m * @param userID l'ID de l'utilisateur * @param joint la position du joint dessiner */ private void drawCircle(int userID, SkeletonJoint joint) { SkeletonJointPosition pos = joints.get(userID).get(joint); Vec2 position = new Vec2(pos.getPosition().getX(), Display.getHeight() - pos.getPosition().getY()); float radius = 5; GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex2f(position.x, position.y); float angle = 0.0f; for (angle = 0; angle < 2.0 * Math.PI + 0.0001;) { float xpos = (float) (position.x + Math.cos(angle) * radius); float ypos = (float) (position.y + Math.sin(angle) * radius); GL11.glVertex2f(xpos, ypos); angle += 2.0 * Math.PI / 20; } GL11.glEnd(); }
From source file:kuake2.render.lwjgl.Draw.java
License:Open Source License
protected void Draw_Char(int x, int y, int num) { num &= 255;//from w ww . j a v a 2 s . c om if ((num & 127) == 32) return; // space if (y <= -8) return; // totally off screen int row = num >> 4; int col = num & 15; float frow = row * 0.0625f; float fcol = col * 0.0625f; float size = 0.0625f; GL_Bind(draw_chars.texnum); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(fcol, frow); GL11.glVertex2f(x, y); GL11.glTexCoord2f(fcol + size, frow); GL11.glVertex2f(x + 8, y); GL11.glTexCoord2f(fcol + size, frow + size); GL11.glVertex2f(x + 8, y + 8); GL11.glTexCoord2f(fcol, frow + size); GL11.glVertex2f(x, y + 8); GL11.glEnd(); }
From source file:kuake2.render.lwjgl.Draw.java
License:Open Source License
protected void Draw_StretchPic(int x, int y, int w, int h, String pic) { image_t image;//from w w w . j a v a 2s . c o m image = Draw_FindPic(pic); if (image == null) { VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } if (scrap_dirty) Scrap_Upload(); if (((gl_config.renderer == GL_RENDERER_MCD) || ((gl_config.renderer & GL_RENDERER_RENDITION) != 0)) && !image.has_alpha) GL11.glDisable(GL11.GL_ALPHA_TEST); GL_Bind(image.texnum); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(image.sl, image.tl); GL11.glVertex2f(x, y); GL11.glTexCoord2f(image.sh, image.tl); GL11.glVertex2f(x + w, y); GL11.glTexCoord2f(image.sh, image.th); GL11.glVertex2f(x + w, y + h); GL11.glTexCoord2f(image.sl, image.th); GL11.glVertex2f(x, y + h); GL11.glEnd(); if (((gl_config.renderer == GL_RENDERER_MCD) || ((gl_config.renderer & GL_RENDERER_RENDITION) != 0)) && !image.has_alpha) GL11.glEnable(GL11.GL_ALPHA_TEST); }
From source file:kuake2.render.lwjgl.Draw.java
License:Open Source License
protected void Draw_Pic(int x, int y, String pic) { image_t image;// w w w .ja va2 s. co m image = Draw_FindPic(pic); if (image == null) { VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } if (scrap_dirty) Scrap_Upload(); if (((gl_config.renderer == GL_RENDERER_MCD) || ((gl_config.renderer & GL_RENDERER_RENDITION) != 0)) && !image.has_alpha) GL11.glDisable(GL11.GL_ALPHA_TEST); GL_Bind(image.texnum); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(image.sl, image.tl); GL11.glVertex2f(x, y); GL11.glTexCoord2f(image.sh, image.tl); GL11.glVertex2f(x + image.width, y); GL11.glTexCoord2f(image.sh, image.th); GL11.glVertex2f(x + image.width, y + image.height); GL11.glTexCoord2f(image.sl, image.th); GL11.glVertex2f(x, y + image.height); GL11.glEnd(); if (((gl_config.renderer == GL_RENDERER_MCD) || ((gl_config.renderer & GL_RENDERER_RENDITION) != 0)) && !image.has_alpha) GL11.glEnable(GL11.GL_ALPHA_TEST); }