Skip to content

Commit

Permalink
Merge pull request #107 from mjevans/remove-glNormal
Browse files Browse the repository at this point in the history
Disable incorrect glNormal calls which caused errors.
  • Loading branch information
Dream-Master authored Sep 5, 2023
2 parents 91c32e5 + dc639b6 commit 96be9d0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/main/scala/li/cil/oc/client/renderer/item/ItemRenderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ object ItemRenderer extends IItemRenderer {
GL11.glDisable(GL11.GL_CULL_FACE)

// Front.
GL11.glNormal3f(0, 0, 1)
// GL11.glNormal3f(0, 0, 1)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
Expand All @@ -204,7 +204,7 @@ object ItemRenderer extends IItemRenderer {
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ)

// Back.
GL11.glNormal3f(0, 0, -1)
// GL11.glNormal3f(0, 0, -1)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.minZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
Expand All @@ -215,7 +215,7 @@ object ItemRenderer extends IItemRenderer {
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ)

// Top.
GL11.glNormal3f(0, 1, 0)
// GL11.glNormal3f(0, 1, 0)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(bounds.maxZ * 16))
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(bounds.minZ * 16))
Expand All @@ -226,7 +226,7 @@ object ItemRenderer extends IItemRenderer {
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ)

// Bottom.
GL11.glNormal3f(0, -1, 0)
// GL11.glNormal3f(0, -1, 0)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(bounds.maxZ * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(bounds.minZ * 16))
Expand All @@ -237,7 +237,7 @@ object ItemRenderer extends IItemRenderer {
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.maxZ)

// Left.
GL11.glNormal3f(1, 0, 0)
// GL11.glNormal3f(1, 0, 0)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
Expand All @@ -248,7 +248,7 @@ object ItemRenderer extends IItemRenderer {
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ)

// Right.
GL11.glNormal3f(-1, 0, 0)
// GL11.glNormal3f(-1, 0, 0)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object UpgradeRenderer {
GL11.glBegin(GL11.GL_QUADS)

// Front.
GL11.glNormal3f(0, 0, 1)
// GL11.glNormal3f(0, 0, 1)
GL11.glTexCoord2f(frontOffset, 0.5f)
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(frontOffset + 0.5f, 0.5f)
Expand All @@ -79,7 +79,7 @@ object UpgradeRenderer {
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ)

// Top.
GL11.glNormal3f(0, 1, 0)
// GL11.glNormal3f(0, 1, 0)
GL11.glTexCoord2f(1, 0.5f)
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(1, 1)
Expand All @@ -90,7 +90,7 @@ object UpgradeRenderer {
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ)

// Bottom.
GL11.glNormal3f(0, -1, 0)
// GL11.glNormal3f(0, -1, 0)
GL11.glTexCoord2f(0.5f, 0.5f)
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(0.5f, 1)
Expand All @@ -101,7 +101,7 @@ object UpgradeRenderer {
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.maxZ)

// Left.
GL11.glNormal3f(1, 0, 0)
// GL11.glNormal3f(1, 0, 0)
GL11.glTexCoord2f(0, 0.5f)
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(0, 1)
Expand All @@ -112,7 +112,7 @@ object UpgradeRenderer {
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ)

// Right.
GL11.glNormal3f(-1, 0, 0)
// GL11.glNormal3f(-1, 0, 0)
GL11.glTexCoord2f(0, 1)
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(0, 0.5f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,22 @@ object RobotRenderer extends TileEntitySpecialRenderer {

GL11.glNewList(displayList, GL11.GL_COMPILE)

// This is _all_ deprecated old GL stuff... https://stackoverflow.com/a/13149580
GL11.glBegin(GL11.GL_TRIANGLE_FAN)
GL11.glTexCoord2f(0.25f, 0.25f)
GL11.glVertex3f(0.5f, 1, 0.5f)
GL11.glTexCoord2f(0, 0.5f)
GL11.glVertex3f(l, gt, h)
normal(Vec3.createVectorHelper(0, 0.2, 1))
// normal(Vec3.createVectorHelper(0, 0.2, 1))
GL11.glTexCoord2f(0.5f, 0.5f)
GL11.glVertex3f(h, gt, h)
normal(Vec3.createVectorHelper(1, 0.2, 0))
// normal(Vec3.createVectorHelper(1, 0.2, 0))
GL11.glTexCoord2f(0.5f, 0)
GL11.glVertex3f(h, gt, l)
normal(Vec3.createVectorHelper(0, 0.2, -1))
// normal(Vec3.createVectorHelper(0, 0.2, -1))
GL11.glTexCoord2f(0, 0)
GL11.glVertex3f(l, gt, l)
normal(Vec3.createVectorHelper(-1, 0.2, 0))
// normal(Vec3.createVectorHelper(-1, 0.2, 0))
GL11.glTexCoord2f(0, 0.5f)
GL11.glVertex3f(l, gt, h)
GL11.glEnd()
Expand All @@ -108,16 +109,16 @@ object RobotRenderer extends TileEntitySpecialRenderer {
GL11.glVertex3f(0.5f, 0.03f, 0.5f)
GL11.glTexCoord2f(0.5f, 0)
GL11.glVertex3f(l, gb, l)
normal(Vec3.createVectorHelper(0, -0.2, 1))
// normal(Vec3.createVectorHelper(0, -0.2, 1))
GL11.glTexCoord2f(1, 0)
GL11.glVertex3f(h, gb, l)
normal(Vec3.createVectorHelper(1, -0.2, 0))
// normal(Vec3.createVectorHelper(1, -0.2, 0))
GL11.glTexCoord2f(1, 0.5f)
GL11.glVertex3f(h, gb, h)
normal(Vec3.createVectorHelper(0, -0.2, -1))
// normal(Vec3.createVectorHelper(0, -0.2, -1))
GL11.glTexCoord2f(0.5f, 0.5f)
GL11.glVertex3f(l, gb, h)
normal(Vec3.createVectorHelper(-1, -0.2, 0))
// normal(Vec3.createVectorHelper(-1, -0.2, 0))
GL11.glTexCoord2f(0.5f, 0)
GL11.glVertex3f(l, gb, l)
GL11.glEnd()
Expand Down

0 comments on commit 96be9d0

Please sign in to comment.