List of usage examples for org.lwjgl.opengl GL11 glTexEnvi
public static native void glTexEnvi(@NativeType("GLenum") int target, @NativeType("GLenum") int pname, @NativeType("GLint") int param);
From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java
License:Open Source License
@Override public void setupPointParameters(final float pointSize, final boolean antialiased, final boolean isSprite, final boolean useDistanceAttenuation, final FloatBuffer attenuationCoefficients, final float minPointSize, final float maxPointSize) { final RenderContext context = ContextManager.getCurrentContext(); // TODO: make a record for point states GL11.glPointSize(pointSize);/* w ww.j ava 2 s.c o m*/ if (isSprite && context.getCapabilities().isPointSpritesSupported()) { GL11.glEnable(ARBPointSprite.GL_POINT_SPRITE_ARB); GL11.glTexEnvi(ARBPointSprite.GL_POINT_SPRITE_ARB, ARBPointSprite.GL_COORD_REPLACE_ARB, GL11.GL_TRUE); } if (useDistanceAttenuation && context.getCapabilities().isPointParametersSupported()) { ARBPointParameters.glPointParameterARB(ARBPointParameters.GL_POINT_DISTANCE_ATTENUATION_ARB, attenuationCoefficients); ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MIN_ARB, minPointSize); ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MAX_ARB, maxPointSize); } if (antialiased) { GL11.glEnable(GL11.GL_POINT_SMOOTH); GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil.java
License:Open Source License
public static void applyCombineFactors(final Texture texture, final TextureUnitRecord unitRecord, final int unit, final TextureStateRecord record, final ContextCapabilities caps) { // check that this is a valid fixed function unit. glTexEnv is only // supported for unit < GL_MAX_TEXTURE_UNITS if (unit >= caps.getNumberOfFixedTextureUnits()) { return;// ww w. j a v a 2 s . com } // first thing's first... if we are doing dot3 and don't // support it, disable this texture. boolean checked = false; if (!caps.isEnvDot3TextureCombineSupported() && (texture.getCombineFuncRGB() == CombinerFunctionRGB.Dot3RGB || texture.getCombineFuncRGB() == CombinerFunctionRGB.Dot3RGBA)) { // disable disableTexturing(unitRecord, record, unit, caps); // No need to continue return; } // Okay, now let's set our scales if we need to: // First RGB Combine scale if (!unitRecord.isValid() || unitRecord.envRGBScale != texture.getCombineScaleRGB()) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_RGB_SCALE_ARB, texture.getCombineScaleRGB().floatValue()); unitRecord.envRGBScale = texture.getCombineScaleRGB(); } // Then Alpha Combine scale if (!unitRecord.isValid() || unitRecord.envAlphaScale != texture.getCombineScaleAlpha()) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_ALPHA_SCALE, texture.getCombineScaleAlpha().floatValue()); unitRecord.envAlphaScale = texture.getCombineScaleAlpha(); } // Time to set the RGB combines final CombinerFunctionRGB rgbCombineFunc = texture.getCombineFuncRGB(); if (!unitRecord.isValid() || unitRecord.rgbCombineFunc != rgbCombineFunc) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_COMBINE_RGB_ARB, LwjglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc)); unitRecord.rgbCombineFunc = rgbCombineFunc; } CombinerSource combSrcRGB = texture.getCombineSrc0RGB(); if (!unitRecord.isValid() || unitRecord.combSrcRGB0 != combSrcRGB) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE0_RGB_ARB, LwjglTextureUtil.getGLCombineSrc(combSrcRGB)); unitRecord.combSrcRGB0 = combSrcRGB; } CombinerOperandRGB combOpRGB = texture.getCombineOp0RGB(); if (!unitRecord.isValid() || unitRecord.combOpRGB0 != combOpRGB) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND0_RGB_ARB, LwjglTextureUtil.getGLCombineOpRGB(combOpRGB)); unitRecord.combOpRGB0 = combOpRGB; } // We only need to do Arg1 or Arg2 if we aren't in Replace mode if (rgbCombineFunc != CombinerFunctionRGB.Replace) { combSrcRGB = texture.getCombineSrc1RGB(); if (!unitRecord.isValid() || unitRecord.combSrcRGB1 != combSrcRGB) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE1_RGB_ARB, LwjglTextureUtil.getGLCombineSrc(combSrcRGB)); unitRecord.combSrcRGB1 = combSrcRGB; } combOpRGB = texture.getCombineOp1RGB(); if (!unitRecord.isValid() || unitRecord.combOpRGB1 != combOpRGB) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND1_RGB_ARB, LwjglTextureUtil.getGLCombineOpRGB(combOpRGB)); unitRecord.combOpRGB1 = combOpRGB; } // We only need to do Arg2 if we are in Interpolate mode if (rgbCombineFunc == CombinerFunctionRGB.Interpolate) { combSrcRGB = texture.getCombineSrc2RGB(); if (!unitRecord.isValid() || unitRecord.combSrcRGB2 != combSrcRGB) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE2_RGB_ARB, LwjglTextureUtil.getGLCombineSrc(combSrcRGB)); unitRecord.combSrcRGB2 = combSrcRGB; } combOpRGB = texture.getCombineOp2RGB(); if (!unitRecord.isValid() || unitRecord.combOpRGB2 != combOpRGB) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND2_RGB_ARB, LwjglTextureUtil.getGLCombineOpRGB(combOpRGB)); unitRecord.combOpRGB2 = combOpRGB; } } } // Now Alpha combines final CombinerFunctionAlpha alphaCombineFunc = texture.getCombineFuncAlpha(); if (!unitRecord.isValid() || unitRecord.alphaCombineFunc != alphaCombineFunc) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_COMBINE_ALPHA_ARB, LwjglTextureUtil.getGLCombineFuncAlpha(alphaCombineFunc)); unitRecord.alphaCombineFunc = alphaCombineFunc; } CombinerSource combSrcAlpha = texture.getCombineSrc0Alpha(); if (!unitRecord.isValid() || unitRecord.combSrcAlpha0 != combSrcAlpha) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE0_ALPHA_ARB, LwjglTextureUtil.getGLCombineSrc(combSrcAlpha)); unitRecord.combSrcAlpha0 = combSrcAlpha; } CombinerOperandAlpha combOpAlpha = texture.getCombineOp0Alpha(); if (!unitRecord.isValid() || unitRecord.combOpAlpha0 != combOpAlpha) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND0_ALPHA_ARB, LwjglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); unitRecord.combOpAlpha0 = combOpAlpha; } // We only need to do Arg1 or Arg2 if we aren't in Replace mode if (alphaCombineFunc != CombinerFunctionAlpha.Replace) { combSrcAlpha = texture.getCombineSrc1Alpha(); if (!unitRecord.isValid() || unitRecord.combSrcAlpha1 != combSrcAlpha) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE1_ALPHA_ARB, LwjglTextureUtil.getGLCombineSrc(combSrcAlpha)); unitRecord.combSrcAlpha1 = combSrcAlpha; } combOpAlpha = texture.getCombineOp1Alpha(); if (!unitRecord.isValid() || unitRecord.combOpAlpha1 != combOpAlpha) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND1_ALPHA_ARB, LwjglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); unitRecord.combOpAlpha1 = combOpAlpha; } // We only need to do Arg2 if we are in Interpolate mode if (alphaCombineFunc == CombinerFunctionAlpha.Interpolate) { combSrcAlpha = texture.getCombineSrc2Alpha(); if (!unitRecord.isValid() || unitRecord.combSrcAlpha2 != combSrcAlpha) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE2_ALPHA_ARB, LwjglTextureUtil.getGLCombineSrc(combSrcAlpha)); unitRecord.combSrcAlpha2 = combSrcAlpha; } combOpAlpha = texture.getCombineOp2Alpha(); if (!unitRecord.isValid() || unitRecord.combOpAlpha2 != combOpAlpha) { if (!checked) { checkAndSetUnit(unit, record, caps); checked = true; } GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND2_ALPHA_ARB, LwjglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); unitRecord.combOpAlpha2 = combOpAlpha; } } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil.java
License:Open Source License
public static void applyEnvMode(final ApplyMode mode, final TextureUnitRecord unitRecord, final int unit, final TextureStateRecord record, final ContextCapabilities caps) { if (!unitRecord.isValid() || unitRecord.envMode != mode) { checkAndSetUnit(unit, record, caps); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, LwjglTextureUtil.getGLEnvMode(mode)); unitRecord.envMode = mode;/*from w ww .j av a2 s .c om*/ } }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL11.java
License:Apache License
public void glTexEnvi(int target, int pname, int param) { GL11.glTexEnvi(target, pname, param); }
From source file:com.specialeffect.gui.IconOverlay.java
License:Open Source License
private void drawTexture() { // calculate position int height = (int) (mDisplayHeight * mHeight); int width = (int) (height * mAspectRatio); int centreX = (int) (mCentreX * mDisplayWidth); int centreY = (int) (mCentreY * mDisplayHeight); GL11.glDisable(GL11.GL_LIGHTING);//from ww w . j a v a2 s . c o m GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); this.mc.renderEngine.bindTexture(mResource); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); GL11.glColor4f(1.0f, 1.0f, 1.0f, mAlpha); ModUtils.drawTexQuad(centreX - width / 2, centreY - height / 2, width, height); // reset GL attributes! GL11.glPopAttrib(); }
From source file:com.specialeffect.gui.JoystickControlOverlay.java
License:Open Source License
@SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent event) { // We draw after the ExperienceBar has drawn. The event raised by GuiIngameForge.pre() // will return true from isCancelable. If you call event.setCanceled(true) in // that case, the portion of rendering which this event represents will be canceled. // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns // false and that the eventType represents the ExperienceBar event. if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return;//from w w w. ja v a 2s. c o m } if (mVisible) { this.rescale(); GL11.glDisable(GL11.GL_LIGHTING); this.mc.renderEngine.bindTexture(mResource); GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.5f); ModUtils.drawTexQuad(0, 0, mDisplayWidth, mDisplayHeight); // reset GL attributes! GL11.glPopAttrib(); } }
From source file:com.specialeffect.gui.StateOverlay.java
License:Open Source License
private void drawScaledTextureWithGlow(ResourceLocation res, int x, int y, int width, int height) { GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); this.mc.renderEngine.bindTexture(res); // First draw enlarged and blurred, for glow. GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); // We draw the texture larger, in white, at progressive levels of alpha // for blur effect (the alpha gets added on each layer) int blurSteps = 4; // how many levels of progressive blur double totalBlur = width / 12; // in pixels GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f / blurSteps); for (int i = 0; i < blurSteps; i++) { double blurAmount = totalBlur / blurSteps * (i + 1); ModUtils.drawTexQuad(x - blurAmount, y - blurAmount, width + 2 * blurAmount, height + 2 * blurAmount); }/*from w w w . j a v a 2 s. co m*/ GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE); GL11.glColor3f(1.0f, 1.0f, 1.0f); this.mc.renderEngine.bindTexture(res); ModUtils.drawTexQuad(x, y, width, height); // reset GL attributes! GL11.glPopAttrib(); }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static void glTexEnvi(int target, int mode, int value) { GL11.glTexEnvi(target, mode, value); }
From source file:jake2.desktop.LWJGLAdapter.java
License:Open Source License
@Override public void glTexEnvi(int target, int pname, int param) { GL11.glTexEnvi(target, pname, param); }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void setTexEnv(int name, int param) { GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, texEnvNameToGL[name], texEnvParamToGL[param]); }