List of usage examples for org.lwjgl.opengl GL11 glViewport
public static void glViewport(@NativeType("GLint") int x, @NativeType("GLint") int y, @NativeType("GLsizei") int w, @NativeType("GLsizei") int h)
From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java
License:LGPL
/** * Renders the skybox in the main menu//from w w w . ja v a 2s .com */ private void renderSkybox(int par1, int par2, float par3) { GL11.glViewport(0, 0, 256, 256); this.drawPanorama(par1, par2, par3); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_TEXTURE_2D); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); float f1 = this.width > this.height ? 120.0F / (float) this.width : 120.0F / (float) this.height; float f2 = (float) this.height * f1 / 256.0F; float f3 = (float) this.width * f1 / 256.0F; GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); // tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); int k = this.width; int l = this.height; tessellator.addVertexWithUV(0.0D, (double) l, (double) this.zLevel, (double) (0.5F - f2), (double) (0.5F + f3)); tessellator.addVertexWithUV((double) k, (double) l, (double) this.zLevel, (double) (0.5F - f2), (double) (0.5F - f3)); tessellator.addVertexWithUV((double) k, 0.0D, (double) this.zLevel, (double) (0.5F + f2), (double) (0.5F - f3)); tessellator.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (0.5F + f2), (double) (0.5F + f3)); tessellator.draw(); }
From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Context.java
License:MIT License
@Override public void setViewPort(Rectangle viewPort) { checkCreated();/*from ww w . ja va 2s.c om*/ GL11.glViewport(viewPort.getX(), viewPort.getY(), viewPort.getWidth(), viewPort.getHeight()); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.gameminers.ethereal.architect.ModelCanvas.java
License:Open Source License
@Override protected void paintGL() { try {/*w w w. j a v a 2 s . co m*/ if (getWidth() != current_width || getHeight() != current_height) { current_width = getWidth(); current_height = getHeight(); GL11.glViewport(0, 0, current_width, current_height); } GL11.glClearColor(0.0f, 0.6f, 0.5f, 1.0f); GL11.glClearDepth(1.0); GL11.glColor3f(1, 1, 1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, (float) getWidth() / (float) getHeight(), 0.1f, 1000.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glTranslatef(0, 0, zoom); GL11.glRotatef(angle, 0f, 1f, 0f); GL11.glRotatef(tilt, 1f, 0f, 0f); GL11.glTranslatef(-16, -16, -16); if (lit) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, lightAmbient); } else { GL11.glDisable(GL11.GL_LIGHTING); } if (textured) { GL11.glEnable(GL11.GL_TEXTURE_2D); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); } if (model != null) { if (model.isAmbientOcclusionEnabled()) { GL11.glShadeModel(GL11.GL_SMOOTH); } else { GL11.glShadeModel(GL11.GL_FLAT); } for (ModelElement ele : model.getElements()) { GL11.glPushMatrix(); if (ele.isShade()) { GL11.glEnable(GL11.GL_LIGHTING); } else { GL11.glDisable(GL11.GL_LIGHTING); } float fromX = ele.getFrom()[0]; float fromY = ele.getFrom()[1]; float fromZ = ele.getFrom()[2]; float toX = ele.getTo()[0]; float toY = ele.getTo()[1]; float toZ = ele.getTo()[2]; float fX = (fromX > toX ? fromX : toX); float fY = (fromY > toY ? fromY : toY); float fZ = (fromZ > toZ ? fromZ : toZ); float tX = (fromX > toX ? toX : fromX); float tY = (fromY > toY ? toY : fromY); float tZ = (fromZ > toZ ? toZ : fromZ); GL11.glTranslatef(fX, fY, fZ); float scaleX = tX - fX; float scaleY = tY - fY; float scaleZ = tZ - fZ; GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0, 0, -1f); for (int i = 0; i < vertices.length / 3; i++) { int faceIdx = i / 4; ModelFace face; switch (faceIdx) { case 0: face = ele.getFaces().getNorth(); break; case 1: face = ele.getFaces().getSouth(); break; case 2: face = ele.getFaces().getUp(); break; case 3: face = ele.getFaces().getDown(); break; case 4: face = ele.getFaces().getWest(); break; case 5: face = ele.getFaces().getEast(); break; default: face = null; break; } int idx = i * 3; float vX = vertices[idx] * scaleX; float vY = vertices[idx + 1] * scaleY; float vZ = vertices[idx + 2] * scaleZ; /*float u; float v; GL11.glTexCoord2f(u, v);*/ GL11.glVertex3f(vX, vY, vZ); } GL11.glEnd(); GL11.glPopMatrix(); } } GL11.glPopMatrix(); swapBuffers(); repaint(); } catch (LWJGLException e) { throw new RuntimeException(e); } }
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void beforeFrame(int width, int height) { GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from www .java2s . com GL11.glOrtho(0, width, height, 0, 100, -100); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:com.github.kajdreef.mazerunnermvn.Launcher.java
/** * Initialize the display.//ww w . j ava2 s . c om */ public void initDisplayLWJGL() { PixelFormat pixelFormat = new PixelFormat(); ContextAttribs contextAtrributes = new ContextAttribs(3, 2).withForwardCompatible(true) .withProfileCore(true); try { Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); Display.setTitle("MazeRunner"); Display.create(pixelFormat, contextAtrributes); } catch (LWJGLException e) { e.printStackTrace(); System.exit(-1); } GL11.glClearColor(0.4f, 0.6f, 0.9f, 0f); GL11.glViewport(0, 0, WIDTH, HEIGHT); // Enable depth test so the objects are rendered in the right way. GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:com.google.gapid.glviewer.gl.Renderer.java
License:Apache License
/** * Updates the size of the back-buffer.//from w w w .ja v a 2 s .c o m * @param width of the back-buffer in real pixels. * @param height of the back-buffer in real pixels. */ public void setSize(int width, int height) { physicalWidth = width; physicalHeight = height; dipWidth = DPIUtil.autoScaleDown(width); dipHeight = DPIUtil.autoScaleDown(height); GL11.glViewport(0, 0, physicalWidth, physicalHeight); }
From source file:com.google.gapid.glviewer.Viewer.java
License:Apache License
@Override public void reshape(int x, int y, int width, int height) { GL11.glViewport(x, y, width, height); camera.updateViewport(width, height); }
From source file:com.grafxteam.sr.main.MainDisplayClass.java
License:Open Source License
public static void createDisplay() { ContextAttribs attribs = new ContextAttribs(4, 5); attribs.withForwardCompatible(true); attribs.withProfileCore(true);//from w w w .j ava 2s .c o m try { Display.setDisplayMode(new DisplayMode(DisplayParams.WIDTH, DisplayParams.HEIGHT)); Display.create(new PixelFormat(), attribs); } catch (LWJGLException e) { e.printStackTrace(); } Display.setTitle(DisplayParams.TITLE + DisplayParams.VER); GL11.glViewport(0, 0, DisplayParams.WIDTH, DisplayParams.HEIGHT); }
From source file:com.grillecube.client.renderer.MainRenderer.java
/** * main rendering function (screen is already cleared, and frame buffer will be * swapped after this render/*from w w w.j av a 2 s. c om*/ */ public void render() { // if renderer is not enabled, return if (!this.toggle) { return; } // TODO move this somewhere else, if openal is thread safe // if (this.getCamera() != null) { // this.getCamera().update(); // this.engine.getResourceManager().getSoundManager().update(this.getCamera()); // } this.getResourceManager().getEventManager().invokeEvent(this.preRenderEvent); // reset these values before next rendering this.drawCalls = GLH.glhGetContext().resetDrawCalls(); this.verticesDrawn = GLH.glhGetContext().resetDrawVertices(); this.getDefaultVAO().bind(); // render GLH.glhCheckError("pre main renderer render"); for (Renderer renderer : this.customRenderers) { renderer.render(); GLH.glhCheckError("post " + renderer.getClass().getSimpleName() + ".render()"); } GL11.glViewport(0, 0, this.getGLFWWindow().getWidth(), this.getGLFWWindow().getHeight()); this.guiRenderer.render(); GLH.glhCheckError("post gui renderer render"); this.getResourceManager().getEventManager().invokeEvent(this.postRenderEvent); }
From source file:com.grillecube.engine.opengl.GLFWWindow.java
public void resize(int width, int height) { GL11.glViewport(0, 0, width, height); this._width = width; this._height = height; }