Java 类org.lwjgl.util.glu.GLU 实例源码
项目:DecompiledMinecraft
文件:ActiveRenderInfo.java
/**
* 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);
}
项目:DecompiledMinecraft
文件:GLAllocation.java
/**
* 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;
}
}
项目:DecompiledMinecraft
文件:Minecraft.java
/**
* 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);
}
}
}
项目:BaseClient
文件:Shaders.java
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;
}
项目:BaseClient
文件:ActiveRenderInfo.java
/**
* 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);
}
项目:BaseClient
文件:EntityRenderer.java
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);
}
}
}
}
项目:BaseClient
文件:GLAllocation.java
/**
* 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;
}
}
项目:BaseClient
文件:Minecraft.java
/**
* 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);
}
}
}
项目:BaseClient
文件:ActiveRenderInfo.java
/**
* 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);
}
项目:BaseClient
文件:EntityRenderer.java
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);
}
}
}
}
项目:BaseClient
文件:GLAllocation.java
/**
* 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;
}
}
项目:Defier
文件:ClientProxy.java
@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());
}
项目:Solar
文件:RenderHelper.java
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!]");
}
项目:Backmemed
文件:Shaders.java
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;
}
项目:Backmemed
文件:RenderUtils.java
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();
}
项目:Backmemed
文件:ActiveRenderInfo.java
/**
* 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);
}
项目:Backmemed
文件:EntityRenderer.java
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);
}
}
}
}
项目:Backmemed
文件:GLAllocation.java
/**
* 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;
}
}
项目:CustomWorldGen
文件:ActiveRenderInfo.java
/**
* 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);
}
项目:CustomWorldGen
文件:GLAllocation.java
/**
* 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;
}
}
项目:PhET
文件:EarthTexture.java
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 );
}
项目:Gaalop
文件:LwJglRenderingEngine.java
/**
* 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}
}
项目:It-s-About-Time-Minecraft-Mod
文件:ProxyClient.java
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();
}
项目:It-s-About-Time-Minecraft-Mod
文件:ProxyClient.java
public void drawCylinder(ResourceLocation texture) {
Cylinder cylinder = new Cylinder();
cylinder.setDrawStyle(GLU.GLU_FILL);
cylinder.setNormals(GLU.GLU_SMOOTH);
cylinder.setOrientation(GLU.GLU_OUTSIDE);
cylinderId = GL11.glGenLists(1);
GL11.glNewList(cylinderId, GL11.GL_COMPILE);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
cylinder.draw(0.5F, 0.5F, 10, 10, 2);
GL11.glEndList();
cylinder.setDrawStyle(GLU.GLU_FILL);
cylinder.setNormals(GLU.GLU_SMOOTH);
cylinder.setOrientation(GLU.GLU_INSIDE);
secondcylinderId = GL11.glGenLists(2);
GL11.glNewList(secondcylinderId, GL11.GL_COMPILE);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
cylinder.draw(0.49F, 0.49F, 10, 10, 2);
GL11.glEndList();
}
项目:Resilience-Client-Source
文件:ActiveRenderInfo.java
/**
* Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
*/
public static void updateRenderInfo(EntityPlayer par0EntityPlayer, boolean par1)
{
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
float var2 = (float)((viewport.get(0) + viewport.get(2)) / 2);
float var3 = (float)((viewport.get(1) + viewport.get(3)) / 2);
GLU.gluUnProject(var2, var3, 0.0F, modelview, projection, viewport, objectCoords);
objectX = objectCoords.get(0);
objectY = objectCoords.get(1);
objectZ = objectCoords.get(2);
int var4 = par1 ? 1 : 0;
float var5 = par0EntityPlayer.rotationPitch;
float var6 = par0EntityPlayer.rotationYaw;
rotationX = MathHelper.cos(var6 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
rotationZ = MathHelper.sin(var6 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
rotationYZ = -rotationZ * MathHelper.sin(var5 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
rotationXY = rotationX * MathHelper.sin(var5 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
rotationXZ = MathHelper.cos(var5 * (float)Math.PI / 180.0F);
}
项目:NeoTextureEdit2
文件:OpenGLTextureRenderCanvas.java
void initGLState() {
GL11.glViewport(0, 0, getWidth(), getHeight());
GL11.glEnable(GL11.GL_DEPTH_TEST);
//GL11.glClearColor(62.0f / 100.0f, 77.0f / 100.0f, 100.0f / 100.0f, 1.0f);
GL11.glClearColor(64.0f / 255.0f, 64.0f / 255.0f, 64.0f / 255.0f, 1.0f);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluPerspective(60.0f, (float)GLXres/(float)GLYres, 0.1f, 100.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
previewProgram = getShaderProgram(previewVertexShader, previewFragmentShader);
loadShaderLocations();
// hmm: temp initialization here
// create the empty textures (later they are updated from the channels)
texidDiffuse = create2dTexture(0x7F7FFFFF);
texidNormal = create2dTexture(0x7F7FFFFF);
texidSpecWeight = create2dTexture(0xFFFFFFFF);
texidHeightmap = create2dTexture(0xFFFFFFFF);
}
项目:NeoTextureEdit2
文件:OpenGLTextureRenderCanvas.java
public int create2dTexture(int color) {
int id = genTexID();
IntBuffer ibuf = bbuf.asIntBuffer();
for (int i = 0; i < ibuf.capacity(); i++) ibuf.put(i, color);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, id);
int targetFormat = GL11.GL_RGBA;
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, targetFormat, TEXTURE_RESX, TEXTURE_RESY, 0, GL11.GL_RGBA,
GL11.GL_UNSIGNED_BYTE, bbuf.asIntBuffer());
GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, targetFormat, TEXTURE_RESX, TEXTURE_RESY, GL11.GL_RGBA,
GL11.GL_UNSIGNED_BYTE, bbuf);
return id;
}
项目:SMEditClassic
文件:JGLCanvas.java
private void doEye()
{
int mouseX = Mouse.getX();
int mouseY = Mouse.getY();
FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
FloatBuffer projection = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
IntBuffer viewport = BufferUtils.createIntBuffer(16);
GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
float winX = mouseX;
float winY = viewport.get(3) - mouseY;
FloatBuffer winZBuffer = BufferUtils.createFloatBuffer(1);
GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZBuffer);
float winZ = winZBuffer.get(0);
FloatBuffer pos = BufferUtils.createFloatBuffer(3);
GLU.gluUnProject(winX, winY, winZ, modelview, projection, viewport, pos);
mEyeRay = new Point3f(pos.get(0), pos.get(1), pos.get(2));
}
项目:ExpandedRailsMod
文件:ActiveRenderInfo.java
/**
* 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);
}
项目:ExpandedRailsMod
文件:GLAllocation.java
/**
* 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;
}
}
项目:JediUtil-Deprecated
文件:Game.java
public void perFrameGL()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glShadeModel(GL_SMOOTH);
glMatrixMode(GL_PROJECTION);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glLoadIdentity();
GLU.gluPerspective(50f, SX/ SY, 0.01f, 100f);
GLU.gluLookAt(-10,0,0,0,0,0,0,0,0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
}
项目:tectonicus
文件:MatrixUtil.java
public static void testLookAtMatrix(Vector3f eye, Vector3f center, Vector3f up)
{
// Make a lookat matrix in opengl and pull it out into a Matrix4f
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GLU.gluLookAt(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z);
FloatBuffer fromGlBuffer = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_MODELVIEW, fromGlBuffer);
Matrix4f fromGl = new Matrix4f();
fromGl.load(fromGlBuffer);
Matrix4f manual = createLookAt(eye, center, up);
compare(fromGl, manual);
}
项目:Cauldron
文件:ActiveRenderInfo.java
public static void updateRenderInfo(EntityPlayer p_74583_0_, boolean p_74583_1_)
{
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, 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);
objectX = objectCoords.get(0);
objectY = objectCoords.get(1);
objectZ = objectCoords.get(2);
int i = p_74583_1_ ? 1 : 0;
float f2 = p_74583_0_.rotationPitch;
float f3 = p_74583_0_.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);
}
项目:Cauldron
文件:ActiveRenderInfo.java
public static void updateRenderInfo(EntityPlayer p_74583_0_, boolean p_74583_1_)
{
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, 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);
objectX = objectCoords.get(0);
objectY = objectCoords.get(1);
objectZ = objectCoords.get(2);
int i = p_74583_1_ ? 1 : 0;
float f2 = p_74583_0_.rotationPitch;
float f3 = p_74583_0_.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);
}
项目:RuneCraftery
文件:ActiveRenderInfo.java
public static void func_74583_a(EntityPlayer p_74583_0_, boolean p_74583_1_) {
GL11.glGetFloat(2982, field_74594_j);
GL11.glGetFloat(2983, field_74595_k);
GL11.glGetInteger(2978, field_74597_i);
float var2 = (float)((field_74597_i.get(0) + field_74597_i.get(2)) / 2);
float var3 = (float)((field_74597_i.get(1) + field_74597_i.get(3)) / 2);
GLU.gluUnProject(var2, var3, 0.0F, field_74594_j, field_74595_k, field_74597_i, field_74593_l);
field_74592_a = field_74593_l.get(0);
field_74590_b = field_74593_l.get(1);
field_74591_c = field_74593_l.get(2);
int var4 = p_74583_1_?1:0;
float var5 = p_74583_0_.field_70125_A;
float var6 = p_74583_0_.field_70177_z;
field_74588_d = MathHelper.func_76134_b(var6 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
field_74586_f = MathHelper.func_76126_a(var6 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
field_74587_g = -field_74586_f * MathHelper.func_76126_a(var5 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
field_74596_h = field_74588_d * MathHelper.func_76126_a(var5 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
field_74589_e = MathHelper.func_76134_b(var5 * 3.1415927F / 180.0F);
}
项目:RuneCraftery
文件:ActiveRenderInfo.java
/**
* Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
*/
public static void updateRenderInfo(EntityPlayer par0EntityPlayer, boolean par1)
{
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, 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);
objectX = objectCoords.get(0);
objectY = objectCoords.get(1);
objectZ = objectCoords.get(2);
int i = par1 ? 1 : 0;
float f2 = par0EntityPlayer.rotationPitch;
float f3 = par0EntityPlayer.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);
}
项目:SMEdit
文件:JGLCanvas.java
private void doEye() {
int mouseX = Mouse.getX();
int mouseY = Mouse.getY();
FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
FloatBuffer projection = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
IntBuffer viewport = BufferUtils.createIntBuffer(16);
GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
float winX = mouseX;
float winY = viewport.get(3) - mouseY;
FloatBuffer winZBuffer = BufferUtils.createFloatBuffer(1);
GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZBuffer);
float winZ = winZBuffer.get(0);
FloatBuffer pos = BufferUtils.createFloatBuffer(3);
GLU.gluUnProject(winX, winY, winZ, modelview, projection, viewport, pos);
mEyeRay = new Point3f(pos.get(0), pos.get(1), pos.get(2));
}
项目:VoxelDungeon
文件:Game.java
public void initialize3D() {
//GL11.glEnable(GL11.GL_TEXTURE_2D); // Allows 2D textures.
GL11.glShadeModel(GL11.GL_SMOOTH); // Smoother textures.
GL11.glClearColor(0.4f,0.6f,1.0f,0.0f); // BG color. 6698FF
GL11.glClearDepth(1.0); // Buffer depth, allows objects to draw over things behind them.
GL11.glEnable(GL11.GL_DEPTH_TEST); // Depth testing (see above).
GL11.glDepthFunc(GL11.GL_LEQUAL); // Type of depth testing.
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
GL11.glMatrixMode(GL11.GL_PROJECTION); // Sets matrix mode to displaying pixels.
GL11.glLoadIdentity(); // Loads the above matrix mode.
// Sets default perspective location. Render Distances: Min Max
GLU.gluPerspective(45.0f,(float)Display.getWidth()/(float)Display.getHeight(),0.1f,300.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW); // Sets the matrix to displaying objects.
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT,GL11.GL_NICEST); // Something unimportant for quality.
GL11.glEnable(GL11.GL_CULL_FACE);
}
项目:cnctools
文件:View3D.java
@Override
public void begin() {
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glLoadIdentity();
if (camera.isOrtho()) {
GL11.glOrtho(-camera.getX(), camera.getX(), -camera.getY(), camera.getY(), -NEAR, FAR);
} else {
GLU.gluPerspective(camera.getFOVY(), camera.getWidth() / camera.getHeight(), NEAR, FAR);
}
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
GL11.glLoadIdentity();
}
项目:BetterNutritionMod
文件:ActiveRenderInfo.java
/**
* Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
*/
public static void updateRenderInfo(EntityPlayer par0EntityPlayer, boolean par1)
{
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, 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);
objectX = objectCoords.get(0);
objectY = objectCoords.get(1);
objectZ = objectCoords.get(2);
int i = par1 ? 1 : 0;
float f2 = par0EntityPlayer.rotationPitch;
float f3 = par0EntityPlayer.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);
}