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


Java GLU类代码示例

本文整理汇总了Java中org.lwjgl.util.glu.GLU的典型用法代码示例。如果您正苦于以下问题:Java GLU类的具体用法?Java GLU怎么用?Java GLU使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
    GlStateManager.getFloat(2982, MODELVIEW);
    GlStateManager.getFloat(2983, PROJECTION);
    GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT);
    float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
    float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
    position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
    int i = p_74583_1_ ? 1 : 0;
    float f2 = entityplayerIn.rotationPitch;
    float f3 = entityplayerIn.rotationYaw;
    rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:ActiveRenderInfo.java

示例2: generateDisplayLists

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
/**
 * Generates the specified number of display lists and returns the first index.
 */
public static synchronized int generateDisplayLists(int range)
{
    int i = GL11.glGenLists(range);

    if (i == 0)
    {
        int j = GL11.glGetError();
        String s = "No error code reported";

        if (j != 0)
        {
            s = GLU.gluErrorString(j);
        }

        throw new IllegalStateException("glGenLists returned an ID of 0 for a count of " + range + ", GL error (" + j + "): " + s);
    }
    else
    {
        return i;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:GLAllocation.java

示例3: checkGLError

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
/**
 * Checks for an OpenGL error. If there is one, prints the error ID and error string.
 */
private void checkGLError(String message)
{
    if (this.enableGLErrorChecking)
    {
        int i = GL11.glGetError();

        if (i != 0)
        {
            String s = GLU.gluErrorString(i);
            logger.error("########## GL ERROR ##########");
            logger.error("@ " + message);
            logger.error(i + ": " + s);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:Minecraft.java

示例4: checkGLError

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
public static int checkGLError(String location)
{
    int i = GL11.glGetError();

    if (i != 0)
    {
        boolean flag = false;

        if (!flag)
        {
            if (i == 1286)
            {
                int j = EXTFramebufferObject.glCheckFramebufferStatusEXT(36160);
                System.err.format("GL error 0x%04X: %s (Fb status 0x%04X) at %s\n", new Object[] {Integer.valueOf(i), GLU.gluErrorString(i), Integer.valueOf(j), location});
            }
            else
            {
                System.err.format("GL error 0x%04X: %s at %s\n", new Object[] {Integer.valueOf(i), GLU.gluErrorString(i), location});
            }
        }
    }

    return i;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:Shaders.java

示例5: frameFinish

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
private void frameFinish()
{
    if (this.mc.theWorld != null)
    {
        long i = System.currentTimeMillis();

        if (i > this.lastErrorCheckTimeMs + 10000L)
        {
            this.lastErrorCheckTimeMs = i;
            int j = GL11.glGetError();

            if (j != 0)
            {
                String s = GLU.gluErrorString(j);
                ChatComponentText chatcomponenttext = new ChatComponentText(I18n.format("of.message.openglError", new Object[] {Integer.valueOf(j), s}));
                this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext);
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:EntityRenderer.java

示例6: frameFinish

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
private void frameFinish() {
	if (this.mc.theWorld != null) {
		long i = System.currentTimeMillis();

		if (i > this.lastErrorCheckTimeMs + 10000L) {
			this.lastErrorCheckTimeMs = i;
			int j = GL11.glGetError();

			if (j != 0) {
				String s = GLU.gluErrorString(j);
				ChatComponentText chatcomponenttext = new ChatComponentText(
						"\u00a7eOpenGL Error\u00a7f: " + j + " (" + s + ")");
				this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext);
			}
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:EntityRenderer.java

示例7: init

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
@Override
public void init(FMLInitializationEvent e) {
	super.init(e);
	{
		Sphere sphere = new Sphere();
		sphere.setDrawStyle(GLU.GLU_FILL);
		sphere.setNormals(GLU.GLU_SMOOTH);
		sphere.setOrientation(GLU.GLU_OUTSIDE);

		defierSphereIdOutside = GL11.glGenLists(1);
		GL11.glNewList(defierSphereIdOutside, GL11.GL_COMPILE);
		sphere.draw(0.5F, 30, 30);
		GL11.glEndList();

		sphere.setOrientation(GLU.GLU_INSIDE);
		defierSphereIdInside = GL11.glGenLists(1);
		GL11.glNewList(defierSphereIdInside, GL11.GL_COMPILE);
		sphere.draw(0.5F, 30, 30);
		GL11.glEndList();
	}
	ClientRegistry.bindTileEntitySpecialRenderer(DefierTileEntity.class, new DefierTESR());
	ClientRegistry.bindTileEntitySpecialRenderer(EnergyProviderTileEntity.class, new EnergyProviderTESR());
}
 
开发者ID:tiffit,项目名称:Defier,代码行数:24,代码来源:ClientProxy.java

示例8: bake

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
public static void bake() {
	//--------------------Sphere--------------------//
	sphere = addDraw(new Sphere(), GLU.GLU_FILL, GLU.GLU_FLAT, form -> form.draw(1F, 16, 16));

	//---------------------Cube---------------------//
	cube = addDraw(new Cube(), GLU.GLU_FILL, GLU.GLU_FLAT, Cube::draw);

	//-----------------Json Models-----------------//
	for(BlockBaker model : BlockBaker.values()) {
		try {
			model.bake();
		} catch(Exception e) {
			Solar.LOG.fatal("[Model Bakery] Failed to bake json model: " + model.getLocation().toString());
			e.printStackTrace();
		}
	}
	Solar.LOG.info("[PIE HAS BEEN SUCCESSFULLY BAKED!]");
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:19,代码来源:RenderHelper.java

示例9: drawSphere

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
public static void drawSphere(double x, double y, double z, float size, int slices, int stacks) {
	final Sphere s = new Sphere();
	GL11.glPushMatrix();
	GL11.glBlendFunc(770, 771);
	GL11.glEnable(GL_BLEND);
	GL11.glLineWidth(1.2F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL_DEPTH_TEST);
	GL11.glDepthMask(false);
	s.setDrawStyle(GLU.GLU_SILHOUETTE);
	GL11.glTranslated(x - RenderManager.renderPosX, y - RenderManager.renderPosY, z - RenderManager.renderPosZ);
	s.draw(size, slices, stacks);
	GL11.glLineWidth(2.0F);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL_BLEND);
	GL11.glPopMatrix();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:RenderUtils.java

示例10: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
    GlStateManager.getFloat(2982, MODELVIEW);
    GlStateManager.getFloat(2983, PROJECTION);
    GlStateManager.glGetInteger(2978, VIEWPORT);
    float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
    float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
    position = new Vec3d((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
    int i = p_74583_1_ ? 1 : 0;
    float f2 = entityplayerIn.rotationPitch;
    float f3 = entityplayerIn.rotationYaw;
    rotationX = MathHelper.cos(f3 * 0.017453292F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * 0.017453292F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * 0.017453292F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * 0.017453292F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * 0.017453292F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:ActiveRenderInfo.java

示例11: frameFinish

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
private void frameFinish()
{
    if (this.mc.world != null)
    {
        long i = System.currentTimeMillis();

        if (i > this.lastErrorCheckTimeMs + 10000L)
        {
            this.lastErrorCheckTimeMs = i;
            int j = GlStateManager.glGetError();

            if (j != 0)
            {
                String s = GLU.gluErrorString(j);
                TextComponentString textcomponentstring = new TextComponentString(I18n.format("of.message.openglError", new Object[] {Integer.valueOf(j), s}));
                this.mc.ingameGUI.getChatGUI().printChatMessage(textcomponentstring);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:EntityRenderer.java

示例12: generateDisplayLists

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
/**
 * Generates the specified number of display lists and returns the first index.
 */
public static synchronized int generateDisplayLists(int range)
{
    int i = GlStateManager.glGenLists(range);

    if (i == 0)
    {
        int j = GlStateManager.glGetError();
        String s = "No error code reported";

        if (j != 0)
        {
            s = GLU.gluErrorString(j);
        }

        throw new IllegalStateException("glGenLists returned an ID of 0 for a count of " + range + ", GL error (" + j + "): " + s);
    }
    else
    {
        return i;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:GLAllocation.java

示例13: begin

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
public static void begin() {
    glEnable( GL_TEXTURE_2D );

    // one-time only we bind the texture, create mip-maps so it can be nicely viewed at any distance, etc.
    if ( !textureInitialized ) {
        textureInitialized = true;
        textureId = glGenTextures();
        glBindTexture( GL_TEXTURE_2D, textureId );

        glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
                         GL_LINEAR_MIPMAP_NEAREST );
        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

        // repeat
        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

        GLU.gluBuild2DMipmaps( GL_TEXTURE_2D, 4, WIDTH, HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
    }

    // from then on, we always use the bound texture ID to efficiently show the stored texture
    glBindTexture( GL_TEXTURE_2D, textureId );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:EarthTexture.java

示例14: changeSize

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
/**
 * Changes the size of the lwjgl window
 * @param w The new width of the lwjgl window
 * @param h The new height of the lwjgl window
 */
private void changeSize(float w, float h) {
    // Prevent a division by zero, when window is too short
    if (h == 0) {
        h = 1;
    }
    float wRatio = 1.0f * w / h;
    // Reset the coordinate system before modifying
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    // Set the viewport to be the entire window
    GL11.glViewport(0, 0, (int) w, (int) h);
    // Set the correct perspective.
    GLU.gluPerspective(45.0f, wRatio, (float) near, (float) far);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GLU.gluLookAt(camPos.x, camPos.y, camPos.z, // Position
            camPos.x + camDir.x, camPos.y + camDir.y, camPos.z + camDir.z, // Lookat
            camUp.x, camUp.y, camUp.z);               // Up-direction}
}
 
开发者ID:CallForSanity,项目名称:Gaalop,代码行数:25,代码来源:LwJglRenderingEngine.java

示例15: drawCircle

import org.lwjgl.util.glu.GLU; //导入依赖的package包/类
public  void drawCircle(ResourceLocation texture) {
	Sphere sphere = new Sphere();
	sphere.setDrawStyle(GLU.GLU_FILL);
	sphere.setNormals(GLU.GLU_SMOOTH);
	sphere.setOrientation(GLU.GLU_OUTSIDE);
	sphereId = GL11.glGenLists(1);
	GL11.glNewList(sphereId, GL11.GL_COMPILE);
	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
	sphere.draw(0.5F, 32, 32);
	GL11.glEndList();
	sphere.setDrawStyle(GLU.GLU_FILL);		
	sphere.setNormals(GLU.GLU_SMOOTH);
	sphere.setOrientation(GLU.GLU_INSIDE);
	secondSphereId = GL11.glGenLists(2);
	GL11.glNewList(secondSphereId, GL11.GL_COMPILE);
	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
	sphere.draw(0.49F, 32, 32);
	GL11.glEndList();	
}
 
开发者ID:Alex-the-666,项目名称:It-s-About-Time-Minecraft-Mod,代码行数:20,代码来源:ProxyClient.java


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