本文整理汇总了Java中org.lwjgl.opengl.GL11.glViewport方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glViewport方法的具体用法?Java GL11.glViewport怎么用?Java GL11.glViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glViewport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Window
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
this.fpsCap = settings.getFpsCap();
try {
getSuitableFullScreenModes();
DisplayMode resolution = getStartResolution(settings);
Display.setInitialBackground(0f, 0f, 0f);
this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
setResolution(resolution, settings.isFullScreen());
if (settings.hasIcon()) {
Display.setIcon(settings.getIcon());
}
Display.setVSyncEnabled(settings.isvSync());
Display.setTitle(settings.getTitle());
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例2: initDisplay
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.renderer.SGL#initDisplay(int, int)
*/
public void initDisplay(int width, int height) {
this.width = width;
this.height = height;
String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,width,height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
示例3: initGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Initialise the GL context
*/
protected void initGL() {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,screenWidth,screenHeight);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
enterOrtho();
}
示例4: initGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Initialise the GL context
*/
protected void initGL() {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,screenWidth,screenHeight);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
enterOrtho();
}
示例5: createDisplay
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void createDisplay() {
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
ContextAttribs attribs = new ContextAttribs(3, 2).withProfileCore(true).withForwardCompatible(true);
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), attribs);
Display.setTitle(TITLE);
Display.setInitialBackground(1, 1, 1);
GL11.glEnable(GL13.GL_MULTISAMPLE);
} catch (LWJGLException e) {
e.printStackTrace();
System.err.println("Couldn't create display!");
System.exit(-1);
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
示例6: Window
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
this.fpsCap = settings.getFpsCap();
try {
getSuitableFullScreenModes();
DisplayMode resolution = getStartResolution(settings);
Display.setInitialBackground(1, 1, 1);
this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
setResolution(resolution, settings.isFullScreen());
if (settings.hasIcon()) {
Display.setIcon(settings.getIcon());
}
Display.setVSyncEnabled(settings.isvSync());
Display.setTitle(settings.getTitle());
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例7: updateViewPort
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void updateViewPort(ViewPort viewport)
{
if (viewport == this.defaultViewPort)
{
//FIXME: This is a fix (hack?) for Mac's weird hack to scale windows for compatibility
try (MemoryStack stack = MemoryStack.stackPush())
{
IntBuffer pWidth = stack.mallocInt(1);
IntBuffer pHeight = stack.mallocInt(1);
GLFW.glfwGetFramebufferSize(this.window.handle(), pWidth, pHeight);
GL11.glViewport(0, 0, pWidth.get(0), pHeight.get(0));
}
}
else
{
GL11.glViewport(viewport.getX(), viewport.getY(),
viewport.getWidth(), viewport.getHeight());
}
}
示例8: createDisplay
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void createDisplay() {
// OpenGL version used
ContextAttribs attribs = new ContextAttribs(3, 2)
.withForwardCompatible(true)
.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle(TITLE);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
}
示例9: initGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Initialise the GL display
*
* @param width The width of the display
* @param height The height of the display
*/
private void initGL(int width, int height) {
try {
Display.setDisplayMode(new DisplayMode(width,height));
Display.create();
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,width,height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, width, height, 0, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
示例10: beginRenderPass
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void beginRenderPass(int pass, float partialTicks, long finishTimeNano)
{
if (!isShadowPass)
{
EXTFramebufferObject.glBindFramebufferEXT(36160, dfb);
GL11.glViewport(0, 0, renderWidth, renderHeight);
activeDrawBuffers = null;
ShadersTex.bindNSTextures(defaultTexture.getMultiTexID());
useProgram(2);
checkGLError("end beginRenderPass");
}
}
示例11: viewport
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void viewport(int x, int y, int width, int height) {
GL11.glViewport(x, y, width, height);
}
示例12: unbindCurrentFrameBuffer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void unbindCurrentFrameBuffer() {//call after rendering to texture
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
GL11.glFinish();
}
示例13: viewport
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void viewport(int x, int y, int width, int height)
{
GL11.glViewport(x, y, width, height);
}
示例14: unbind
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void unbind() {
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
GL11.glViewport(0, 0, Application.WINDOW.getWidth(), Application.WINDOW.getHeight());
}
示例15: unbindAfterRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Switch back to the default frame buffer.
*/
public void unbindAfterRender() {
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0);
GL11.glDrawBuffer(GL11.GL_BACK);
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
}