List of usage examples for org.lwjgl.opengl GL11 glOrtho
public static native void glOrtho(@NativeType("GLdouble") double l, @NativeType("GLdouble") double r, @NativeType("GLdouble") double b, @NativeType("GLdouble") double t, @NativeType("GLdouble") double n, @NativeType("GLdouble") double f);
(lb – n)T
and (rt – n)T
specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, respectively (assuming that the eye is located at (0 0 0)T
). From source file:lwjake2.render.lwjgl.Main.java
License:Open Source License
/** * R_BeginFrame/*www . ja v a 2 s .c o m*/ */ protected void R_BeginFrame(float camera_separation) { gl_state.camera_separation = camera_separation; /* ** change modes if necessary */ if (gl_mode.modified || vid_fullscreen.modified) { // FIXME: only restart if CDS is required cvar_t ref; ref = Cvar.Get("vid_ref", "lwjgl", 0); ref.modified = true; } if (gl_log.modified) { GLimp_EnableLogging((gl_log.value != 0.0f)); gl_log.modified = false; } if (gl_log.value != 0.0f) { GLimp_LogNewFrame(); } /* ** update 3Dfx gamma -- it is expected that a user will do a vid_restart ** after tweaking this value */ if (vid_gamma.modified) { vid_gamma.modified = false; if ((gl_config.renderer & GL_RENDERER_VOODOO) != 0) { // wird erstmal nicht gebraucht /* char envbuffer[1024]; float g; g = 2.00 * ( 0.8 - ( vid_gamma->value - 0.5 ) ) + 1.0F; Com_sprintf( envbuffer, sizeof(envbuffer), "SSTV2_GAMMA=%f", g ); putenv( envbuffer ); Com_sprintf( envbuffer, sizeof(envbuffer), "SST_GAMMA=%f", g ); putenv( envbuffer ); */ VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); } } GLimp_BeginFrame(camera_separation); /* ** go into 2D mode */ GL11.glViewport(0, 0, vid.width, vid.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, vid.width, vid.height, 0, -99999, 99999); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1, 1, 1, 1); /* ** draw buffer stuff */ if (gl_drawbuffer.modified) { gl_drawbuffer.modified = false; if (gl_state.camera_separation == 0 || !gl_state.stereo_enabled) { if (gl_drawbuffer.string.equalsIgnoreCase("GL_FRONT")) GL11.glDrawBuffer(GL11.GL_FRONT); else GL11.glDrawBuffer(GL11.GL_BACK); } } /* ** texturemode stuff */ if (gl_texturemode.modified) { GL_TextureMode(gl_texturemode.string); gl_texturemode.modified = false; } if (gl_texturealphamode.modified) { GL_TextureAlphaMode(gl_texturealphamode.string); gl_texturealphamode.modified = false; } if (gl_texturesolidmode.modified) { GL_TextureSolidMode(gl_texturesolidmode.string); gl_texturesolidmode.modified = false; } /* ** swapinterval stuff */ GL_UpdateSwapInterval(); // // clear screen if desired // R_Clear(); }
From source file:lwjgl29.GlobalClass.Quad.java
@Override public void init() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/*from w w w.j ava 2s .com*/ GL11.glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:lyonlancer5.xatrocore.lib.internal.MCv18.java
License:Open Source License
@SideOnly(Side.CLIENT) protected static void drawSplashScreen(Minecraft mcIn, TextureManager textureManager) { ScaledResolution scaledresolution = new ScaledResolution(mcIn, mcIn.displayWidth, mcIn.displayHeight); int i = scaledresolution.getScaleFactor(); Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true); framebuffer.bindFramebuffer(false);/*from w ww .j av a 2 s .c o m*/ //GlStateManager.matrixMode(5889); GL11.glMatrixMode(5889); //GlStateManager.loadIdentity(); GL11.glLoadIdentity(); //GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); GL11.glOrtho(0.0D, (double) scaledresolution.getScaledWidth(), (double) scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); //GlStateManager.matrixMode(5888); GL11.glMatrixMode(5888); //GlStateManager.loadIdentity(); GL11.glLoadIdentity(); //GlStateManager.translate(0.0F, 0.0F, -2000.0F); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); //GlStateManager.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //GlStateManager.disableFog(); GL11.glDisable(GL11.GL_FOG); //GlStateManager.disableDepth(); GL11.glDisable(GL11.GL_DEPTH); //GlStateManager.enableTexture2D(); GL11.glEnable(GL11.GL_TEXTURE_2D); InputStream inputstream = null; try { //inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng); inputstream = mcIn.getResourcePackRepository().rprDefaultResourcePack.getInputStream(locationMojangPng); mojangLogo = textureManager.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream))); textureManager.bindTexture(mojangLogo); } catch (IOException ioexception) { //logger.error("Unable to load logo: " + locationMojangPng, ioexception); } finally { IOUtils.closeQuietly(inputstream); } Tessellator tessellator = Tessellator.instance; //WorldRenderer worldrenderer = tessellator.getWorldRenderer(); //worldrenderer.startDrawingQuads(); tessellator.startDrawingQuads(); //worldrenderer.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(16777215); //worldrenderer.addVertexWithUV(0.0D, (double)mcIn.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, (double) mcIn.displayHeight, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV((double)mcIn.displayWidth, (double)mcIn.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV((double) mcIn.displayWidth, (double) mcIn.displayHeight, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV((double) mcIn.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.draw(); //GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //worldrenderer.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(16777215); short short1 = 256; short short2 = 256; mcIn.scaledTessellator((scaledresolution.getScaledWidth() - short1) / 2, (scaledresolution.getScaledHeight() - short2) / 2, 0, 0, short1, short2); //GlStateManager.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //GlStateManager.disableFog(); GL11.glDisable(GL11.GL_FOG); framebuffer.unbindFramebuffer(); framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i); //GlStateManager.enableAlpha(); GL11.glEnable(GL11.GL_ALPHA); //GlStateManager.alphaFunc(516, 0.1F); GL11.glAlphaFunc(516, 0.1F); updateDisplay(mcIn); }
From source file:Main.Graphics.GameObject.java
public static void initGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:map.GameMap.java
License:Open Source License
private void renderMinimap() { int size = MINIMAP_SIZE; Texture tex = new Texture("ground"); miniMap = new Material(name + "_minimap"); int[] viewport = GLUtils.getViewport(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();// w ww . ja v a 2 s. c o m GL11.glOrtho(0, size, size, 0, -10, 10); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glViewport(0, 0, size, size); GL11.glClearColor(0.0f, 0, 0, 1.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glScalef(size / tiles.length, size / tiles.length, size / tiles.length); GLUtils.glLightPos(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); draw(null); GL11.glEnable(GL11.GL_CULL_FACE); IntBuffer addr = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(addr); tex.setID(addr.get(0)); GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, size, size, 0); miniMap.setTexture(0, tex); GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); }
From source file:mcp.mobius.waila.gui.truetyper.FontHelper.java
License:Open Source License
private static void set2DMode(FloatBuffer matrixData) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); mc.entityRenderer.setupOverlayRendering(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();/*from ww w .java 2s . c om*/ //GL11.glLoadMatrix(matrixData); GL11.glLoadIdentity(); GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); Matrix4f matrix = new Matrix4f(); matrix.load(matrixData); GL11.glTranslatef(matrix.m30 * sr.getScaleFactor(), -matrix.m31 * sr.getScaleFactor(), 0f); }
From source file:mss.View.java
License:Open Source License
private void initOpenGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadMatrix(this.buffer); GL11.glOrtho(-100, 100, -100, 100, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND);/* w ww. ja v a 2 s . co m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }
From source file:myfirstgame.Window.java
public void init(int width, int height) { Window.width = width;/*from www . j av a2s. c o m*/ Window.height = height; try { //Look for a displaymode with matching width and height that supports fullscreen, set it to the displaymode we want to use. DisplayMode displayMode = null; DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = 0; i < modes.length; i++) { if (modes[i].getWidth() == width && modes[i].getHeight() == height && modes[i].isFullscreenCapable()) { displayMode = modes[i]; } } Display.setDisplayMode(displayMode); Display.setFullscreen(true); Display.create(); } catch (Exception e) { e.printStackTrace(); System.exit(0); } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); try { Mouse.create(); Keyboard.create(); } catch (LWJGLException ex) { Logger.getLogger(Window.class.getName()).log(Level.SEVERE, null, ex); } //Mouse.setGrabbed(true); }
From source file:name.martingeisse.minimal.simulation.lwjgl.LwjglWindow.java
License:Open Source License
/** * Constructor.// www . j a v a2 s. c o m * @param width the window width * @param height the window height */ public LwjglWindow(int width, int height) { try { LwjglNativeLibraryHelper.prepareNativeLibraries(); Display.setDisplayMode(new DisplayMode(width, height)); Display.setTitle("Minimal"); Display.setFullscreen(true); Display.create(new PixelFormat(0, 24, 0)); Keyboard.create(); } catch (Exception e) { throw new RuntimeException("could not open LWJGL window", e); } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, height, 0, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); }
From source file:name.martingeisse.stackd.client.gui.Gui.java
License:Open Source License
/** * Fires the specified event./*from ww w .ja v a 2 s . c o m*/ * @param event the event */ public void fireEvent(GuiEvent event) { if (rootElement == null) { return; } if (event == GuiEvent.DRAW) { if (layoutRequested) { rootElement.requestSize(widthUnits, HEIGHT_UNITS); rootElement.setPosition(0, 0); layoutRequested = false; } GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, widthUnits, HEIGHT_UNITS, 0, -1, 1); } time = (int) System.currentTimeMillis(); rootElement.handleEvent(event); }