How to create OpenGL 3.x or 4.x context in Ruby?

这一生的挚爱 提交于 2019-12-07 11:45:11

问题


I've looked everywhere, but there seam to be no ruby binding that would allow to create OpenGL 3/4 context.

It do not have to be complete OpenGL binding library, just portion that creates OpenGL context.

Update: If I'm desperate enough I'll do partial glfw ruby binding with ruby ffi. So pls save me from that ;)


回答1:


I have written a library that can create an OpenGL 3 or 4 context on most platforms (provided it is supported). It's called Ray. You don't have to use its drawable system or DSL, you can just use it to create a window and an OpenGL context.

Ray::GL.major_version = 3
Ray::GL.minor_version = 2
Ray::GL.core_profile  = true # if you want/need one

window = Ray::Window.new("test", [640, 480])
window.make_current
# You can make OpenGL calls yourself now


来源:https://stackoverflow.com/questions/7133319/how-to-create-opengl-3-x-or-4-x-context-in-ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!