當前位置: 首頁>>代碼示例>>Java>>正文


Java GLU.gluPerspective方法代碼示例

本文整理匯總了Java中org.lwjgl.util.glu.GLU.gluPerspective方法的典型用法代碼示例。如果您正苦於以下問題:Java GLU.gluPerspective方法的具體用法?Java GLU.gluPerspective怎麽用?Java GLU.gluPerspective使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lwjgl.util.glu.GLU的用法示例。


在下文中一共展示了GLU.gluPerspective方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: changeSize

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
/**
 * Changes the size of the lwjgl window
 * @param w The new width of the lwjgl window
 * @param h The new height of the lwjgl window
 */
private void changeSize(float w, float h) {
    // Prevent a division by zero, when window is too short
    if (h == 0) {
        h = 1;
    }
    float wRatio = 1.0f * w / h;
    // Reset the coordinate system before modifying
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    // Set the viewport to be the entire window
    GL11.glViewport(0, 0, (int) w, (int) h);
    // Set the correct perspective.
    GLU.gluPerspective(45.0f, wRatio, (float) near, (float) far);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GLU.gluLookAt(camPos.x, camPos.y, camPos.z, // Position
            camPos.x + camDir.x, camPos.y + camDir.y, camPos.z + camDir.z, // Lookat
            camUp.x, camUp.y, camUp.z);               // Up-direction}
}
 
開發者ID:CallForSanity,項目名稱:Gaalop,代碼行數:25,代碼來源:LwJglRenderingEngine.java

示例2: initGLState

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
void initGLState() {
	GL11.glViewport(0, 0, getWidth(), getHeight());
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	//GL11.glClearColor(62.0f / 100.0f, 77.0f / 100.0f, 100.0f / 100.0f, 1.0f);
	GL11.glClearColor(64.0f / 255.0f, 64.0f / 255.0f, 64.0f / 255.0f, 1.0f);

	
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	GLU.gluPerspective(60.0f, (float)GLXres/(float)GLYres, 0.1f, 100.0f);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);

	
	previewProgram = getShaderProgram(previewVertexShader, previewFragmentShader);
	
	
	loadShaderLocations();

	// hmm: temp initialization here
	// create the empty textures (later they are updated from the channels)
	texidDiffuse = create2dTexture(0x7F7FFFFF);
	texidNormal = create2dTexture(0x7F7FFFFF);
	texidSpecWeight = create2dTexture(0xFFFFFFFF);
	texidHeightmap = create2dTexture(0xFFFFFFFF);
	
}
 
開發者ID:Erkaman,項目名稱:NeoTextureEdit2,代碼行數:27,代碼來源:OpenGLTextureRenderCanvas.java

示例3: perFrameGL

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
public void perFrameGL()
{
	
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	glShadeModel(GL_SMOOTH);
	glMatrixMode(GL_PROJECTION);
	glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
	glLoadIdentity();
	GLU.gluPerspective(50f, SX/ SY, 0.01f, 100f);
	GLU.gluLookAt(-10,0,0,0,0,0,0,0,0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glEnable(GL_DEPTH_TEST);
	
}
 
開發者ID:jediminer543,項目名稱:JediUtil-Deprecated,代碼行數:17,代碼來源:Game.java

示例4: initialize3D

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
public void initialize3D() {
    //GL11.glEnable(GL11.GL_TEXTURE_2D); // Allows 2D textures.
    GL11.glShadeModel(GL11.GL_SMOOTH); // Smoother textures.
    GL11.glClearColor(0.4f,0.6f,1.0f,0.0f); // BG color. 6698FF
    GL11.glClearDepth(1.0); // Buffer depth, allows objects to draw over things behind them.
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Depth testing (see above).
    GL11.glDepthFunc(GL11.GL_LEQUAL); // Type of depth testing.
    
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
    
    GL11.glMatrixMode(GL11.GL_PROJECTION); // Sets matrix mode to displaying pixels.
    GL11.glLoadIdentity(); // Loads the above matrix mode.
    
    // Sets default perspective location.                       Render Distances: Min   Max
    GLU.gluPerspective(45.0f,(float)Display.getWidth()/(float)Display.getHeight(),0.1f,300.0f);
    
    GL11.glMatrixMode(GL11.GL_MODELVIEW); // Sets the matrix to displaying objects.
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT,GL11.GL_NICEST); // Something unimportant for quality.
    GL11.glEnable(GL11.GL_CULL_FACE);
}
 
