List of usage examples for org.lwjgl.opengl GL11 glGetInteger
@NativeType("void") public static int glGetInteger(@NativeType("GLenum") int pname)
From source file:com.xrbpowered.gl.SystemSettings.java
License:Open Source License
public void verifyAnisotropy() { anisotropy = Math.min(anisotropy, GL11.glGetInteger(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)); }
From source file:cpw.mods.fml.client.FMLClientHandler.java
License:Open Source License
public int getEffectTexture(TextureFX effect) { Integer id = effectTextures.get(effect); if (id != null) { return id; }//w w w .j a v a2 s . co m int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D); effect.bindImage(client.renderEngine); id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D); GL11.glBindTexture(GL_TEXTURE_2D, old); effectTextures.put(effect, id); return id; }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
public void makeCurrent() { JFXGLContexts.makeCurrent(this); // if this is the first time, get the caps if (caps == null) { caps = GL.createCapabilities();/* w ww .jav a2 s . c o m*/ majorVersion = GL11.glGetInteger(GL30.GL_MAJOR_VERSION); minorVersion = GL11.glGetInteger(GL30.GL_MINOR_VERSION); } }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
@Override public int getBoundFBO() { return GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
@Override public int getIntParam(int param) { return GL11.glGetInteger(translatePrismToGL(param)); }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
public int getShaderProgram() { return GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM); }
From source file:de.ellpeck.actuallyadditions.mod.util.AssetUtil.java
@SideOnly(Side.CLIENT) public static void renderLaser(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, double rotationTime, float alpha, double beamWidth, float[] color) { Tessellator tessy = Tessellator.getInstance(); VertexBuffer render = tessy.getBuffer(); World world = Minecraft.getMinecraft().world; float r = color[0]; float g = color[1]; float b = color[2]; Vec3d vec1 = new Vec3d(firstX, firstY, firstZ); Vec3d vec2 = new Vec3d(secondX, secondY, secondZ); Vec3d combinedVec = vec2.subtract(vec1); double rot = rotationTime > 0 ? (360D * ((world.getTotalWorldTime() % rotationTime) / rotationTime)) : 0; double pitch = Math.atan2(combinedVec.yCoord, Math.sqrt(combinedVec.xCoord * combinedVec.xCoord + combinedVec.zCoord * combinedVec.zCoord)); double yaw = Math.atan2(-combinedVec.zCoord, combinedVec.xCoord); double length = combinedVec.lengthVector(); GlStateManager.pushMatrix();/*from w w w . j ava 2 s .c o m*/ GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0); GlStateManager.translate(firstX - TileEntityRendererDispatcher.staticPlayerX, firstY - TileEntityRendererDispatcher.staticPlayerY, firstZ - TileEntityRendererDispatcher.staticPlayerZ); GlStateManager.rotate((float) (180 * yaw / Math.PI), 0, 1, 0); GlStateManager.rotate((float) (180 * pitch / Math.PI), 0, 0, 1); GlStateManager.rotate((float) rot, 1, 0, 0); /*if(r != r2 || g != g2 || b != b2){ render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); Minecraft.getMinecraft().renderEngine.bindTexture(ClientUtil.LIGHT_BEAM_GRADIENT); render.pos(length, -beamWidth, beamWidth).tex(0, 0).color(r, g, b, alpha).endVertex(); render.pos(length, beamWidth, beamWidth).tex(0, 1).color(r, g, b, alpha).endVertex(); render.pos(0, beamWidth, beamWidth).tex(1, 1).color(r, g, b, alpha).endVertex(); render.pos(0, -beamWidth, beamWidth).tex(1, 0).color(r, g, b, alpha).endVertex(); render.pos(length, -beamWidth, beamWidth).tex(1, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, beamWidth, beamWidth).tex(1, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, beamWidth, beamWidth).tex(0, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, -beamWidth, beamWidth).tex(0, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, beamWidth, -beamWidth).tex(0, 0).color(r, g, b, alpha).endVertex(); render.pos(length, -beamWidth, -beamWidth).tex(0, 1).color(r, g, b, alpha).endVertex(); render.pos(0, -beamWidth, -beamWidth).tex(1, 1).color(r, g, b, alpha).endVertex(); render.pos(0, beamWidth, -beamWidth).tex(1, 0).color(r, g, b, alpha).endVertex(); render.pos(length, beamWidth, -beamWidth).tex(1, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, -beamWidth, -beamWidth).tex(1, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, -beamWidth, -beamWidth).tex(0, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, beamWidth, -beamWidth).tex(0, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, beamWidth, beamWidth).tex(0, 0).color(r, g, b, alpha).endVertex(); render.pos(length, beamWidth, -beamWidth).tex(0, 1).color(r, g, b, alpha).endVertex(); render.pos(0, beamWidth, -beamWidth).tex(1, 1).color(r, g, b, alpha).endVertex(); render.pos(0, beamWidth, beamWidth).tex(1, 0).color(r, g, b, alpha).endVertex(); render.pos(length, beamWidth, beamWidth).tex(1, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, beamWidth, -beamWidth).tex(1, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, beamWidth, -beamWidth).tex(0, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, beamWidth, beamWidth).tex(0, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, -beamWidth, -beamWidth).tex(0, 0).color(r, g, b, alpha).endVertex(); render.pos(length, -beamWidth, beamWidth).tex(0, 1).color(r, g, b, alpha).endVertex(); render.pos(0, -beamWidth, beamWidth).tex(1, 1).color(r, g, b, alpha).endVertex(); render.pos(0, -beamWidth, -beamWidth).tex(1, 0).color(r, g, b, alpha).endVertex(); render.pos(length, -beamWidth, -beamWidth).tex(1, 0).color(r2, g2, b2, alpha).endVertex(); render.pos(length, -beamWidth, beamWidth).tex(1, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, -beamWidth, beamWidth).tex(0, 1).color(r2, g2, b2, alpha).endVertex(); render.pos(0, -beamWidth, -beamWidth).tex(0, 0).color(r2, g2, b2, alpha).endVertex(); tessy.draw(); } else{*/ GlStateManager.disableTexture2D(); render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); for (double i = 0; i < 4; i++) { double width = beamWidth * (i / 4.0); render.pos(length, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(0, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex(); render.pos(0, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex(); render.pos(length, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(length, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(0, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(0, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex(); render.pos(length, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(length, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(0, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex(); render.pos(0, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex(); render.pos(length, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(length, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(0, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex(); render.pos(0, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); render.pos(length, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha) .endVertex(); } tessy.draw(); GlStateManager.enableTexture2D(); //} GlStateManager.alphaFunc(func, ref); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
From source file:fi.conf.ae.gl.texture.GLTextureRoutines.java
License:LGPL
public static int getBoundTextureID() { return GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); }
From source file:fr.ign.cogit.geoxygene.appli.gl.GLContext.java
License:Open Source License
/** * set the given program as the current program in use (glUse) If the * requested program is already the current one: do nothing * //from w ww .j av a2s. c o m * @param program * program instance * @return false on error */ public GLProgram setCurrentProgram(GLProgram program) throws GLException { if (program == null) { GL20.glUseProgram(0); RenderingStatistics.switchProgram(); this.currentProgram = null; return null; } // check if the current program is already the requested one if (program == this.getCurrentProgram()) { return program; } if (GL20.glIsProgram(program.getProgramId()) == false) { logger.error("Program Id " + program.getProgramId() + " (" + program.getName() + ") is not a valid GL program"); Thread.dumpStack(); GL20.glUseProgram(0); this.currentProgram = null; return null; } GL20.glUseProgram(program.getProgramId()); if (!GLTools.glCheckError("Use program '" + program.getName() + "' id = " + program.getProgramId())) { GL20.glUseProgram(0); this.currentProgram = null; return null; } RenderingStatistics.switchProgram(); this.currentProgram = program; // check correctness if (GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM) != this.getCurrentProgram().getProgramId() || program.getProgramId() != this.getCurrentProgram().getProgramId()) { logger.info("Set program id to " + program.getProgramId()); logger.info("Current program id to " + this.getCurrentProgram().getProgramId()); logger.info("GL Current program id " + GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM)); throw new GLException("Unable to set program id " + program.getProgramId() + " as current"); } return program; }
From source file:im.bci.jnuit.lwjgl.assets.AssetsLoader.java
License:Open Source License
public Texture grabScreenToTexture() { int maxSize = GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE); Texture texture = new Texture(Math.min(maxSize, LwjglHelper.getWidth()), Math.min(maxSize, LwjglHelper.getHeight()), false); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getId()); LwjglHelper.setupGLTextureParams();/*from w ww. j av a 2 s . c o m*/ GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, texture.getWidth(), texture.getHeight(), 0); return texture; }