当前位置: 首页>>代码示例>>Java>>正文


Java Display.getWidth方法代码示例

本文整理汇总了Java中org.lwjgl.opengl.Display.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Display.getWidth方法的具体用法?Java Display.getWidth怎么用?Java Display.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.opengl.Display的用法示例。


在下文中一共展示了Display.getWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getProjection

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
protected Matrix4f getProjection(){
	Renderer r=getRenderer();
	if(r!=null) return r.getProjection();
	
	float farPlane=1000,nearPlane=0.1F;
	float aspectRatio=(float)Display.getWidth()/(float)Display.getHeight();
	float y_scale=(float)(1f/Math.tan(Math.toRadians(60/2f))*aspectRatio);
	float x_scale=y_scale/aspectRatio;
	float frustum_length=farPlane-nearPlane;
	
	NULL_PROJECTION.setIdentity();
	NULL_PROJECTION.m00=x_scale;
	NULL_PROJECTION.m11=y_scale;
	NULL_PROJECTION.m22=-((farPlane+nearPlane)/frustum_length);
	NULL_PROJECTION.m23=-1;
	NULL_PROJECTION.m32=-(2*nearPlane*farPlane/frustum_length);
	NULL_PROJECTION.m33=0;
	
	return NULL_PROJECTION;
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:21,代码来源:ShaderRenderer.java

示例2: checkWindowResize

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
protected void checkWindowResize()
{
    if (!this.fullscreen && Display.wasResized())
    {
        int i = this.displayWidth;
        int j = this.displayHeight;
        this.displayWidth = Display.getWidth();
        this.displayHeight = Display.getHeight();

        if (this.displayWidth != i || this.displayHeight != j)
        {
            if (this.displayWidth <= 0)
            {
                this.displayWidth = 1;
            }

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }

            this.resize(this.displayWidth, this.displayHeight);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:Minecraft.java

示例3: checkWindowResize

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
protected void checkWindowResize() {
	if (!this.fullscreen && Display.wasResized()) {
		int i = this.displayWidth;
		int j = this.displayHeight;
		this.displayWidth = Display.getWidth();
		this.displayHeight = Display.getHeight();

		if (this.displayWidth != i || this.displayHeight != j) {
			if (this.displayWidth <= 0) {
				this.displayWidth = 1;
			}

			if (this.displayHeight <= 0) {
				this.displayHeight = 1;
			}

			this.resize(this.displayWidth, this.displayHeight);
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:Minecraft.java

示例4: resizeIfNeeded

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Resizes the window and the Minecraft rendering if necessary. Set renderWidth and renderHeight first.
 */
private void resizeIfNeeded()
{
    // resize the window if we need to
    int oldRenderWidth = Display.getWidth(); 
    int oldRenderHeight = Display.getHeight();
    if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
        return;
    
    try {
        Display.setDisplayMode(new DisplayMode(this.renderWidth, this.renderHeight));
        System.out.println("Resized the window");
    } catch (LWJGLException e) {
        System.out.println("Failed to resize the window!");
        e.printStackTrace();
    }
    forceResize(this.renderWidth, this.renderHeight);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:VideoHook.java

示例5: createProjectionMatrix

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void createProjectionMatrix() {
	float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
	float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
	float x_scale = y_scale / aspectRatio;
	float frustum_lenght = FAR_PLANE - NEAR_PLANE;
	
	projectionMatrix = new Matrix4f();
	projectionMatrix.m00 = x_scale;
	projectionMatrix.m11 = y_scale;
	projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_lenght);
	projectionMatrix.m23 = -1;
	projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_lenght);
	projectionMatrix.m33 = 0;
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:15,代码来源:MasterRenderer.java

示例6: createProjectionMatrix

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void createProjectionMatrix() {
    float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
    float yScale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
    float xScale = yScale / aspectRatio;
    float frustumLength = FAR_PLANE - NEAR_PLANE;

    projectionMatrix = new Matrix4f();
    projectionMatrix.m00 = xScale;
    projectionMatrix.m11 = yScale;
    projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustumLength);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustumLength);
    projectionMatrix.m33 = 0;
}
 
开发者ID:Biacode,项目名称:bia-engine,代码行数:15,代码来源:MasterRenderer.java

示例7: createProjectionMatrix

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private static Matrix4f createProjectionMatrix() {
	Matrix4f projectionMatrix = new Matrix4f();
	float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
	float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))));
	float x_scale = y_scale / aspectRatio;
	float frustum_length = FAR_PLANE - NEAR_PLANE;

	projectionMatrix.m00 = x_scale;
	projectionMatrix.m11 = y_scale;
	projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
	projectionMatrix.m23 = -1;
	projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
	projectionMatrix.m33 = 0;
	return projectionMatrix;
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:16,代码来源:Camera.java

示例8: createProjectionMatrix

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private static Matrix4f createProjectionMatrix(){
	Matrix4f projectionMatrix = new Matrix4f();
	float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
	float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))));
	float x_scale = y_scale / aspectRatio;
	float frustum_length = FAR_PLANE - NEAR_PLANE;

	projectionMatrix.m00 = x_scale;
	projectionMatrix.m11 = y_scale;
	projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
	projectionMatrix.m23 = -1;
	projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
	projectionMatrix.m33 = 0;
	return projectionMatrix;
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:16,代码来源:Camera.java

