# Problems using ruby and opengl

**URL:** <https://rubytalk.org/t/problems-using-ruby-and-opengl/52854>\
**Category:** ruby-talk\
**Created:** [15 April 2009 04:40 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854 "2009-04-15T04:40:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ciph3rzer0](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@Ciph3rzer0](https://rubytalk.org/u/Ciph3rzer0)\
**Post date:** [15 April 2009 04:40 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/1 "2009-04-15T04:40:11Z")

</div>

So I just recently started using ruby and I love it. I am also taking  
a computer graphics course and I am using C and C++ to use OpenGL. I  
did a little searching, and it seems that ruby can do OpenGL too, but  
I've had some problems...

I get this error every time I try to call Glut.glutCreateWindow :

freeglut ERROR: Internal error \<FBConfig with necessary capabilities  
not found\> in function fgOpenWindow  
X Error of failed request: BadWindow (invalid Window parameter)  
&nbsp;&nbsp;Major opcode of failed request: 4 (X\_DestroyWindow)  
&nbsp;&nbsp;Resource id in failed request: 0x0  
&nbsp;&nbsp;Serial number of failed request: 25  
&nbsp;&nbsp;Current serial number in output stream: 28

I used both my code and example code (though I haven't had much luck  
finding any). The ruby-opengl page is surprisingly unhelpful, with  
very little information and tutorials.

Also, I've noticed that the sample programs I found haven't needed  
these two lines:

require 'rubygems'  
gem 'ruby-opengl'

I'm not entirely sure what's up.

---

<div class="post-metadata">

**Author:** ![Ciph3rzer0](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@Ciph3rzer0](https://rubytalk.org/u/Ciph3rzer0)\
**Post date:** [15 April 2009 15:15 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/2 "2009-04-15T15:15:17Z")

</div>

No ideas? Does anyone at least know how to set up ruby so that I  
don't need to add :

require 'rubygems'  
gem 'ruby-opengl'

to the beginning of a program?

---

<div class="post-metadata">

**Author:** ![Bill\_Kelly](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@Bill\_Kelly](https://rubytalk.org/u/Bill_Kelly)\
**Post date:** [15 April 2009 20:58 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/3 "2009-04-15T20:58:10Z")

</div>

> I get this error every time I try to call Glut.glutCreateWindow :
> 
> freeglut ERROR: Internal error \<FBConfig with necessary capabilities  
> not found\> in function fgOpenWindow  
> X Error of failed request: BadWindow (invalid Window parameter)  
> Major opcode of failed request: 4 (X\_DestroyWindow)  
> Resource id in failed request: 0x0  
> Serial number of failed request: 25  
> Current serial number in output stream: 28

One thing that seems odd there, is freeglut claiming the  
problem is an "Internal error".

> I used both my code and example code (though I haven't had much luck  
> finding any). The ruby-opengl page is surprisingly unhelpful, with  
> very little information and tutorials.

Had you already seen the tutorial page?

[http://ruby-opengl.rubyforge.org/tutorial.html](http://ruby-opengl.rubyforge.org/tutorial.html)

It mentions the ability to use SDL or GLFW to obtain a  
window, instead of GLUT. Unless GLUT is a fixed requirement for you, maybe you could sidestep the issue  
that way?

Regards,

Bill

> **···**
>
> From: "Ciph3rzer0" \<ciph3rzer0@gmail.com\>

---

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf1](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Joel\_VanderWerf1](https://rubytalk.org/u/Joel_VanderWerf1)\
**Post date:** [15 April 2009 19:09 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/4 "2009-04-15T19:09:46Z")

</div>

Ciph3rzer0 wrote:

> No ideas? Does anyone at least know how to set up ruby so that I  
> don't need to add :
> 
> require 'rubygems'  
> gem 'ruby-opengl'
> 
> to the beginning of a program?

You need this env var:

RUBYOPT=rubygems

> **···**
>
> --  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

---

<div class="post-metadata">

**Author:** ![Ciph3rzer0](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@Ciph3rzer0](https://rubytalk.org/u/Ciph3rzer0)\
**Post date:** [21 April 2009 04:20 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/5 "2009-04-21T04:20:03Z")

</div>

I don't really know how to use anything else...  
Does it seem like a problem with ruby-opengl? Or freeglut? are there  
other "glut"s I can use?

> **···**
>
> On Apr 15, 4:58 pm, Bill Kelly \<bi...@cts.com\> wrote:
> 
> > From: "Ciph3rzer0" \<ciph3rz...@gmail.com\>
> > 
> > \> I get this error every time I try to call Glut.glutCreateWindow :
> > 
> > \> freeglut ERROR: Internal error \<FBConfig with necessary capabilities  
> > \> not found\> in function fgOpenWindow  
> > \> X Error of failed request: BadWindow (invalid Window parameter)  
> > \> Major opcode of failed request: 4 (X\_DestroyWindow)  
> > \> Resource id in failed request: 0x0  
> > \> Serial number of failed request: 25  
> > \> Current serial number in output stream: 28
> > 
> > One thing that seems odd there, is freeglut claiming the  
> > problem is an "Internal error".
> > 
> > \> I used both my code and example code (though I haven't had much luck  
> > \> finding any). The ruby-opengl page is surprisingly unhelpful, with  
> > \> very little information and tutorials.
> > 
> > Had you already seen the tutorial page?
> > 
> > [http://ruby-opengl.rubyforge.org/tutorial.html](http://ruby-opengl.rubyforge.org/tutorial.html)
> > 
> > It mentions the ability to use SDL or GLFW to obtain a  
> > window, instead of GLUT. Unless GLUT is a fixed  
> > requirement for you, maybe you could sidestep the issue  
> > that way?
> > 
> > Regards,
> > 
> > Bill

---

<div class="post-metadata">

**Author:** ![Bill\_Kelly](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@Bill\_Kelly](https://rubytalk.org/u/Bill_Kelly)\
**Post date:** [21 April 2009 06:05 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/6 "2009-04-21T06:05:23Z")

</div>

> I don't really know how to use anything else...

You would still be using OpenGL... Unless you are doing  
anything fancy with the window itself (menus, etc.) then  
SDL or GLFW can be regarded as merely alternate ways to  
obtain a window for rendering with OpenGL.

> Does it seem like a problem with ruby-opengl? Or freeglut?  
> are there other "glut"s I can use?

I'm not sure how to guess where the problem lies. I would  
tend to suspect the ruby bindings, however I did find it  
curious that the error message came from freeglut and  
described itself as an "internal error".

Coincidentally, a relese candidate for freeglut version  
2.6.0 was just put online today:

[http://freeglut.sourceforge.net/index.php#download](http://freeglut.sourceforge.net/index.php#download)

So you might try compiling that new version of freeglut  
and see if you can get any of its C-based demos to work.  
If the C-based demos work, but the ruby bindings still  
produce the error, then we may have narrowed it down a  
little.

Hope this helps,

Bill

> **···**
>
> From: "Ciph3rzer0" \<ciph3rzer0@gmail.com\>

---

<div class="post-metadata">

**Author:** ![Ciph3rzer0](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@Ciph3rzer0](https://rubytalk.org/u/Ciph3rzer0)\
**Post date:** [21 April 2009 22:10 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/7 "2009-04-21T22:10:03Z")

</div>

well, I have tried using C with freeglut, and I can created windows  
and such. So I guess that already means it's a problem with the  
bindings?

I \*am\* in the process of compiling ruby 1.9. I figured since it said  
the bindings have been updated for 1.9, then that might be the problem.

> **···**
>
> On Apr 21, 2:05 am, Bill Kelly \<bi...@cts.com\> wrote:
> 
> > From: "Ciph3rzer0" \<ciph3rz...@gmail.com\>
> > 
> > \> I don't really know how to use anything else...
> > 
> > You would still be using OpenGL... Unless you are doing  
> > anything fancy with the window itself (menus, etc.) then  
> > SDL or GLFW can be regarded as merely alternate ways to  
> > obtain a window for rendering with OpenGL.
> > 
> > \> Does it seem like a problem with ruby-opengl? Or freeglut?  
> > \> are there other "glut"s I can use?
> > 
> > I'm not sure how to guess where the problem lies. I would  
> > tend to suspect the ruby bindings, however I did find it  
> > curious that the error message came from freeglut and  
> > described itself as an "internal error".
> > 
> > Coincidentally, a relese candidate for freeglut version  
> > 2.6.0 was just put online today:
> > 
> > [The freeglut Project :: About](http://freeglut.sourceforge.net/index.php#download)
> > 
> > So you might try compiling that new version of freeglut  
> > and see if you can get any of its C-based demos to work.  
> > If the C-based demos work, but the ruby bindings still  
> > produce the error, then we may have narrowed it down a  
> > little.
> > 
> > Hope this helps,
> > 
> > Bill

---

<div class="post-metadata">

**Author:** ![Ciph3rzer0](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@Ciph3rzer0](https://rubytalk.org/u/Ciph3rzer0)\
**Post date:** [22 April 2009 22:55 UTC](https://rubytalk.org/t/problems-using-ruby-and-opengl/52854/8 "2009-04-22T22:55:07Z")

</div>

Using ruby 1.9 has fixed the problem for me. Thanks everyone for your  
input.
