List of usage examples for org.lwjgl.opengl GL11 glFrustum
public static native void glFrustum(@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:com.aelitis.azureus.plugins.view3d.ViewTest2.java
License:Open Source License
static void accFrustum(double left, double right, double bottom, double top, double near, double far, double pixdx, double pixdy, double eyedx, double eyedy, double focus) { double xwsize, ywsize; double dx, dy; int[] viewport = getViewport(); xwsize = right - left;/* www . ja v a2s .c o m*/ ywsize = top - bottom; dx = -(pixdx * xwsize / (double) viewport[2] + eyedx * near / focus); dy = -(pixdy * ywsize / (double) viewport[3] + eyedy * near / focus); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glFrustum(left + dx, right + dx, bottom + dy, top + dy, near, far); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslated(-eyedx, -eyedy, 0.0); }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java
License:Apache License
public final void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { GL11.glFrustum(left, right, bottom, top, zNear, zFar); }
From source file:jake2.desktop.LWJGLAdapter.java
License:Open Source License
@Override public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { GL11.glFrustum(left, right, bottom, top, zNear, zFar); }
From source file:kuake2.render.lwjgl.Main.java
License:Open Source License
/** * MYgluPerspective//w w w.jav a 2s . c om * * @param fovy * @param aspect * @param zNear * @param zFar */ void MYgluPerspective(double fovy, double aspect, double zNear, double zFar) { double ymax = zNear * Math.tan(fovy * Math.PI / 360.0); double ymin = -ymax; double xmin = ymin * aspect; double xmax = ymax * aspect; xmin += -(2 * gl_state.camera_separation) / zNear; xmax += -(2 * gl_state.camera_separation) / zNear; GL11.glFrustum(xmin, xmax, ymin, ymax, zNear, zFar); }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 setProjectionFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // glFrustum sadly doesn't set all rows and columns GL11.glFrustum(left, right, bottom, top, zNear, zFar); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); return this; }
From source file:org.jtrfp.mtmx.tools.internal.ModelViewerConfiguration.java
License:Open Source License
@Override public void initView() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();// w ww .ja v a2 s. c om GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 40.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); //GL11.glClearDepth(0.5f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.jtrfp.mtmx.tools.internal.TruckViewerConfiguration.java
License:Open Source License
@Override public void initView() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from w ww.ja va2 s. c o m GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 25.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); //GL11.glClearDepth(0.5f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.jtrfp.mtmx.tools.internal.WorldViewerConfiguration.java
License:Open Source License
@Override public void initView() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from w ww . j a v a 2 s . c o m GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0f, 150 * IDrawer.WORLD_SCALE_XZ); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java
License:Open Source License
@Override // void dsDrawFrame (int width, int height, dsFunctions *fn, int pause) void dsDrawFrame(int width, int height, dsFunctions fn, boolean pause) { if (current_state < 1) dsDebug("internal error"); current_state = 2;//from w w w . ja va 2s . c om // setup stuff GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_GEN_S); GL11.glDisable(GL11.GL_TEXTURE_GEN_T); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LESS); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glFrontFace(GL11.GL_CCW); // setup viewport GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); final float vnear = 0.1f; final float vfar = 100.0f; final float k = 0.8f; // view scale, 1 = +/- 45 degrees if (width >= height) { float k2 = (float) height / (float) width; GL11.glFrustum(-vnear * k, vnear * k, -vnear * k * k2, vnear * k * k2, vnear, vfar); } else { float k2 = (float) width / (float) height; GL11.glFrustum(-vnear * k * k2, vnear * k * k2, -vnear * k, vnear * k, vnear, vfar); } // setup lights. it makes a difference whether this is done in the // GL_PROJECTION matrix mode (lights are scene relative) or the // GL_MODELVIEW matrix mode (lights are camera relative, bad!). // static GLfloat light_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; // static GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; // static GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, light_ambient); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, light_diffuse); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, light_specular); GL11.glColor3f(1.0f, 1.0f, 1.0f); // clear the window GL11.glClearColor(0.5f, 0.5f, 0.5f, 0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // snapshot camera position (in MS Windows it is changed by the GUI thread) float[] view2_xyz = view_xyz.clone(); float[] view2_rxyz = view_rxyz.clone(); // memcpy (view2_xyz,view_xyz);//,sizeof(float)*3); // memcpy (view2_hpr,view_hpr);//,sizeof(float)*3); // go to GL_MODELVIEW matrix mode and set the camera GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); setCamera(view2_xyz[0], view2_xyz[1], view2_xyz[2], view2_rxyz[0], view2_rxyz[1], view2_rxyz[2]); // set the light position (for some reason we have to do this in model view. // static GLfloat light_position[] = { LIGHTX, LIGHTY, 1.0, 0.0 }; GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, light_position); // draw the background (ground, sky etc) drawSky(view2_xyz); drawGround(); // draw the little markers on the ground drawPyramidGrid(); // leave openGL in a known state - flat shaded white, no textures GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LESS); GL11.glColor3f(1, 1, 1); setColor(1, 1, 1, 1); // draw the rest of the objects. set drawing state first. color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; tnum = DS_TEXTURE_NUMBER.DS_NONE; //if (fn.step) fn.step(pause); }
From source file:org.voxels.platform.LWJGLOpenGLAdapter.java
License:Open Source License
@Override public void glFrustum(final double left, final double right, final double bottom, final double top, final double zNear, final double zFar) { GL11.glFrustum(left, right, bottom, top, zNear, zFar); }