示例9: createProjectionMatrix

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private static Matrix4f createProjectionMatrix() {
    Matrix4f projectionMatrix = new Matrix4f();
    float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
    float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))));
    float x_scale = y_scale / aspectRatio;
    float frustum_length = FAR_PLANE - NEAR_PLANE;

    projectionMatrix.m00 = x_scale;
    projectionMatrix.m11 = y_scale;
    projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
    projectionMatrix.m33 = 0;
    return projectionMatrix;
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:16,代码来源:Camera.java

示例10: getDisplayWidth_scaled

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static int getDisplayWidth_scaled() {
    ScaledResolution scaledResolution = new ScaledResolution(Wrapper.getMinecraft(), Display.getWidth(),
            Display.getHeight());
    return scaledResolution.func_78326_a();
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:6,代码来源:RenderUtil.java

示例11: getDisplayHeight_scaled

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static int getDisplayHeight_scaled() {
    ScaledResolution scaledResolution = new ScaledResolution(Wrapper.getMinecraft(), Display.getWidth(),
            Display.getHeight());
    return scaledResolution.func_78328_b();
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:6,代码来源:RenderUtil.java

示例12: getScaleFactor

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static int getScaleFactor() {
    ScaledResolution scaledResolution = new ScaledResolution(Wrapper.getMinecraft(), Display.getWidth(),
            Display.getHeight());
    return scaledResolution.func_78325_e();
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:6,代码来源:RenderUtil.java

示例13: getDisplayScreenWidth

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
protected int getDisplayScreenWidth() {
	return Display.getWidth();
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:4,代码来源:IGuiScreen.java

示例14: update

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static final void update(final PlayerInventory inventory) {

		final float mx = MouseInput.getX();
		final float my = MouseInput.getY();

		inventory.input(mx, my);

		if (GameStateGuis.mouseImage.recalc) {

			GameStateGuis.mouseImage.remove();
			GameStateGuis.mouseImage = new GuiImage(0f, 0f, 0f, .075f, mouseTexture);
			GameStateGuis.mouseImage.add();

		}

		if (GameStateGuis.minimapImage.recalc) {

			minimapImage.remove();
			minimapImage = new GuiImage(-.75f, .55f, 0f, .4f, new Texture(Minimap.texture));
			minimapImage.flipYAxis = true;
			minimapImage.add();

		}

		if (GameStateGuis.inventory.recalc) {

			GameStateGuis.inventory.remove();
			GameStateGuis.inventory = new GuiImage(0, 0, (float) PlayerInventory.background.getWidth() / (float) Display.getWidth(), (float) PlayerInventory.background.getHeight() / (float) Display.getHeight(), null);
			GameStateGuis.inventory.add();

		}

	}
 
开发者ID:ASasseCreations,项目名称:Voxel_Game,代码行数:34,代码来源:GameStateGuis.java

示例15: renderFlare

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Renders a single flare texture to the screen on a textured 2D quad.
 * 
 * The texture for this flare is first bound to texture unit 0. The x and y
 * scale of the quad is then determined. The x scale is simply the scale
 * value in the FlareTexture instance, and then the y scale is calculated by
 * multiplying that by the aspect ratio of the display. This ensures that
 * the quad is a square, and not a rectangle.
 * 
 * The position and scale is then loaded up the the shader. Finally, the
 * quad is rendered using glDrawArrays (no index buffer used), and using
 * GL_TRIANGLE_STRIP. This allows the quad to be specified using only 4
 * vertex positions, instead of having to specify the 6 vertex positions for
 * the 2 triangles. See GUI tutorial for more info.
 * 
 * @param flare
 *            - The flare to be rendered.
 */
private void renderFlare(FlareTexture flare) {
	flare.getTexture().bindToUnit(0);
	float xScale = flare.getScale();
	float yScale = xScale * (float) Display.getWidth() / Display.getHeight();
	Vector2f centerPos = flare.getScreenPos();
	shader.transform.loadVec4(centerPos.x, centerPos.y, xScale, yScale);
	GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:27,代码来源:FlareRenderer.java


注:本文中的org.lwjgl.opengl.Display.getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。