Jump to content

Recommended Posts

Posted

So, I currently have this code from 1.8:

public static void drawBoundingBox(AxisAlignedBB axisalignedbb)
    {
        Tessellator tessellator = Tessellator.getInstance();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.draw();
    }

But almost everything (startDrawingQuads, addVertex and startDrawing) doesn't exists in 1.9 and up versions. 

Is there any change list that can help or will I have to search every method on google (wich I've already tried and found nothing)?

Posted

The Tessellator class was renamed.  It's called VertexBuffer now.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
2 minutes ago, Draco18s said:

The Tessellator class was renamed.  It's called VertexBuffer now.

The methods still don't exist, am I getting it correctly?

VertexBuffer var2 = Tessellator.getInstance().getBuffer();
Posted

You are. The formats have changed to work with GL >=3.0

startDrawingQuads -> begin, now needs a format to be specified for vertices.

addVertex -> pos(x, y, z).tex(u, v).color(r, g, b, a).normal(x, y, z).lightmap(s, t).endVertex(). Note that the chaining will be different for the format you choose. If your format is POSITION_TEX you will only have pos(...).tex(...).endVertex()

draw is still draw.

Look at the way vanilla works with tessellator now in vanilla code. GUIs are a good example as they usually manipulate tessellator directly

  • Like 1
Posted (edited)
9 minutes ago, V0idWa1k3r said:

You are. The formats have changed to work with GL >=3.0

startDrawingQuads -> begin, now needs a format to be specified for vertices.

addVertex -> pos(x, y, z).tex(u, v).color(r, g, b, a).normal(x, y, z).lightmap(s, t).endVertex(). Note that the chaining will be different for the format you choose. If your format is POSITION_TEX you will only have pos(...).tex(...).endVertex()

draw is still draw.

Look at the way vanilla works with tessellator now in vanilla code. GUIs are a good example as they usually manipulate tessellator directly

What about startDrawing?

EDIT: Also, I'm not being able to find the format enum

Edited by Checkium
Posted (edited)

it is now called begin, and takes an integer and a VertexFormat as parameters.

Integer is just the drawing method, the way your vertices are drawn by OpenGL. You can reference GL directly(for rendering quads you would use GL11.GL_QUADS, or for something more complex you can use other drawing indices). VertexFormat is the way your vertices are packet and uploaded to OpenGL. While you can define your own format there is no need to do so as all of them can be found in the DefaultVertexFormats class. Their names are pretty self-explanatory

Edited by V0idWa1k3r
  • Like 1
Posted
6 minutes ago, V0idWa1k3r said:

it is now called begin, and takes an integer and a VertexFormat as parameters.

Integer is just the drawing method, the way your vertices are drawn by OpenGL. You can reference GL directly(for rendering quads you would use GL11.GL_QUADS, or for something more complex you can use other drawing indices). VertexFormat is the way your vertices are packet and uploaded to OpenGL. While you can define your own format there is no need to do so as all of them can be found in the DefaultVertexFormats cass. Their names are pretty self-explanatory

Sorry for all the noob questions but what would be the glMode for quads?
Also, draw seems to not exist.

Posted
Just now, Checkium said:

Sorry for all the noob questions but what would be the glMode for quads?

 

8 minutes ago, V0idWa1k3r said:

for rendering quads you would use GL11.GL_QUADS

 

draw still exists, it is just not in the VertexBuffer, but in the Tessellator itself:

Tessellator.getInstance().draw()

 

  • Like 1
Posted
1 minute ago, V0idWa1k3r said:

 

 

draw still exists, it is just not in the VertexBuffer, but in the Tessellator itself:


Tessellator.getInstance().draw()

 

GL11.GL_QUADS gives me error than its not a statement

Posted (edited)

Show your code?

The following line works just fine for me:

Tessellator.getInstance().getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

Have you added GL11 to your imports?

In any case you do not need to reference GL at all. GL_QUADS is a constant of 7. So

Tessellator.getInstance().getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);

Will work exactly the same, just look slightly more messy with that 7 out of nowhere :)

 

Edited by V0idWa1k3r
  • Like 1
Posted
Just now, V0idWa1k3r said:

Show your code?

The following line works just fine for me:


Tessellator.getInstance().getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

Have you added GL11 to your imports?

OH... than makes sense I was trying to use  GL11.GL_QUADS  as a method.

Posted
7 minutes ago, V0idWa1k3r said:

Show your code?

The following line works just fine for me:


Tessellator.getInstance().getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

Have you added GL11 to your imports?

In any case you do not need to reference GL at all. GL_QUADS is a constant of 7. So


Tessellator.getInstance().getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);

Will work exactly the same, just look slightly more messy with that 7 out of nowhere :)

 

So, now that part is fine, but there a new part.

What replaces RenderManager.renderPosX Y and Z and AxisAlignedBB.getBoundingBox?

Posted (edited)
43 minutes ago, Checkium said:

The methods still don't exist, am I getting it correctly?


VertexBuffer var2 = Tessellator.getInstance().getBuffer();

Tessellator.getInstance().getBuffer();

Tessellator.getInstance()

Tessellator

 

Seriously?

 

Also, the class has changed more than just its name, so you'll have to look at existing usages in order to update the code.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
2 minutes ago, Draco18s said:

Tessellator.getInstance().getBuffer();

Tessellator.getInstance()

Tessellator

 

Seriously?

 

Also, the class has changed more than just its name, so you'll have to look at existing usages in order to update the code.

That part is already done, look at the posts before yours.

Posted

Depends.

RenderManager still has those fields, they are just private. But I think that you want to use the viewerPosX/Y/Z ones. They require the RenderManager instance though. You might want to look at EntityRenderer and the way it handles player-camera-based transformations, if I understood your intentions correctly. What do you want to achieve?

