Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Somehow when i try rotating some lines i draw with the tesselator, they just stay as they are. Any solution?

Here is what i tried so far(Don't wonder about the complicated for loops, i gonna make them in a method later):

 

 

GL11.glRotated(tile.rotation, 0, 1, 0);

GL11.glPushMatrix();

GL11.glLineWidth(2.5F);

WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();

TileEntity_PowerLine connectedTile = tile.connected;

 

if (connectedTile != null) {

BlockPos pos = connectedTile.getPos();

BlockPos pos2 = tile.getPos();

Vector3f temp = Vector3f.sub(MathUtil.blockPosVec(pos), MathUtil.blockPosVec(pos2), null);

double distance = euclidianDistance(MathUtil.blockPosVec(pos), MathUtil.blockPosVec(pos2));

double scalefactor = distance*5.81;

//Drawing

GlStateManager.pushAttrib();

GlStateManager.pushMatrix();

worldRenderer.startDrawing(GL11.GL_LINE_STRIP);

worldRenderer.setColorOpaque(0, 0, 0);

 

 

for (double i = -distance/2; i <= distance/2; i+=1D) {

double cosh = Math.cosh(i /  distance/2.0)*scalefactor;

double offsetY=(Math.cosh(distance/2 /  distance/2)*scalefactor);

worldRenderer.addVertex(posX+0.5 + 7, posY+21.98 -offsetY + cosh , posZ+0.5 + distance/2 + i);

 

}

Tessellator.getInstance().draw();

 

worldRenderer.startDrawing(GL11.GL_LINE_STRIP);

worldRenderer.setColorOpaque(0, 0, 0);

for (double i = -distance/2; i <= distance/2; i+=1D) {

double cosh = Math.cosh(i / distance/2.0)*scalefactor;

double offsetY=(Math.cosh(distance/2 /  distance/2)*scalefactor);

worldRenderer.addVertex(posX - 7, posY+21.98 -offsetY + cosh, posZ+0.5 + distance/2 + i);

 

}

Tessellator.getInstance().draw();

 

worldRenderer.startDrawing(GL11.GL_LINE_STRIP);

worldRenderer.setColorOpaque(0, 0, 0);

for (double i = -distance/2; i <= distance/2; i+=1D) {

double cosh = Math.cosh(i / distance/2.0)*scalefactor;

double offsetY=(Math.cosh(distance/2 /  distance/2)*scalefactor);

worldRenderer.addVertex(posX+0.5 + 3.5, posY+21.98 -offsetY + cosh, posZ+0.5 + distance/2 + i);

 

}

Tessellator.getInstance().draw();

 

worldRenderer.startDrawing(GL11.GL_LINE_STRIP);

worldRenderer.setColorOpaque(0, 0, 0);

for (double i = -distance/2; i <= distance/2; i+=1D) {

double cosh = Math.cosh(i / distance/2.0)*scalefactor;

double offsetY=(Math.cosh(distance/2 /  distance/2)*scalefactor);

worldRenderer.addVertex(posX+0.5 - 3.5, posY+21.98 -offsetY + cosh, posZ +0.5 + distance/2 + i);

 

}

Tessellator.getInstance().draw();

 

worldRenderer.startDrawing(GL11.GL_LINE_STRIP);

worldRenderer.setColorOpaque(0, 0, 0);

for (double i = -distance/2; i <= distance/2; i+=1D) {

double cosh = Math.cosh(i / distance/2.0)*scalefactor;

double offsetY=(Math.cosh(distance/2 /  distance/2)*scalefactor);

worldRenderer.addVertex(posX+0.5, posY+29.98 -offsetY + cosh, posZ+0.5 + distance/2 + i);

 

}

Tessellator.getInstance().draw();

 

GlStateManager.popMatrix();

GlStateManager.popAttrib();

}

if (tile.connected != null) {

BlockPos p = tile.getPos();

BlockPos p2 = tile.getPos();

Vector3f tilePos = new Vector3f(p.getX(), p.getY(), p.getZ());

Vector3f connectedTilePos = new Vector3f(p2.getX(), p2.getY(), p2.getZ());

double dot = Vector3f.dot(tilePos, connectedTilePos);

double angle = Vector3f.angle(tilePos, connectedTilePos);

GL11.glRotated(angle, 0, 1, 0);

}

GL11.glPopMatrix();

 

 

Well I would start by isolating the code that draws lines into another method, then try running your GL11.rotate before running the method.

 

Edit: Try calling your GL11.glRotated(tile.rotation, 0, 1, 0); after you call the pushMatrix(); talking about the first 2 lines

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.