org.lwjgl.opengl.GL12 Java Examples
The following examples show how to use
org.lwjgl.opengl.GL12.
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: LWJGL15DrawContext.java From settlers-remake with MIT License | 6 votes |
@Override public TextureHandle generateTexture(int width, int height, ShortBuffer data, String name) { int texture = GL11.glGenTextures(); if (texture == 0) { return null; } //fix strange alpha test problem (minimap and landscape are unaffected) ShortBuffer bfr = BufferUtils.createShortBuffer(data.capacity()); int cap = data.capacity(); for(int i = 0;i != cap;i++) bfr.put(i, data.get(i)); TextureHandle textureHandle = new TextureHandle(this, texture); bindTexture(textureHandle); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL12.GL_UNSIGNED_SHORT_4_4_4_4, bfr); setTextureParameters(); setObjectLabel(GL11.GL_TEXTURE, texture, name + "-tex"); return textureHandle; }
Example #2
Source File: FWBlock.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) @Override public void renderInventoryBlock(net.minecraft.block.Block block, int metadata, int modelId, RenderBlocks renderBlocks) { if (this.dummy.components.has(Renderer.class)) { GL11.glPushAttrib(GL_TEXTURE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); Tessellator.instance.startDrawingQuads(); BWModel model = new BWModel(); this.dummy.components.getSet(Renderer.class).forEach(renderer -> renderer.onRender.accept(model)); model.render(); Tessellator.instance.draw(); GL11.glPopMatrix(); GL11.glPopAttrib(); } }
Example #3
Source File: ItemWrapperMethods.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@Override default void renderItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { Item item = ItemConverter.instance().toNova(itemStack); if (item.components.has(Renderer.class)) { GL11.glPushAttrib(GL_TEXTURE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); Tessellator.instance.startDrawingQuads(); BWModel model = new BWModel(); model.matrix.rotate(Direction.UP.toVector(), 1 / 4 * Math.PI); model.matrix.rotate(Direction.EAST.toVector(), 1 / 6 * Math.PI); model.matrix.scale(1.6, 1.6, 1.6); item.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model)); model.render(); Tessellator.instance.draw(); GL11.glPopMatrix(); GL11.glPopAttrib(); } }
Example #4
Source File: ModuleRegulatorTube.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public IBaseModel getModel(){ if(model == null) { model = new BaseModel("regulatorTubeModule.obj"){ @Override public void renderStatic(float size, TileEntity te){ GL11.glPushMatrix(); GL11.glRotated(90, 0, -1, 0); GL11.glTranslated(10 / 16D, 24 / 16D, 0); if(renderItem) { GL11.glTranslated(1 / 16D, -1 / 16D, 3 / 16D); } float scale = 1 / 16F; GL11.glScalef(scale, scale, scale); GL11.glEnable(GL12.GL_RESCALE_NORMAL); super.renderStatic(size, te); GL11.glPopMatrix(); } }; } return model; }
Example #5
Source File: GuiButtonSpecial.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public void drawButton(Minecraft mc, int x, int y){ if(thisVisible) super.drawButton(mc, x, y); if(visible) { if(renderedStacks != null) { int middleX = xPosition + width / 2; int startX = middleX - renderedStacks.length * 9 + 1; GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for(int i = 0; i < renderedStacks.length; i++) { itemRenderer.renderItemAndEffectIntoGUI(FMLClientHandler.instance().getClient().fontRenderer, FMLClientHandler.instance().getClient().renderEngine, renderedStacks[i], startX + i * 18, yPosition + 2); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } if(resLoc != null) { mc.getTextureManager().bindTexture(resLoc); func_146110_a(xPosition + width / 2 - 8, yPosition + 2, 0, 0, 16, 16, 16, 16); } if(enabled && !thisVisible && x >= xPosition && y >= yPosition && x < xPosition + width && y < yPosition + height) { Gui.drawRect(xPosition, yPosition, xPosition + width, yPosition + height, invisibleHoverColor); } } }
Example #6
Source File: LwjglRasteriser.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 6 votes |
public BufferedImage takeScreenshot2(final int startX, final int startY, final int width, final int height, ImageFormat imageFormat) { ByteBuffer screenContentsBytes = ByteBuffer.allocateDirect(width * height * 4).order(ByteOrder.LITTLE_ENDIAN); IntBuffer screenContents = screenContentsBytes.asIntBuffer(); GL11.glReadPixels(startX, startY, width, height, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, screenContents); int[] pixels = new int[width * height]; screenContents.get(pixels); final int pixelFormat = imageFormat.hasAlpha() ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR; BufferedImage img = new BufferedImage(width, height, pixelFormat); for (int x=0; x<width; x++) { for (int y=0; y<height; y++) { final int rgba = pixels[x + y * width]; img.setRGB(x, height - 1 - y, rgba); } } return img; }
Example #7
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
public static void prepareTexture(int target, int texture, int min_mag_filter, int wrap) { GL11.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, min_mag_filter); GL11.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, min_mag_filter); if(target == GL11.GL_TEXTURE_2D) GlStateManager.bindTexture(target); else GL11.glBindTexture(target, texture); switch (target) { case GL12.GL_TEXTURE_3D: GL11.glTexParameteri(target, GL12.GL_TEXTURE_WRAP_R, wrap); case GL11.GL_TEXTURE_2D: GL11.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_T, wrap); case GL11.GL_TEXTURE_1D: GL11.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_S, wrap); } }
Example #8
Source File: GuiButtonSpecial.java From Signals with GNU General Public License v3.0 | 6 votes |
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks){ if(thisVisible) super.drawButton(mc, mouseX, mouseY, partialTicks); if(visible) { if(renderedStacks != null) { int middleX = this.x + width / 2; int startX = middleX - renderedStacks.length * 9 + 1; GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for(int i = 0; i < renderedStacks.length; i++) { itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } if(resLoc != null) { mc.getTextureManager().bindTexture(resLoc); drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16); } if(enabled && !thisVisible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + width && mouseY < this.y + height) { Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor); } } }
Example #9
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
public static void prepareTexture(int target, int texture, int min_mag_filter, int wrap) { GlStateManager.texParameter(target, GL11.GL_TEXTURE_MIN_FILTER, min_mag_filter); GlStateManager.texParameter(target, GL11.GL_TEXTURE_MAG_FILTER, min_mag_filter); if (target == GL11.GL_TEXTURE_2D) { GlStateManager.bindTexture(target); } else { GL11.glBindTexture(target, texture); } switch (target) { case GL12.GL_TEXTURE_3D: GlStateManager.texParameter(target, GL12.GL_TEXTURE_WRAP_R, wrap); case GL11.GL_TEXTURE_2D: GlStateManager.texParameter(target, GL11.GL_TEXTURE_WRAP_T, wrap); case GL11.GL_TEXTURE_1D: GlStateManager.texParameter(target, GL11.GL_TEXTURE_WRAP_S, wrap); } }
Example #10
Source File: EnderChestRenderer.java From EnderStorage with MIT License | 5 votes |
public static void renderChest(int rotation, int freq, boolean owned, double x, double y, double z, int offset, float lidAngle) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e); GL11.glColor4f(1, 1, 1, 1); CCRenderState.changeTexture("enderstorage:textures/enderchest.png"); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1, 1, 1, 1); GL11.glTranslated(x, y + 1.0, z + 1.0F); GL11.glScalef(1.0F, -1F, -1F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); model.chestLid.rotateAngleX = lidAngle; model.render(owned); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); renderButtons(freq, rotation, lidAngle); GL11.glPopMatrix(); double time = ClientUtils.getRenderTime() + offset; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + EnderStorageClientProxy.getPearlBob(time), z + 0.5), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example #11
Source File: CurveRenderState.java From opsu with GNU General Public License v3.0 | 5 votes |
/** * 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 #12
Source File: GuiItemIconDumper.java From NotEnoughItems with MIT License | 5 votes |
private BufferedImage screenshot() { Framebuffer fb = Minecraft.getMinecraft().getFramebuffer(); Dimension mcSize = GuiDraw.displayRes(); Dimension texSize = mcSize; if (OpenGlHelper.isFramebufferEnabled()) texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight); int k = texSize.width * texSize.height; if (pixelBuffer == null || pixelBuffer.capacity() < k) { pixelBuffer = BufferUtils.createIntBuffer(k); pixelValues = new int[k]; } GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); pixelBuffer.clear(); if (OpenGlHelper.isFramebufferEnabled()) { GlStateManager.bindTexture(fb.framebufferTexture); GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer); } else { GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer); } pixelBuffer.get(pixelValues); TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height); BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB); if (OpenGlHelper.isFramebufferEnabled()) { int yOff = texSize.height - mcSize.height; for (int y = 0; y < mcSize.height; ++y) for (int x = 0; x < mcSize.width; ++x) img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]); } else { img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width); } return img; }
Example #13
Source File: ProgressForm.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
private static Texture loadLogo(String logo_file) { try { return (Texture)Resources.findResource(new TextureFile(logo_file, Globals.COMPRESSED_RGB_FORMAT, GL11.GL_LINEAR, GL11.GL_LINEAR, GL12.GL_CLAMP_TO_EDGE, GL12.GL_CLAMP_TO_EDGE)); } catch (Exception e) { System.err.println("ERROR: Could not find logo: " + logo_file); return null; } }
Example #14
Source File: TextureAttachment.java From LowPolyWater with The Unlicense | 5 votes |
private void setTextureParams(){ int filterType = nearestFiltering ? GL11.GL_NEAREST : GL11.GL_LINEAR; GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filterType); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filterType); int wrapType = clampEdges ? GL12.GL_CLAMP_TO_EDGE : GL11.GL_REPEAT; GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrapType); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, wrapType); }
Example #15
Source File: ShowArmor.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
private void drawItemStack(ItemStack itemStack, int x, int y) { if (itemStack == null) { return; } RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderItem.getInstance().renderItemAndEffectIntoGUI(Wrapper.INSTANCE.mc().fontRenderer, Wrapper.INSTANCE.mc().renderEngine, itemStack, x - 8, y); RenderItem.getInstance().renderItemOverlayIntoGUI(Wrapper.INSTANCE.mc().fontRenderer, Wrapper.INSTANCE.mc().renderEngine, itemStack, x - 8, y); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); }
Example #16
Source File: Errors.java From Visage with MIT License | 5 votes |
private static void buildMapping() { if (mapping != null) return; Multimap<Integer, String> map = HashMultimap.create(); List<Class<?>> classes = ImmutableList.of( GL11.class, GL12.class, GL13.class, GL14.class, GL15.class, GL20.class, GL21.class, GL30.class, GL31.class, GL32.class, GL33.class, GL40.class, GL41.class, GL42.class, GL43.class, GL44.class, GL45.class, GLFW.class ); for (Class<?> clazz : classes) { for (Field f : clazz.getDeclaredFields()) { if (f.getName().toUpperCase(Locale.ROOT).equals(f.getName()) && f.getType() == int.class && Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) { List<String> li = Splitter.on('_').splitToList(f.getName()); li = li.subList(1, li.size()); String clean = Joiner.on(' ').join( li.stream() .map(Errors::toTitleCase) .iterator()); try { map.put(f.getInt(null), clean); } catch (Throwable t) { t.printStackTrace(); } } } } mapping = map; }
Example #17
Source File: DMI.java From FastDMM with GNU General Public License v3.0 | 5 votes |
public void createGL() { if (image == null || glID != -1) return; int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()); ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4); //4 for RGBA, 3 for RGB for (int y = 0; y < image.getHeight(); y++) { for (int x = 0; x < image.getWidth(); x++) { int pixel = pixels[y * image.getWidth() + x]; buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component buffer.put((byte) (pixel & 0xFF)); // Blue component buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA } } buffer.flip(); //FOR THE LOVE OF GOD DO NOT FORGET THIS // You now have a ByteBuffer filled with the color data of each pixel. // Now just create a texture ID and bind it. Then you can load it using // whatever OpenGL method you want, for example: glID = glGenTextures(); glBindTexture(GL_TEXTURE_2D, glID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); //Setup texture scaling filtering glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL_TRUE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); }
Example #18
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void renderTooltipBox(int x1, int y1, int x2, int y2, boolean wrap) { GL12.glDisable(GL12.GL_RESCALE_NORMAL); DiffuseLighting.disable(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(0.0F, 0.0F, 300.0F); int int_5 = x1 + 12; int int_6 = y1 - 12; if (wrap) { if (int_5 + y2 > mc.currentScreen.width) int_5 -= 28 + y2; if (int_6 + x2 + 6 > mc.currentScreen.height) int_6 = mc.currentScreen.height - x2 - 6; } /* why the fork is this private? */ FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 4, int_5 + y2 + 3, int_6 - 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 3, int_5 + y2 + 3, int_6 + x2 + 4, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 4, int_6 - 3, int_5 - 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 3, int_6 - 3, int_5 + y2 + 4, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3 + 1, int_5 - 3 + 1, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 2, int_6 - 3 + 1, int_5 + y2 + 3, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 - 3 + 1, 1347420415, 1347420415); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 2, int_5 + y2 + 3, int_6 + x2 + 3, 1344798847, 1344798847); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); DiffuseLighting.enable(); GL12.glEnable(GL12.GL_RESCALE_NORMAL); }
Example #19
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void renderTooltipBox(int x1, int y1, int x2, int y2, boolean wrap) { GL12.glDisable(GL12.GL_RESCALE_NORMAL); GuiLighting.disable(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(0.0F, 0.0F, 300.0F); int int_5 = x1 + 12; int int_6 = y1 - 12; if (wrap) { if (int_5 + y2 > mc.currentScreen.width) int_5 -= 28 + y2; if (int_6 + x2 + 6 > mc.currentScreen.height) int_6 = mc.currentScreen.height - x2 - 6; } /* why the fork is this private? */ FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 4, int_5 + y2 + 3, int_6 - 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 3, int_5 + y2 + 3, int_6 + x2 + 4, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 4, int_6 - 3, int_5 - 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 3, int_6 - 3, int_5 + y2 + 4, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3 + 1, int_5 - 3 + 1, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 2, int_6 - 3 + 1, int_5 + y2 + 3, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 - 3 + 1, 1347420415, 1347420415); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 2, int_5 + y2 + 3, int_6 + x2 + 3, 1344798847, 1344798847); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GuiLighting.enable(); GL12.glEnable(GL12.GL_RESCALE_NORMAL); }
Example #20
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void renderTooltipBox(int x1, int y1, int x2, int y2, boolean wrap) { GL12.glDisable(GL12.GL_RESCALE_NORMAL); DiffuseLighting.disable(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(0.0F, 0.0F, 300.0F); int int_5 = x1 + 12; int int_6 = y1 - 12; if (wrap) { if (int_5 + y2 > mc.currentScreen.width) int_5 -= 28 + y2; if (int_6 + x2 + 6 > mc.currentScreen.height) int_6 = mc.currentScreen.height - x2 - 6; } /* why the fork is this private? */ FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 4, int_5 + y2 + 3, int_6 - 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 3, int_5 + y2 + 3, int_6 + x2 + 4, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 4, int_6 - 3, int_5 - 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 3, int_6 - 3, int_5 + y2 + 4, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3 + 1, int_5 - 3 + 1, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 2, int_6 - 3 + 1, int_5 + y2 + 3, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 - 3 + 1, 1347420415, 1347420415); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 2, int_5 + y2 + 3, int_6 + x2 + 3, 1344798847, 1344798847); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); DiffuseLighting.enable(); GL12.glEnable(GL12.GL_RESCALE_NORMAL); }
Example #21
Source File: LWJGL15DrawContext.java From settlers-remake with MIT License | 5 votes |
@Override public void updateTexture(TextureHandle texture, int left, int bottom, int width, int height, ShortBuffer data) { bindTexture(texture); GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, left, bottom, width, height, GL11.GL_RGBA, GL12.GL_UNSIGNED_SHORT_4_4_4_4, data); }
Example #22
Source File: RenderParachute.java From archimedes-ships with MIT License | 5 votes |
public void renderParachute(EntityParachute entity, double x, double y, double z, float yaw, float pitch) { GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y + 4F, (float) z); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.0625F, -0.0625F, -0.0625F); bindEntityTexture(entity); model.render(entity, 0F, 0F, 0F, 0F, 0F, 1F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(0F, 0F, 0F, 1F); GL11.glLineWidth(4F); Tessellator tess = Tessellator.instance; tess.startDrawing(GL11.GL_LINES); tess.addTranslation(0F, 0F, 0F); tess.addVertex(0D, -3D, 0D); tess.addVertex(-1D, 0D, 1D); tess.addVertex(0D, -3D, 0D); tess.addVertex(-1D, 0D, -1D); tess.addVertex(0D, -3D, 0D); tess.addVertex(1D, 0D, 1D); tess.addVertex(0D, -3D, 0D); tess.addVertex(1D, 0D, -1D); tess.draw(); tess.setTranslation(0F, 0F, 0F); GL11.glPopMatrix(); }
Example #23
Source File: RenderEntityVortex.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public void renderVortex(EntityVortex entity, double x, double y, double z, float var1, float partialTicks){ int circlePoints = 200; double radius = 0.5D; GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4d(0.8, 0.8, 0.8D, 0.7D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef((float)x, (float)y, (float)z); GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks, 0.0F, 1.0F, 0.0F); for(int i = 0; i < circlePoints; i++) { float angleRadians = (float)i / (float)circlePoints * 2F * (float)Math.PI; GL11.glPushMatrix(); GL11.glTranslated(radius * Math.sin(angleRadians), radius * Math.cos(angleRadians), 0); renderGust(); GL11.glPopMatrix(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
Example #24
Source File: SearchUpgradeHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void render3D(float partialTicks){ GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderManager.instance.renderEngine.bindTexture(Textures.GLOW_RESOURCE); // mc.func_110434_K().func_110577_a(Textures.GLOW_RESOURCE); for(Map.Entry<EntityItem, Integer> entry : searchedItems.entrySet()) { EntityItem item = entry.getKey(); float height = MathHelper.sin((item.age + partialTicks) / 10.0F + item.hoverStart) * 0.1F + 0.2F; RenderSearchItemBlock.renderSearch(item.lastTickPosX + (item.posX - item.lastTickPosX) * partialTicks, item.lastTickPosY + (item.posY - item.lastTickPosY) * partialTicks + height, item.lastTickPosZ + (item.posZ - item.lastTickPosZ) * partialTicks, entry.getValue(), totalSearchedItemCount); } for(int i = 0; i < searchedBlocks.size(); i++) { if(!searchedBlocks.get(i).renderSearchBlock(totalSearchedItemCount)) { searchedBlocks.remove(i); i--; } } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL12.GL_RESCALE_NORMAL); }
Example #25
Source File: RenderTargetCircle.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public void render(double size, float partialTicks){ double renderRotationAngle = oldRotationAngle + (rotationAngle - oldRotationAngle) * partialTicks; Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); // GL11.glLineWidth((float)size * 20F); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glRotatef((float)renderRotationAngle, 0, 0, 1); tessellator.setNormal(0F, 1F, 0F); for(int j = 0; j < 2; j++) { tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP); for(int i = 0; i < PneumaticCraftUtils.circlePoints / 4; i++) { tessellator.addVertex(PneumaticCraftUtils.cos[i] * size, PneumaticCraftUtils.sin[i] * size, 0); tessellator.addVertex(PneumaticCraftUtils.cos[i] * (size + 0.1D), PneumaticCraftUtils.sin[i] * (size + 0.1D), 0); } tessellator.draw(); if(renderAsTagged) { GL11.glColor4d(1, 0, 0, 1); tessellator.startDrawing(GL11.GL_LINE_LOOP); for(int i = 0; i < PneumaticCraftUtils.circlePoints / 4; i++) { tessellator.addVertex(PneumaticCraftUtils.cos[i] * size, PneumaticCraftUtils.sin[i] * size, 0); } for(int i = PneumaticCraftUtils.circlePoints / 4 - 1; i >= 0; i--) { tessellator.addVertex(PneumaticCraftUtils.cos[i] * (size + 0.1D), PneumaticCraftUtils.sin[i] * (size + 0.1D), 0); } tessellator.draw(); GL11.glColor4d(1, 1, 0, 0.5); } GL11.glRotatef(180, 0, 0, 1); } GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
Example #26
Source File: GuiUtils.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public static void drawItemStack(ItemStack stack, int x, int y){ GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); itemRenderer.renderItemAndEffectIntoGUI(FMLClientHandler.instance().getClient().fontRenderer, FMLClientHandler.instance().getClient().renderEngine, stack, x, y); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); }
Example #27
Source File: Texture.java From mapwriter with MIT License | 5 votes |
public Texture(int w, int h, int fillColour, int minFilter, int maxFilter, int textureWrap) { this.id = GL11.glGenTextures(); this.w = w; this.h = h; this.pixelBuf = MwUtil.allocateDirectIntBuffer(w * h); this.fillRect(0, 0, w, h, fillColour); this.pixelBuf.position(0); this.bind(); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, w, h, 0, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, this.pixelBuf); this.setTexParameters(minFilter, maxFilter, textureWrap); }
Example #28
Source File: Texture.java From mapwriter with MIT License | 5 votes |
public synchronized void updateTextureArea(int x, int y, int w, int h) { try { this.bind(); GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, this.w); this.pixelBuf.position((y * this.w) + x); GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, x, y, w, h, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, this.pixelBuf); GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0); } catch (NullPointerException e) { MwUtil.log("MwTexture.updatePixels: null pointer exception (texture %d)", this.id); } }
Example #29
Source File: Texture.java From mapwriter with MIT License | 5 votes |
private synchronized void getPixelsFromExistingTexture() { try { this.bind(); this.pixelBuf.clear(); GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, this.pixelBuf); // getTexImage does not seem to advance the buffer position, so flip does not work here // this.pixelBuf.flip() this.pixelBuf.limit(this.w * this.h); } catch (NullPointerException e) { MwUtil.log("MwTexture.getPixels: null pointer exception (texture %d)", this.id); } }
Example #30
Source File: Render.java From mapwriter with MIT License | 5 votes |
public static void printBoundTextureInfo(int texture) { int w = getTextureWidth(); int h = getTextureHeight(); int depth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL12.GL_TEXTURE_DEPTH); int format = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_INTERNAL_FORMAT); MwUtil.log("texture %d parameters: width=%d, height=%d, depth=%d, format=%08x", texture, w, h, depth, format); }