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


Java GL11.glLight方法代码示例

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


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

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

示例2: enableStandardItemLighting

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Sets the OpenGL lighting properties to the values used when rendering blocks as items
 */
public static void enableStandardItemLighting()
{
    GlStateManager.enableLighting();
    GlStateManager.enableLight(0);
    GlStateManager.enableLight(1);
    GlStateManager.enableColorMaterial();
    GlStateManager.colorMaterial(1032, 5634);
    float f = 0.4F;
    float f1 = 0.6F;
    float f2 = 0.0F;
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, (FloatBuffer)setColorBuffer(LIGHT0_POS.xCoord, LIGHT0_POS.yCoord, LIGHT0_POS.zCoord, 0.0D));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, (FloatBuffer)setColorBuffer(f1, f1, f1, 1.0F));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, (FloatBuffer)setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, (FloatBuffer)setColorBuffer(f2, f2, f2, 1.0F));
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, (FloatBuffer)setColorBuffer(LIGHT1_POS.xCoord, LIGHT1_POS.yCoord, LIGHT1_POS.zCoord, 0.0D));
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer)setColorBuffer(f1, f1, f1, 1.0F));
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer)setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_SPECULAR, (FloatBuffer)setColorBuffer(f2, f2, f2, 1.0F));
    GlStateManager.shadeModel(7424);
    GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, (FloatBuffer)setColorBuffer(f, f, f, 1.0F));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:RenderHelper.java

示例3: glLight

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void glLight(int light, int pname, FloatBuffer params)
{
    GL11.glLight(light, pname, params);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:GlStateManager.java


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