Java Code Examples for org.lwjgl.opengl.GL11#glGetBoolean()

The following examples show how to use org.lwjgl.opengl.GL11#glGetBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IngameHUD.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRenderGUI(MatrixStack matrixStack, float partialTicks)
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	if(tabGui == null)
		tabGui = new TabGui();
	
	boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
	ClickGui clickGui = WurstClient.INSTANCE.getGui();
	
	// GL settings
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	
	clickGui.updateColors();
	
	wurstLogo.render(matrixStack);
	hackList.render(matrixStack, partialTicks);
	tabGui.render(matrixStack, partialTicks);
	
	// pinned windows
	if(!(WurstClient.MC.currentScreen instanceof ClickGuiScreen))
		clickGui.renderPinnedWindows(matrixStack, partialTicks);
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glColor4f(1, 1, 1, 1);
	
	if(blend)
		GL11.glEnable(GL11.GL_BLEND);
	else
		GL11.glDisable(GL11.GL_BLEND);
}
 
Example 2
Source File: CurveRenderState.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve.
 */
private RenderState saveRenderState() {
	RenderState state = new RenderState();
	state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
	state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
	state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
	state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
	state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
	state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
	state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
	state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
	GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_TEXTURE_1D);
	GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

	GL20.glUseProgram(0);

	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();

	return state;
}
 
Example 3
Source File: FXFlow.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void sheduleRender(Tessellator tessellator) {
    boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);

    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    if(isLightingEnabled)
        GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);

    for(FXFlowBase fx : fxQueue) {
        tessellator.startDrawingQuads();
        fx.renderEssenceBase(tessellator);
        tessellator.draw();
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);

    if(isLightingEnabled)
        GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

    fxQueue.clear();
}
 
Example 4
Source File: RenderFrame.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
    boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    GL11.glPushMatrix();
    {
        if (type == ItemRenderType.INVENTORY)
            GL11.glTranslated(0, -0.0625, 0);
        if (type == ItemRenderType.ENTITY) {
            GL11.glScaled(0.5, 0.5, 0.5);
            GL11.glTranslated(-0.5, -0.45, -0.5);
        }

        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        IFrame f = ((IFrame) ((ItemPartFrame) item.getItem()).newPart(item, Framez.proxy.getPlayer(), Framez.proxy.getWorld(), null, 0,
                null));
        if (f != null)
            f.renderItem(item, type);
    }
    GL11.glPopMatrix();

    if (!blend)
        GL11.glDisable(GL11.GL_BLEND);
    if (!alpha)
        GL11.glDisable(GL11.GL_ALPHA_TEST);

}
 
Example 5
Source File: LegacyCurveRenderState.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve.
 */
private RenderState saveRenderState() {
	RenderState state = new RenderState();
	state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
	state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
	state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
	state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
	state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
	state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
	state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
	state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
	GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_TEXTURE_1D);
	GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

	GL20.glUseProgram(0);

	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();

	return state;
}
 
Example 6
Source File: CurveRenderState.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve.
 */
private RenderState saveRenderState() {
	RenderState state = new RenderState();
	state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
	state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
	state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
	state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
	state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
	state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
	state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
	GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
	GL11.glEnable(GL11.GL_BLEND);
	GL14.glBlendEquation(GL14.GL_FUNC_ADD);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_TEXTURE_1D);
	GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);

	GL20.glUseProgram(0);

	GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

	return state;
}
 
Example 7
Source File: IngameHUD.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderGUI(RenderGameOverlayEvent.Post event)
{
	if(event.getType() != ElementType.ALL || mc.gameSettings.showDebugInfo)
		return;
	
	boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
	
	// color
	clickGui.updateColors();
	int textColor;
	if(hackList.rainbowUiHack.isEnabled())
	{
		float[] acColor = clickGui.getAcColor();
		textColor = (int)(acColor[0] * 256) << 16
			| (int)(acColor[1] * 256) << 8 | (int)(acColor[2] * 256);
	}else
		textColor = 0xffffff;
	
	// title
	GL11.glPushMatrix();
	GL11.glScaled(1.33333333, 1.33333333, 1);
	WMinecraft.getFontRenderer().drawStringWithShadow(
		"ForgeWurst v" + ForgeWurst.VERSION, 3, 3, textColor);
	GL11.glPopMatrix();
	
	// hack list
	int y = 19;
	ArrayList<Hack> hacks = new ArrayList<>();
	hacks.addAll(hackList.getValues());
	hacks.sort(Comparator.comparing(Hack::getName));
	
	for(Hack hack : hacks)
	{
		if(!hack.isEnabled())
			continue;
		
		WMinecraft.getFontRenderer()
			.drawStringWithShadow(hack.getRenderName(), 2, y, textColor);
		y += 9;
	}
	
	// pinned windows
	if(!(mc.currentScreen instanceof ClickGuiScreen))
		clickGui.renderPinnedWindows(event.getPartialTicks());
	
	if(blend)
		GL11.glEnable(GL11.GL_BLEND);
	else
		GL11.glDisable(GL11.GL_BLEND);
}
 
Example 8
Source File: GLUtils.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
public final static boolean getGLBoolean(int gl_enum) {
	GL11.glGetBoolean(gl_enum, byte_buf);
	return byte_buf.get(0) == (byte)1;
}
 
Example 9
Source File: RenderMotor.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    Tessellator t = Tessellator.instance;

    boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
    boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    GL11.glPushMatrix();
    {
        if (type == ItemRenderType.INVENTORY)
            GL11.glTranslated(0, -0.0625, 0);
        if (type == ItemRenderType.ENTITY)
            GL11.glTranslated(-0.5, -0.45, -0.5);

        t.startDrawingQuads();

        RenderHelper renderer = RenderHelper.instance;
        renderer.fullReset();

        IIcon border = IconSupplier.motor_border;
        IIcon center = IconSupplier.motor_center;

        renderer.renderBox(new Vec3dCube(0, 0, 0, 1, 1, 1), border);

        renderer.setRenderFromInside(true);
        {
            renderer.renderBox(new Vec3dCube(0, 2 / 16D, 2 / 16D, 1, 14 / 16D, 14 / 16D), border);
            renderer.renderBox(new Vec3dCube(2 / 16D, 0, 2 / 16D, 14 / 16D, 1, 14 / 16D), border);
            renderer.renderBox(new Vec3dCube(2 / 16D, 2 / 16D, 0, 14 / 16D, 14 / 16D, 1), border);
        }
        renderer.renderBox(new Vec3dCube(1 / 16D, 1 / 16D, 1 / 16D, 15 / 16D, 15 / 16D, 15 / 16D), center);
        renderer.setRenderFromInside(false);
        renderer.renderBox(new Vec3dCube(1 / 16D, 1 / 16D, 1 / 16D, 15 / 16D, 15 / 16D, 15 / 16D), center);

        t.draw();
    }
    GL11.glPopMatrix();

    if (!blend)
        GL11.glDisable(GL11.GL_BLEND);
    if (!alpha)
        GL11.glDisable(GL11.GL_ALPHA_TEST);
}