Sha256: 1cfd03252f306261e5d7cd284d4d689db554ac0795fa00998082c319365e2058

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

begin
  require "opengl"
rescue LoadError
  puts "Required gem is not installed, please install 'opengl-bindings' and try again."
  exit(1)
end

module CyberarmEngine
  def gl_error?
    e = glGetError
    if e != GL_NO_ERROR
      warn "OpenGL error detected by handler at: #{caller[0]}"
      warn "    #{gluErrorString(e)} (#{e})\n"
      exit if Window.instance&.exit_on_opengl_error?
    end
  end

  def preload_default_shaders
    shaders = %w[g_buffer lighting]
    shaders.each do |shader|
      Shader.new(
        name: shader,
        includes_dir: "#{CYBERARM_ENGINE_ROOT_PATH}/assets/shaders/include",
        vertex: "#{CYBERARM_ENGINE_ROOT_PATH}/assets/shaders/vertex/#{shader}.glsl",
        fragment: "#{CYBERARM_ENGINE_ROOT_PATH}/assets/shaders/fragment/#{shader}.glsl"
      )
    end
  end
end

require_relative "opengl/shader"
require_relative "opengl/texture"
require_relative "opengl/light"
require_relative "opengl/perspective_camera"
require_relative "opengl/orthographic_camera"

require_relative "opengl/renderer/g_buffer"
require_relative "opengl/renderer/bounding_box_renderer"
require_relative "opengl/renderer/opengl_renderer"
require_relative "opengl/renderer/renderer"

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cyberarm_engine-0.24.4 lib/cyberarm_engine/opengl.rb
cyberarm_engine-0.24.3 lib/cyberarm_engine/opengl.rb
cyberarm_engine-0.24.2 lib/cyberarm_engine/opengl.rb
cyberarm_engine-0.24.1 lib/cyberarm_engine/opengl.rb
cyberarm_engine-0.24.0 lib/cyberarm_engine/opengl.rb
cyberarm_engine-0.23.0 lib/cyberarm_engine/opengl.rb