開發者ID:anubiann00b,項目名稱:VoxelDungeon,代碼行數:22,代碼來源:Game.java

示例5: begin

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
@Override
public void begin() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    if (camera.isOrtho()) {
        GL11.glOrtho(-camera.getX(), camera.getX(), -camera.getY(), camera.getY(), -NEAR, FAR);
    } else {
        GLU.gluPerspective(camera.getFOVY(), camera.getWidth() / camera.getHeight(), NEAR, FAR);
    }

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
}
 
開發者ID:rvt,項目名稱:cnctools,代碼行數:17,代碼來源:View3D.java

示例6: initGL

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
/**
 * Initialize GL for the window.
 */
private void initGL() {
    // define the properties for the perspective of the scene
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective(FOVY, ((float) displayWidth)
            / ((float) displayHeight), Z_NEAR, Z_FAR);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    GL11.glClearDepth(1.0f);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}
 
開發者ID:PenguinMenaceTechnologies,項目名稱:PenguinMenaceEngine,代碼行數:25,代碼來源:Graphics.java

示例7: setDimensions

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
public void setDimensions( float width, float height ) {
	this.width = width;
	this.height = height;
	this.aspectRatio = ( width/height > 1 ? width/height : height/width );
	GL11.glViewport(0,0,(int)width,(int)height);                           // Reset The Current Viewport
	
	GL11.glMatrixMode(GL11.GL_PROJECTION);                            // Select The Projection Matrix
       GL11.glLoadIdentity();                                       // Reset The Projection Matrix
       
       GLU.gluPerspective(45.0f,
               (float) width / (float) height,
               0.05f, 100.0f);
	
	/*GLU.gluPerspective(fov,
               (float) width / (float) height,
               nearClippingPlane, farClippingPlane);*/
}
 
開發者ID:kephale,項目名稱:brevis,代碼行數:18,代碼來源:BrCamera.java

示例8: setPerspective

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
public static void setPerspective(float fow, float near, float far) {
    int w = Display.getWidth();
    int h = Display.getHeight();
    
    glViewport(0, 0, w, h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    GLU.gluPerspective(fow, (1f * w / h), near, far);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glShadeModel(GL_SMOOTH);
    glClearColor(0, 0, 0, 0);
    glClearDepth(1);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
 
開發者ID:akarnokd,項目名稱:akarnokd-opengl-experiment,代碼行數:18,代碼來源:G3D.java

示例9: render

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
private void render(){
    if(Display.wasResized()) glViewport(0, 0, Display.getWidth(), Display.getHeight());

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);

    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);

    GLU.gluPerspective(70.0f, (float) Display.getWidth() / (float) Display.getHeight(), 0.01f, 1000.0f);

    glEnable(GL_DEPTH_TEST);
    glPopMatrix();
        glPushAttrib(GL_TRANSFORM_BIT);

            glRotatef(player.getLocation().getYaw(), 1, 0, 0);
            glRotatef(player.getLocation().getPitch(), 0, 1, 0);
            glTranslatef(-player.getLocation().getX(), -player.getLocation().getY(), -player.getLocation().getZ());

            Renderer.renderWorld(world);
            Renderer.renderRayCast(player);

        glPopAttrib();
    glPopMatrix();
    glDisable(GL_DEPTH_TEST);

    renderGUI();
}
 
開發者ID:Vinetos,項目名稱:FreeWorld,代碼行數:31,代碼來源:FreeWorld.java

