Fixed scaling lighting weirdness

This commit is contained in:
2018-03-18 11:53:41 -05:00
parent b35edcc7aa
commit 4d09dde058
4 changed files with 12 additions and 9 deletions

View File

@@ -43,7 +43,6 @@ class IMICFPS
def render(x,y,z, scale = 1)
glTranslatef(x,y,z)
glScalef(scale,scale,scale)
@objects.each_with_index do |o, i|
glEnable(GL_CULL_FACE)
glEnable(GL_COLOR_MATERIAL)
@@ -63,8 +62,8 @@ class IMICFPS
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, [material.diffuse.red, material.diffuse.green, material.diffuse.blue, 1.0])
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [material.specular.red, material.specular.green, material.specular.blue, 1.0])
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, [10.0])
glNormal3f(normal.x, normal.y, normal.z)
glVertex3f(vertex.x, vertex.y, vertex.z)
glNormal3f(normal.x, normal.y, normal.z) # Don't scale normals
glVertex3f(vertex.x*scale, vertex.y*scale, vertex.z*scale)
end
glEnd
glDisable(GL_CULL_FACE)