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


Java GL11.glLoadIdentity方法代码示例

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


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

示例1: 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:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:PBufferUniqueGraphics.java

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

示例3: renderGL

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Render the GL scene, this isn't efficient and if you know 
 * OpenGL I'm assuming you can see why. If not, you probably
 * don't want to use this feature anyway
 */
public void renderGL() {		
	FloatBuffer pos = BufferUtils.createFloatBuffer(4);
	pos.put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}).flip();
	FloatBuffer red = BufferUtils.createFloatBuffer(4);
	red.put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}).flip();

	GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
	GL11.glEnable(GL11.GL_LIGHT0);

	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_LIGHTING);
	
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	float h = (float) 600 / (float) 800;
	GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glLoadIdentity();	
	GL11.glTranslatef(0.0f, 0.0f, -40.0f);	
	GL11.glRotatef(rot,0,1,1);		
	
	GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
	gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:31,代码来源:SlickCallableTest.java

示例4: enableLighting

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void enableLighting() {
    GL11.glDisable((int)3042);
    GL11.glEnable((int)3553);
    GL11.glDisable((int)2848);
    GL11.glDisable((int)3042);
    OpenGlHelper.setActiveTexture((int)OpenGlHelper.lightmapTexUnit);
    GL11.glMatrixMode((int)5890);
    GL11.glLoadIdentity();
    float var3 = 0.0039063f;
    GL11.glScalef((float)var3, (float)var3, (float)var3);
    GL11.glTranslatef((float)8.0f, (float)8.0f, (float)8.0f);
    GL11.glMatrixMode((int)5888);
    GL11.glTexParameteri((int)3553, (int)10241, (int)9729);
    GL11.glTexParameteri((int)3553, (int)10240, (int)9729);
    GL11.glTexParameteri((int)3553, (int)10242, (int)10496);
    GL11.glTexParameteri((int)3553, (int)10243, (int)10496);
    GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
    OpenGlHelper.setActiveTexture((int)OpenGlHelper.defaultTexUnit);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:RenderUtils.java

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

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

示例7: 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,代码来源:PBufferGraphics.java

示例8: 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:IngSW-unipv,项目名称:Progetto-C,代码行数:36,代码来源:TestUtils.java

示例9: loadIdentity

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void loadIdentity()
{
    GL11.glLoadIdentity();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:GlStateManager.java

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


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