AxisAlignedBB can simply be instantiated (new AxisAlignedBB(x0, y0, z0, x1, y1, z1)). It changed a bit though(it's xyz fields are now final and it has a few new methods) so you might want to see how vanilla handles it now.

  • Like 1
Posted
5 minutes ago, V0idWa1k3r said:

Depends.

RenderManager still has those fields, they are just private. But I think that you want to use the viewerPosX/Y/Z ones. They require the RenderManager instance though. You might want to look at EntityRenderer and the way it handles player-camera-based transformations, if I understood your intentions correctly. What do you want to achieve?

AxisAlignedBB can simply be instantiated (new AxisAlignedBB(x0, y0, z0, x1, y1, z1)). It changed a bit though(it's xyz fields are now final and it has a few new methods) so you might want to see how vanilla handles it now.

So.... Got it working but something is broken.
V6As6ge.png

The box should be around that NPC

Posted
7 minutes ago, V0idWa1k3r said:

I believe I have already solved a very similar issue today :D

 

I'm trying to use the code you shown on that topic, whats the variable evt?

Posted
1 minute ago, V0idWa1k3r said:

It is the event instance that the rendering is done at. Also that is a code example, you might need to tweak it before it starts working as you want it to work.

Well TickEvent.RenderTickEvent doesn't have that, and wouldn't  RenderWorldLastEvent not work since players move and that will only execute on world load?

Posted (edited)
35 minutes ago, Checkium said:

Well TickEvent.RenderTickEvent doesn't have that

Does not have what? O.o The instance of itself? It sure does :D Or do you mean partial ticks? It also does...

RenderWorldLastEvent is fired each frame after everything else but the player's first person hand has been rendered (hence the name).

 

Update:

2017-05-01_03_56_14.png.551763bb19983298ac182d454675df89.png

:P

 

Just tossing this out here, RenderLivingEvent is clearly superior for the effect you are trying to achieve. It even has the X/Y/Z variables signifying entity positon <-> camera position offset for your rendering right there, ready to go! No extra translations required :)

 

Edited by V0idWa1k3r
Posted (edited)
10 hours ago, V0idWa1k3r said:

Does not have what? O.o The instance of itself? It sure does :D Or do you mean partial ticks? It also does...

RenderWorldLastEvent is fired each frame after everything else but the player's first person hand has been rendered (hence the name).

 

Update:

2017-05-01_03_56_14.png.551763bb19983298ac182d454675df89.png

:P

 

Just tossing this out here, RenderLivingEvent is clearly superior for the effect you are trying to achieve. It even has the X/Y/Z variables signifying entity positon <-> camera position offset for your rendering right there, ready to go! No extra translations required :)

 

RenderLivingEvent wouldn't work since it fires only on entity render, and the box is drawn after it.

Also, I was thinking here, and wouldn't make it render the glowing effect on the entity be easier?

Edited by Checkium
Posted

There are 2 sub-events of the RenderLivingEvent - Pre and Post. I think you can figure out when they are fired by their names.

And if you want your outline to be drawn over an entity you need to disable GL depth.

A 'glowing effect'? Could you explain with a bit more details what are you trying to achieve? If you want the outline to be bright you need to pass appropriate lightmap coordinates to tessellator's vertexbuffer

Posted (edited)
3 minutes ago, V0idWa1k3r said:

There are 2 sub-events of the RenderLivingEvent - Pre and Post. I think you can figure out when they are fired by their names.

And if you want your outline to be drawn over an entity you need to disable GL depth.

A 'glowing effect'? Could you explain with a bit more details what are you trying to achieve? If you want the outline to be bright you need to pass appropriate lightmap coordinates to tessellator's vertexbuffer

for RenderLivingEvent, I dont think it will work even with post because it is only fired once afaik, and the player can be assigned much after.

Currently i'm trying with RenderWorldLastEvent but its drawing nothing, this is my code:

    @SubscribeEvent
   public void Event(RenderWorldLastEvent e) {
          if (!(murder == null)) {

              AxisAlignedBB abb = new AxisAlignedBB(1, (double) murder.getYOffset(), 1, (double) murder.getYOffset(), 2, 1);

               // Usually the player
               Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
//Interpolating everything back to 0,0,0. These are transforms you can find at RenderEntity class
             double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)e.getPartialTicks();
              double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)e.getPartialTicks();
               double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)e.getPartialTicks();
               GL11.glPushMatrix();
               GL11.glTranslated(-d0, -d1, -d2);
               GL11.glColor4f(0.27F, 0.70F, 0.92F, 1.0F);
               GLHelper.startDrawingESPs(abb, 0.27F, 0.70F, 0.92F);
               GL11.glPopMatrix();
           }
   }
Edited by Checkium
Posted
Just now, Checkium said:

for RenderLivingEvent, I dont think it will work even with post because it is only fired once afaik, and the player can be assigned much after.

Ehh.. What? It is fired each frame, as any other render event. 

I don't really get the 'player can be assigned later' bit too. Assigned to what? RenderLivingEvent only fires for entities which are, well, drawn on screen. The entity object you get in that event can't be null. And as far as I am aware MC will not render players on the client (and thus will not call the event) untill the full data but the skin has been recieved for that player. And if you really need it you can even wait for the skin to be recieved with a simple if check...

 

I do not see the

startDrawingESPs

method, but I assume it simply renders the AABB you've provided. You are not offsetting enough. Say your entity is at 20 10 10. And the player is at -20 10 10. Right now you are translating the tessellator to 0 0 0... and rendering the box there. You know, at 0, yourEntityOffsetY, 0. Why are you not applying the X and Z entity coordintes to your aabb?

Also your minY and maxY coordinates are the same for your aabb. Unless you are handling that differently in your render function that will not work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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