示例10: setupCubemapCamera

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
private void setupCubemapCamera() {
    matrixMode(GL11.GL_PROJECTION);
    pushMatrix();
    loadIdentity();
    GLU.gluPerspective(150.0F, 1.0F, 0.05F, 10.0F);
    matrixMode(GL11.GL_MODELVIEW);
    pushMatrix();
    loadIdentity();
}
 
開發者ID:MineLittlePony,項目名稱:MineLittlePony,代碼行數:10,代碼來源:GuiSkins.java

示例11: startEngine

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
/**
 * Starts the lwjgl engine and shows a window, where the point clouds are rendered
 */
public void startEngine() {
    int width = 800;
    int height = 600;
    
    try {
        Display.setDisplayMode(new DisplayMode(width, height));
        Display.setFullscreen(false);
        Display.setTitle("Gaalop Visualization Window");

        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }
    
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    changeSize(width, height);
    GL11.glDisable(GL11.GL_LIGHTING);


    // init OpenGL
    GL11.glViewport(0, 0, width, height);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective((float) 65.0, (float) width / (float) height, (float) 0.1, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    
    
}
 
開發者ID:CallForSanity,項目名稱:Gaalop,代碼行數:34,代碼來源:LwJglRenderingEngine.java

示例12: InitGL

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
private void InitGL() {
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glShadeModel(GL11.GL_SMOOTH);
	GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	GL11.glClearDepth(1.0);
	GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_COLOR_MATERIAL);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthFunc(GL11.GL_LEQUAL);
	GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
	GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
	GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
	GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
	GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, CreateFloatBuffer(1.0f, 1.0f, 1.0f, 1.0f));
    GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, 64f);

    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION,CreateFloatBuffer(2f, 40f, 2f, 0f));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, CreateFloatBuffer(1f, 1f, 1f, 1f));
    GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, CreateFloatBuffer(AmbientLight, AmbientLight, AmbientLight, 1.0f));

    GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	GLU.gluPerspective(45.0f, (float) displayMode.getWidth()
			/ (float) displayMode.getHeight(), 0.1f, 300.0f);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

}
 
開發者ID:Glynn-Taylor,項目名稱:Heightmap-Renderer,代碼行數:33,代碼來源:Game.java

示例13: ProjectionMode

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
protected void ProjectionMode()
  {
	GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();

GLU.gluPerspective(45.0f, (float) Display.getWidth()
		/ (float) Display.getHeight(), 0.1f, 900.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
  }
 
開發者ID:Glynn-Taylor,項目名稱:Heightmap-Renderer,代碼行數:12,代碼來源:State.java

示例14: draw

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
public static void draw(int x, int y, long tick,
        JGLScene scene)
{
    synchronized (scene)
    {
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        if (scene.getBackground() != null)
        {
            Color4f bg = scene.getBackground();
            GL11.glClearColor((float)bg.x, (float)bg.y, (float)bg.z, (float)bg.w);
        }
        GL11.glCullFace(GL11.GL_FRONT); 
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glFrontFace(GL11.GL_CCW);
        
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        float aspect = (float)x/(float)y;
        GLU.gluPerspective(scene.getFieldOfView(), aspect, scene.getMinZ(), scene.getMaxZ());

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
        draw(tick, scene.getNode());
        for (JGLTextGroup textGroup : scene.getTexts())
            if (!textGroup.isCull())
                draw(textGroup, x, y);
    }
}
 
開發者ID:StarMade,項目名稱:SMEditClassic,代碼行數:30,代碼來源:DrawLogic.java

示例15: ProjectionMode

import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
protected void ProjectionMode() {
	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();

	GLU.gluPerspective(45.0f,
			(float) Display.getWidth() / (float) Display.getHeight(), 0.1f,
			600.0f);
	GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
}
 
開發者ID:Glynn-Taylor,項目名稱:9-Gates,代碼行數:12,代碼來源:State.java


注:本文中的org.lwjgl.util.glu.GLU.gluPerspective方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。