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


Java GL11.glViewport方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:20,代码来源:Window.java

示例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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:ImmediateModeOGLRenderer.java

示例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();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:22,代码来源:FBOGraphics.java

示例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();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:22,代码来源:PBufferUniqueGraphics.java

示例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();
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:17,代码来源:DisplayManager.java

示例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();
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyTerrain,代码行数:20,代码来源:Window.java

示例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());
	}
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:21,代码来源:View.java

示例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);
}
 
开发者ID:DevipriyaSarkar,项目名称:Terrain,代码行数:17,代码来源:DisplayManager.java

示例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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:36,代码来源:TestUtils.java

示例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");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:Shaders.java

示例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);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:4,代码来源:OpenGLHelper.java

示例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();
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:6,代码来源:WaterFrameBuffers.java

示例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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:GlStateManager.java

示例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());
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:5,代码来源:FrameBuffer.java

示例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());
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:9,代码来源:Fbo.java


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