本文整理匯總了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);
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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());
}
示例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!]");
}
示例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();
}
示例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);
}
示例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);
}
}
}
}
示例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;
}
}
示例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 );
}
示例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}
}
示例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();
}