mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Removed redundant glError? from Map class and renamed CommonMethods#glError? to #gl_error?, added debug settings for disabling shaders and whether to exit on opengl error
This commit is contained in:
19
lib/map.rb
19
lib/map.rb
@@ -2,6 +2,7 @@ class IMICFPS
|
||||
class Map
|
||||
include EntityManager
|
||||
include LightManager
|
||||
include CommonMethods
|
||||
|
||||
attr_reader :collision_manager
|
||||
attr_reader :gravity
|
||||
@@ -37,23 +38,15 @@ class IMICFPS
|
||||
@map_loader
|
||||
end
|
||||
|
||||
def glError?
|
||||
e = glGetError()
|
||||
if e != GL_NO_ERROR
|
||||
$stderr.puts "OpenGL error in: #{gluErrorString(e)} (#{e})\n"
|
||||
exit
|
||||
end
|
||||
end
|
||||
|
||||
def render(camera)
|
||||
glError?
|
||||
gl_error?
|
||||
|
||||
Gosu.gl do
|
||||
glError?
|
||||
gl_error?
|
||||
glClearColor(0,0.2,0.5,1) # skyish blue
|
||||
glError?
|
||||
gl_error?
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen and the depth buffer
|
||||
glError?
|
||||
gl_error?
|
||||
|
||||
@renderer.draw(camera, @lights, @entities)
|
||||
end
|
||||
@@ -66,4 +59,4 @@ class IMICFPS
|
||||
# @lights.each(&:update)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user