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


Java GL11.glOrtho方法代码示例

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


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

示例1: enterOrtho

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#enterOrtho(int, int)
 */
public void enterOrtho(int xsize, int ysize) {
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	GL11.glOrtho(0, width, height, 0, 1, -1);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	
	GL11.glTranslatef((width-xsize)/2,
					  (height-ysize)/2,0);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:ImmediateModeOGLRenderer.java

示例2: enterOrtho

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Enter the orthographic mode 
 */
protected void enterOrtho() {
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	GL11.glOrtho(0, screenWidth, 0, screenHeight, 1, -1);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:10,代码来源:FBOGraphics.java

示例3: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render()
{
    //Make camera rotation matrix (no translation) to draw skybox.
    GraphicsUtil.glLoadMatrix(camera.projMat, GL11.GL_PROJECTION);
    GraphicsUtil.glLoadMatrix(Mat3.rotation(Quat.invert(camera.dir)), GL11.GL_MODELVIEW);
    
    skybox.render();
    
    //Load proper camera matrix to draw world.
    GraphicsUtil.glLoadMatrix(camera.viewMat, GL11.GL_MODELVIEW);
    
    floor.render();
    space.render();
    
    //Load screen matrix to draw HUD.
    Vec2i res = getResolution();
    if (res.x <= 0 || res.y <= 0) return;
    
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(-res.x*0.5f, res.x*0.5f, -res.y*0.5f, res.y*0.5f, -1.0f, 1.0f);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    
    if (menu == null && !displayMouse && interactionState == defaultState)
        crosshair.renderCrosshair();
    
    if (menu != null) menu.render(1.0f);
}
 
开发者ID:SmashMaster,项目名称:KraftigAudio,代码行数:31,代码来源:Main.java

示例4: 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

示例5: ortho

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void ortho(double left, double right, double bottom, double top, double zNear, double zFar)
{
    GL11.glOrtho(left, right, bottom, top, zNear, zFar);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:GlStateManager.java

示例6: runShader

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void runShader() {
	Minecraft mc = Minecraft.getMinecraft();
	
	//TODO remove
	if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)) {
		destroyShader();
		createShader();
	}
	
	//Use shader program
	GL20.glUseProgram(shader.getShaderProgram());
	
	//TODO third person view
	Entity entity = mc.getRenderViewEntity();
	float partialTicks = mc.getRenderPartialTicks();
	double entityPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
       double entityPosY = entity.lastTickPosY + entity.getEyeHeight() + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
       double entityPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
       float fov = (float) Math.toRadians(mc.entityRenderer.getFOVModifier(partialTicks, true));
	
	//Set uniform values
	int texUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "tex");
	GL20.glUniform1i(texUniform, 0);
	int cameraPosUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "cameraPos");
	GL20.glUniform3f(cameraPosUniform, (float)entityPosX%16, (float)entityPosY%16, (float)entityPosZ%16);
	int cameraDirUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "cameraDir");
	GL20.glUniform3f(cameraDirUniform, -(float)Math.toRadians(entity.rotationPitch), (float)Math.toRadians(180+entity.rotationYaw), 0);
	int fovyUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "fovy");
	GL20.glUniform1f(fovyUniform, fov);
	int fovxUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "fovx");
	GL20.glUniform1f(fovxUniform, fov*Display.getWidth()/(float)Display.getHeight());
	int sphericalUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "spherical");
	GL20.glUniform1i(sphericalUniform, RayTracerSettings.spherical ? 1 : 0);
	int stereoscopicUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "stereoscopic3d");
	GL20.glUniform1i(stereoscopicUniform, RayTracerSettings.stereoscopic ? 1 : 0);
	int eyeWidthUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "eyeWidth");
	GL20.glUniform1f(eyeWidthUniform, 0.063f); //TODO input eyeWidth option
	
	if (!pauseRendering) {
		if (worldLoader == null) {
			worldLoader = new WorldLoader();
		}
		if (worldLoader.dimension != mc.world.provider.getDimension()) {
			worldLoader.dimension = mc.world.provider.getDimension();
		}
		worldLoader.updateWorld(entityPosX, entityPosY, entityPosZ, shader);

		//Setup view
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glPushMatrix();
		GL11.glLoadIdentity();
		GL11.glOrtho(-1, 1, -1, 1, -1, 1);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glPushMatrix();
		GL11.glLoadIdentity();

		//Bind vbo and texture
		GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, shader.getVbo());
		GL20.glEnableVertexAttribArray(0);
		GL20.glVertexAttribPointer(0, 2, GL11.GL_BYTE, false, 0, 0L);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 8);

		//Render
		GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 6);

		//Reset vbo and texture
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
		GL20.glDisableVertexAttribArray(0);
		GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

		//Reset view
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glPopMatrix();
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glPopMatrix();
	}
	
	//Stop using shader program
	GL20.glUseProgram(0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:81,代码来源:RenderUtil.java

示例7: prepRender

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void prepRender(){
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	GL11.glOrtho(0.0, Window.instance.getWidth(), Window.instance.getHeight(), 0.0, -1.0, 1.0);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
 
开发者ID:tek256,项目名称:LD38,代码行数:7,代码来源:UIFont.java

示例8: setOrtho

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
    Configures camera for GUI drawing
*/
public static void setOrtho(){
    GL11.glOrtho(0.0D, ZWrapper.getScaledWidthD(), ZWrapper.getScaledHeightD(), 0.0D, 1000.0D, 3000.0D);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:7,代码来源:GuiHelper.java


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