From 47a27c15d3eedcd27264ad62d953e26b070af688 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 18 Mar 2018 15:36:36 -0500 Subject: [PATCH] Disabled glut, got scaling working as desired. --- i-mic-fps.rb | 2 +- lib/wavefront/model.rb | 9 +++++++-- lib/window.rb | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/i-mic-fps.rb b/i-mic-fps.rb index c71aca0..f9d8178 100644 --- a/i-mic-fps.rb +++ b/i-mic-fps.rb @@ -1,6 +1,6 @@ require "opengl" require "glu" -require "glut" +# require "glut" require "gosu" require "fiddle" diff --git a/lib/wavefront/model.rb b/lib/wavefront/model.rb index 8fb2189..142950e 100644 --- a/lib/wavefront/model.rb +++ b/lib/wavefront/model.rb @@ -2,7 +2,7 @@ class IMICFPS class Wavefront class Model include GL - include GLU + # include GLU TextureCoordinate = Struct.new(:u, :v, :weight) Vertex = Struct.new(:x, :y, :z, :weight) Color = Struct.new(:red, :green, :blue, :alpha) @@ -42,7 +42,10 @@ class IMICFPS end def render(x,y,z, scale = 1) + glEnable(GL_NORMALIZE) + glPushMatrix glTranslatef(x,y,z) + glScalef(scale, scale, scale) @objects.each_with_index do |o, i| glEnable(GL_CULL_FACE) glEnable(GL_COLOR_MATERIAL) @@ -63,12 +66,14 @@ class IMICFPS 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) # Don't scale normals - glVertex3f(vertex.x*scale, vertex.y*scale, vertex.z*scale) + # glVertex3f(vertex.x*scale, vertex.y*scale, vertex.z*scale) + glVertex3f(vertex.x, vertex.y, vertex.z) end glEnd glDisable(GL_CULL_FACE) glDisable(GL_COLOR_MATERIAL) end + glPopMatrix end def parse diff --git a/lib/window.rb b/lib/window.rb index 51c95db..ed4d403 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -2,7 +2,7 @@ class IMICFPS class Window < Gosu::Window include GL include GLU - include GLUT + # include GLUT Point = Struct.new(:x, :y) def initialize(window_width = 1280, window_height = 800, fullscreen = false)