Jump to content

Fzzy

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Fzzy

  1. If somebody comes across this thread in the future, the code written in my post a few posts back is correct, i just needed to scale it properly to the screen using the ScaledResolution class
  2. So how could i use something like the RenderLivingEvent to render an overlay on top of an entity? It provides a RenderLivingBase but that doesnt have methods like drawString or drawTexturedModalRect for me to use.
  3. I'm currently using the RenderGameOverlayEvent, but even if i use the event for entity rendering, it doesn't give me any coordinates for where the entity is on the screen. I feel like im quite close to making it work. This is where i'm at right now GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); try { Method setupCameraTransform = EntityRenderer.class.getDeclaredMethod("setupCameraTransform", float.class, int.class); setupCameraTransform.setAccessible(true); setupCameraTransform.invoke(mc.entityRenderer, event.getPartialTicks(), 0); } catch (Exception e) { e.printStackTrace(); } FloatBuffer modelMatrix = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelMatrix); FloatBuffer projMatrix = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projMatrix); IntBuffer viewport = BufferUtils.createIntBuffer(16); GL11.glGetInteger(GL11.GL_VIEWPORT, viewport); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glPopAttrib(); FloatBuffer screen2D = BufferUtils.createFloatBuffer(16); if(Project.gluProject(242, 76, 25, modelMatrix, projMatrix, viewport, screen2D)) { int[] screen = new int[] {(int)screen2D.get(0), (int)screen2D.get(1)}; mc.ingameGUI.drawString(mc.fontRenderer, "overlay", screen[0], screen[1], 0xFF00FF00); }
  4. I wanted to draw more than just text. I also wanted to draw a texture using the drawRect thing. I found this thread from years ago describing exactly what i want, and claims to have solved it but never explained how he did it
  5. I've been trying to figure this out for the last couple hours and I'm having a really hard time figuring out what's going on with LWJGL. I'm trying to display text on top of an entity, but i can't seem to get it's coordinates on the screen from its coordinates in the world. I've found that there is a method for this in LWJGL called gluProject (https://stackoverflow.com/questions/21950105/java-lwjgl-opengl-convert-3d-point-to-2d-point), but i can't seem to get it to work. I managed to use LWJGL to display some lines on the entity but I'm not sure how this can be applied to display text over them as a sprite. If anybody has done something like this before i could really use some insight, thanks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.