larskanis / opengl

The official repository of the ruby-opengl wrapper
http://larskanis.github.com/opengl
MIT License
57 stars 10 forks source link

invalid operation for glEnd #18

Open itgenie98 opened 6 years ago

itgenie98 commented 6 years ago

When i run the Examples, sometimes its get an error if the Program tries to use glEnd. Here is a log of the nehe_lesson02.rb run on Windows 7 with Ruby 2.4.2-2

D:/Ruby24/lib/ruby/gems/2.4.0/gems/opengl-0.10.0-x86-mingw32/lib/opengl.rb:46:in `glBegin': invalid operation for glEnd (Gl::Error)
        from D:/Ruby24/lib/ruby/gems/2.4.0/gems/opengl-0.10.0-x86-mingw32/lib/opengl.rb:46:in `block (2 levels) in <module:Gl>'
        from nehe_lesson02.rb:68:in `draw_gl_scene'
        from nehe_lesson02.rb:39:in `init_gl_window'
        from nehe_lesson02.rb:115:in `<main>'
bookface commented 6 years ago

If you put glBegin and glEnd within a display list, it will work, but glEnd by itself still dies. It's a bizarre error.

itgenie98 commented 6 years ago

This is strange. Anyway this fork sadly seems to be dead.

bookface commented 6 years ago
  1. Edit opengl.rb

  2. Insert begin/rescue around implementation.send:

    define_singleton_method(mn) do |args,&block| begin implementation.send(mn, args, &block) rescue end end define_method(mn) do |args,&block| begin implementation.send(mn, args, &block) rescue end end

This is a kludge of course, but I can now execute my opengl code.

larskanis commented 6 years ago

Sorry, I currently don't have the time to help you, but I added a section about maintenance to the README.