当前位置: 首页>>代码示例>>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;未经允许,请勿转载。