本文整理汇总了Java中org.lwjgl.opengl.GL11.glScissor方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glScissor方法的具体用法?Java GL11.glScissor怎么用?Java GL11.glScissor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glScissor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawWindow
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void drawWindow(int mouseX, int mouseY) {
super.drawWindow(mouseX, mouseY);
windowY = headerY + 22 ;
SurfaceHelper.drawOutlinedRectShaded(posX, windowY, width, height, Utils.toRGBA(130,130,130,255), 80, 3);
int buttonY = windowY - buttonListOffset + 2;
int scale = ClickGui.scaledRes.getScaleFactor();
GL11.glPushMatrix();
int scissorY = MC.displayHeight-(scale*windowY+scale*height-3);
GL11.glScissor(scale*posX, scissorY, scale*width , scale*height-8);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
for (GuiButton button : buttonList) {
SurfaceHelper.drawRect(posX+2, buttonY,width-4, GuiButton.height, button.getColor());
SurfaceHelper.drawTextShadowCentered(button.getName(),(posX+2)+width/2f, buttonY+GuiButton.height/2f, Utils.toRGBA(255,255,255,255));
button.setCoords(posX +2, buttonY);
buttonY += GuiButton.height+1;
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
//update variables
bottomX = posX + width; // set the coords of the bottom right corner for mouse coord testing
bottomY = windowY + height;
}
示例2: scissor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void scissor(int x, int y, int x2, int y2, boolean clickGui) {
if (x == 0 && y == 0 && x2 == 0 && y2 == 0) {
GL11.glEnable(GL11.GL_SCISSOR_TEST);
return;
}
if (Wrapper.currentScreen() == null) return;
int width = x2 - x;
int height = y2 - y;
int factor = clickGui ? 2 : getScaleFactor();
int bottomY = (clickGui ? Display.getHeight() / 2 : Wrapper.currentScreen().field_146295_m) - y2;
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(x * factor, bottomY * factor, width * factor, height * factor);
}
示例3: startClip
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void startClip(float x1, float y1, float x2, float y2) {
if (y1 > y2) {
float temp = y2;
y2 = y1;
y1 = temp;
}
GL11.glEnable((int)3089);
GL11.glScissor((int)((int)x1), (int)((int)((float)Display.getHeight() - y2)), (int)((int)(x2 - x1)), (int)((int)(y2 - y1)));
}
示例4: glScissor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.renderer.SGL#glScissor(int, int, int, int)
*/
public void glScissor(int x, int y, int width, int height) {
GL11.glScissor(x, y, width, height);
}
示例5: prepareScissorBox
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void prepareScissorBox(float x, float y, float x2, float y2) {
RenderUtils.updateScaledResolution();
int factor = scaledResolution.getScaleFactor();
GL11.glScissor((int)((int)(x * (float)factor)), (int)((int)(((float)scaledResolution.getScaledHeight() - y2) * (float)factor)), (int)((int)((x2 - x) * (float)factor)), (int)((int)((y2 - y) * (float)factor)));
}
示例6: prepareScissorBox
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void prepareScissorBox(float x, float y, float x2, float y2) {
final int factor = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight).getScaleFactor();
GL11.glScissor((int) (x * factor), (int) ((new ScaledResolution(mc, mc.displayWidth, mc.displayHeight).getScaledHeight() - y2) * factor), (int) ((x2 - x) * factor), (int) ((y2 - y) * factor));
}
示例7: prepareScissorBox
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void prepareScissorBox(float x, float y, float x2, float y2) {
final int factor = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight).getScaleFactor();
GL11.glScissor((int) (x * factor), (int) ((new ScaledResolution(mc, mc.displayWidth, mc.displayHeight).getScaledHeight() - y2) * factor), (int) ((x2 - x) * factor), (int) ((y2 - y) * factor));
}
示例8: drawScreen
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
frameCount++;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(TEXTURE_BACKGROUND);
int x = (this.width - this.xSize) / 2;
int z = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(x, z, 0, 0, this.xSize, this.ySize);
if(renderContext.doesRenderIn3D()) {
if (Mouse.isButtonDown(0) && frameCount > 20) {
renderContext.rotateRender(0.25 * Mouse.getDY(), 0.25 * Mouse.getDX(), 0);
}
} else {
if (Mouse.isButtonDown(0) && frameCount > 20) {
renderContext.moveRender(0.25 * Mouse.getDX(), 0, -0.25 * Mouse.getDY());
}
}
int dwheel = Mouse.getDWheel();
if(dwheel < 0) {
renderContext.zoomOut();
} else if(dwheel > 0) {
renderContext.zoomIn();
}
if(GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak)) {
if(renderContext.getShiftSnap() == -1) {
renderContext.snapSamples();
}
} else {
renderContext.releaseSamples();
}
ScaledResolution res = new ScaledResolution(mc);
Rectangle scissorFrame = new Rectangle((guiLeft + 8) * res.getScaleFactor(), (guiTop + 43) * res.getScaleFactor(),
160 * res.getScaleFactor(), 94 * res.getScaleFactor());
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(scissorFrame.x, scissorFrame.y, scissorFrame.width, scissorFrame.height);
x = 88;
z = 66;
renderContext.renderAt(this.guiLeft + x, this.guiTop + z, partialTicks);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
drawButtons(mouseX, mouseY);
GlStateManager.disableDepth();
fontRenderer.drawStringWithShadow(machine.getLocalizedName(), this.guiLeft + 10, this.guiTop + 11, 0xFFFFFFFF);
if(machine.requiresBlueprint()) {
String reqBlueprint = I18n.format("tooltip.machinery.blueprint.required");
fontRenderer.drawString(reqBlueprint, this.guiLeft + 10, this.guiTop + 106, 0x444444);
}
GlStateManager.enableDepth();
scissorFrame = new Rectangle(MathHelper.floor(this.guiLeft + 8), MathHelper.floor(this.guiTop + 8), 160, 94);
if(!renderContext.doesRenderIn3D() && scissorFrame.contains(mouseX, mouseY)) {
render2DHover(mouseX, mouseY, x, z);
}
}