List of usage examples for org.lwjgl.opengl GL11 GL_MODELVIEW
int GL_MODELVIEW
To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.
Click Source Link
From source file:hexagonalminesweeper.HexagonalMinesweeper.java
public static void renderGL() { try {//from w w w .ja v a2 s. c om Display.setDisplayMode(new org.lwjgl.opengl.DisplayMode(800, 600)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, 800, 600); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 600, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); Display.setVSyncEnabled(true); }
From source file:hud.UnitDisplay.java
License:Open Source License
public void draw() { GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE); GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f); GL11.glLineWidth(2.0f);/*from w w w . ja v a 2s. c o m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.8f); GL11.glEnable(GL11.GL_BLEND); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); int[] viewport = GLUtils.getViewport(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluPerspective(45, 1.0f, 0.001f, 5.0f); GL11.glViewport(getX(), viewport[3] - (getY() + height), width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluLookAt(2.0f * (float) Math.cos(angle), 2.0f * (float) Math.sin(angle), 1.0f, 0, 0, 0, 0, 0, 1); // GL11.glTranslatef(x + width/2, y + height/2,0); currentUnit.draw(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); }
From source file:illarion.graphics.lwjgl.RenderDisplayLWJGL.java
License:Open Source License
/** * Setup the openGL render environment. Such as the view port the matrix for * the orthogonal view and so on./*from w w w. j a v a2s.c om*/ */ protected void setupOpenGL() { if (!Display.isCreated()) { return; } // set the basic view port of the game. This should be the full size of // the client window GL11.glViewport(0, 0, resWidth, resHeight); // enable alpha blending based on the picture alpha channel GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // disable death test, we work in 2D anyway, there is no depth GL11.glDisable(GL11.GL_DEPTH_TEST); // switch to projection matrix to set up the orthogonal view that we // need GL11.glMatrixMode(GL11.GL_PROJECTION); // load the identity matrix to we have a clean start GL11.glLoadIdentity(); // setup the orthogonal view GLU.gluOrtho2D(0, resWidth, 0, resHeight); // set clear color to black GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // sync frame (only works on windows) if (Graphics.NO_SLOWDOWN) { Display.setVSyncEnabled(false); } else { Display.setVSyncEnabled(true); } // clean up the screen GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // switch to model view matrix, so we can place the sprites correctly GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void render(Root root) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT); GL11.glViewport(0, 0, LwjglHelper.getWidth(), LwjglHelper.getHeight()); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();//ww w . j a va2 s. c o m GL11.glLoadIdentity(); GL11.glOrtho(root.getX(), root.getWidth(), root.getHeight(), root.getY(), -1.0, 1.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_TEXTURE_2D); drawBackgroundAndBorder(root); drawStack(root); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:io.flob.blackheart.DisplayDriver.java
License:Open Source License
public void mode_2D() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();/*from www. j ava 2 s. com*/ GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 1); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_FOG); }
From source file:io.flob.blackheart.DisplayDriver.java
License:Open Source License
public void mode_3D() { GL11.glEnable(GL11.GL_DEPTH_TEST);//from w w w . ja va2 s. c o m GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_FOG); }
From source file:io.flob.clicker.DisplayDriver.java
License:Open Source License
private void init_GL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//www . j av a2 s.c o m GL11.glOrtho(0, width, height, 0, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glClearColor(0.1f, 0.1f, 0.1f, 1.0f); GL11.glClearDepth(1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }
From source file:io.github.SolidStudiosTeam.Flicker.engine.GameLoop.java
License:Open Source License
@Override public void initGL() { /* Enable 2D textures. */ GL11.glEnable(GL11.GL_TEXTURE_2D);/*from w ww. j a v a2s . c o m*/ /* Make all models smoothly textured. */ GL11.glShadeModel(GL11.GL_SMOOTH); /* Set the background color to that signature blue. */ GL11.glClearColor(0.9f, 1.0f, 1.0f, 0.0f); /* Set the clear depth to all-the-way */ GL11.glClearDepth(1.0); /* Enable the depth system. */ GL11.glEnable(GL11.GL_DEPTH_TEST); /* Set the function for depth to GL_LEQUAL. */ GL11.glDepthFunc(GL11.GL_LEQUAL); // GL11.glEnable(GL11.GL_BLEND); //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); /* Enable face culling, basically don't render this face relative to the camera's position. */ // GL11.glEnable(GL11.GL_CULL_FACE); /* Set OpenGL to cull the back face of our spatials. */ // GL11.glCullFace(GL11.GL_BACK); /* Set the matrix mode to projection. */ GL11.glMatrixMode(GL11.GL_PROJECTION); /* Reset the OpenGL configuration, loading our above prefrences. */ GL11.glLoadIdentity(); /* Set the perspective. */ GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100.0f); /* Set the matrix mode to be model view. */ GL11.glMatrixMode(GL11.GL_MODELVIEW); /* Set the perspective correction hint to finest quality. */ GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); }
From source file:ion2d.INDirector.java
License:Open Source License
public static void setProjection(ProjectionFormat format) { if (Display.isCreated() == false) return;//ww w. ja va 2s . co m Dimension screen = getScreenSize(); switch (format) { case DirectorProjection2D: GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, screen.width, 0, screen.height, -1000, 1000); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); break; case DirectorProjection3D: GL11.glViewport(0, 0, screen.width, screen.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); float aspect = (screen.width * 1.0f) / (screen.height * 1.0f); GLU.gluPerspective(55, aspect, 0, screen.height + screen.width); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GLU.gluLookAt(screen.width / 2, screen.height / 2, getZEye(), screen.width / 2, screen.height / 2, 0.0f, 0.0f, 1.0f, 0.0f); break; } instance.currentProjection = format; }
From source file:itdelatrisu.opsu.render.CurveRenderState.java
License:Open Source License
/** * Backup the current state of the relevant OpenGL state and change it to * what's needed to draw the curve.//from w ww . ja v a2 s . c o m */ private RenderState startRender() { RenderState state = new RenderState(); state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH); state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND); state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST); state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK); state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D); state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE); state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM); state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING); GL11.glDisable(GL11.GL_POLYGON_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendEquation(GL14.GL_FUNC_ADD); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_TEXTURE_1D); GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture); GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL20.glUseProgram(0); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); return state; }