本文整理了Java中org.lwjgl.opengl.Display.getHeight()
方法的一些代码示例,展示了Display.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Display.getHeight()
方法的具体详情如下:
包路径:org.lwjgl.opengl.Display
类名称:Display
方法名:getHeight
暂无
代码示例来源:origin: libgdx/libgdx
public int getHeight () {
if (canvas != null)
return Math.max(1, canvas.getHeight());
else
return (int)(Display.getHeight() * Display.getPixelScaleFactor());
}
代码示例来源:origin: libgdx/libgdx
public int getHeight () {
if (canvas != null)
return Math.max(1, canvas.getHeight());
else
return (int)(Display.getHeight() * Display.getPixelScaleFactor());
}
代码示例来源:origin: MovingBlocks/Terasology
private static Matrix4f createPerspectiveProjectionMatrix(float fov, float zNear, float zFar) {
float aspectRatio = (float) Display.getWidth() / Display.getHeight();
float fovY = (float) (2 * Math.atan2(Math.tan(0.5 * fov * TeraMath.DEG_TO_RAD), aspectRatio));
return MatrixUtils.createPerspectiveProjectionMatrix(fovY, aspectRatio, zNear, zFar);
}
代码示例来源:origin: MovingBlocks/Terasology
private void updateViewport() {
glViewport(0, 0, Display.getWidth(), Display.getHeight());
propertyChangeSupport.firePropertyChange(DISPLAY_RESOLUTION_CHANGE, 0, 1);
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public Vector2i getTargetSize() {
return new Vector2i(Display.getWidth(), Display.getHeight());
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public Vector2i getPosition() {
return new Vector2i(Mouse.getX() / this.uiScale, (Display.getHeight() - Mouse.getY()) / this.uiScale);
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void unbindFrame() {
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
GL11.glViewport(vp.get(0), vp.get(1), vp.get(2), vp.get(3));
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 2048f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
代码示例来源:origin: MovingBlocks/Terasology
private void updateFullScale() {
fullScale.setDimensions(Display.getWidth(), Display.getHeight());
fullScale.multiplySelfBy(renderingConfig.getFboScale() / 100f);
}
代码示例来源:origin: MovingBlocks/Terasology
private void initOpenGL(Context currentContext) {
logger.info("Initializing OpenGL");
checkOpenGL();
glViewport(0, 0, Display.getWidth(), Display.getHeight());
initOpenGLParams();
currentContext.put(ShaderManager.class, new ShaderManagerLwjgl());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void runLoop(){
// This method is overriden to do restart
if (needRestart.getAndSet(false)) {
try {
createContext(settings);
} catch (LWJGLException ex) {
logger.log(Level.SEVERE, "Failed to set display settings!", ex);
}
listener.reshape(settings.getWidth(), settings.getHeight());
logger.fine("Display restarted.");
} else if (Display.wasResized()) {
int newWidth = Display.getWidth();
int newHeight = Display.getHeight();
settings.setResolution(newWidth, newHeight);
listener.reshape(newWidth, newHeight);
}
super.runLoop();
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void process() {
PerformanceMonitor.startActivity("rendering/" + getUri());
// The way things are set-up right now, we can have FBOs that are not the same size as the display (if scale != 100%).
// However, when drawing the final image to the screen, we always want the viewport to match the size of display,
// and not that of some FBO. Hence, we are manually setting the viewport via glViewport over here.
glViewport(0, 0, Display.getWidth(), Display.getHeight());
renderFullscreenQuad();
PerformanceMonitor.endActivity();
}
代码示例来源:origin: MovingBlocks/Terasology
/**
* Invoked before real-rendering starts
*/
public void update() {
if (!screenGrabber.isTakingScreenshot()) {
if (wasTakingScreenshotLastFrame) {
updateFullScale();
regenerateFbos();
wasTakingScreenshotLastFrame = false;
}
} else {
ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize();
// TODO: Remove dependency on Display
fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()),
screenshotSize.getHeight(Display.getHeight()));
regenerateFbos();
wasTakingScreenshotLastFrame = true;
}
}
代码示例来源:origin: MovingBlocks/Terasology
glViewport(0, 0, Display.getWidth(), Display.getHeight());
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void preRender() {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 2048f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
modelView = new Matrix4f();
modelView.setIdentity();
modelView.setTranslation(new Vector3f(0, 0, -1024f));
MatrixUtils.matrixToFloatBuffer(modelView, matrixBuffer);
glLoadMatrix(matrixBuffer);
matrixBuffer.rewind();
glScalef(uiScale, uiScale, uiScale);
requestedCropRegion = Rect2i.createFromMinAndSize(0, 0, Display.getWidth(), Display.getHeight());
currentTextureCropRegion = requestedCropRegion;
textureMat.setFloat4(CROPPING_BOUNDARIES_PARAM, requestedCropRegion.minX(), requestedCropRegion.maxX(),
requestedCropRegion.minY(), requestedCropRegion.maxY());
}
代码示例来源:origin: libgdx/libgdx
if (graphics.resize || Display.wasResized()
|| (int)(Display.getWidth() * Display.getPixelScaleFactor()) != graphics.config.width
|| (int)(Display.getHeight() * Display.getPixelScaleFactor()) != graphics.config.height) {
graphics.resize = false;
graphics.config.width = (int)(Display.getWidth() * Display.getPixelScaleFactor());
graphics.config.height = (int)(Display.getHeight() * Display.getPixelScaleFactor());
Gdx.gl.glViewport(0, 0, graphics.config.width, graphics.config.height);
if (listener != null) listener.resize(graphics.config.width, graphics.config.height);
代码示例来源:origin: libgdx/libgdx
if (graphics.resize || Display.wasResized()
|| (int)(Display.getWidth() * Display.getPixelScaleFactor()) != graphics.config.width
|| (int)(Display.getHeight() * Display.getPixelScaleFactor()) != graphics.config.height) {
graphics.resize = false;
graphics.config.width = (int)(Display.getWidth() * Display.getPixelScaleFactor());
graphics.config.height = (int)(Display.getHeight() * Display.getPixelScaleFactor());
Gdx.gl.glViewport(0, 0, graphics.config.width, graphics.config.height);
if (listener != null) listener.resize(graphics.config.width, graphics.config.height);
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl
public int getHeight () {
if (canvas != null)
return Math.max(1, canvas.getHeight());
else
return (int)(Display.getHeight() * Display.getPixelScaleFactor());
}
代码示例来源:origin: playn/playn
void checkScaleFactor () {
float scaleFactor = Display.getPixelScaleFactor();
if (scaleFactor != scale().factor) updateViewport(
new Scale(scaleFactor), Display.getWidth(), Display.getHeight());
}
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl
@Override
public void runLoop(){
// This method is overriden to do restart
if (needRestart.getAndSet(false)) {
try {
createContext(settings);
} catch (LWJGLException ex) {
logger.log(Level.SEVERE, "Failed to set display settings!", ex);
}
listener.reshape(settings.getWidth(), settings.getHeight());
logger.fine("Display restarted.");
} else if (Display.wasResized()) {
int newWidth = Display.getWidth();
int newHeight = Display.getHeight();
settings.setResolution(newWidth, newHeight);
listener.reshape(newWidth, newHeight);
}
super.runLoop();
}
代码示例来源:origin: crashinvaders/gdx-texture-packer-gui
private void saveWindowParams() {
int width = Display.getWidth();
int height = Display.getHeight();
int x = Display.getX();
int y = Display.getY();
//FIXME For some reason actual window position shifted by 6 pixels on Windows (by 12 at y when maximized).
if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS) {
x += 6;
y += 6;
}
Preferences prefs = Gdx.app.getPreferences("window_params.xml");
prefs.putInteger("x", x);
prefs.putInteger("y", y);
prefs.putInteger("width", width);
prefs.putInteger("height", height);
prefs.flush();
}
}
内容来源于网络,如有侵权,请联系作者删除!