PDA

View Full Version : How to start OpenGL programming with Ruby?



polepole
03-06-2013, 04:10 AM
Hi,

I'm new to OpenGL and I was wondering where I should start learning to program OpenGL.
I wanted to use Ruby to do so and I've gotten OpenGL to work with Ruby by installing the gems (there are still some errors trying to execute some of the examples which came with the gem).
But now I'm stuck with OpenGL. Where should I start learning? Are there any good books I should read?

All help is appreciated!

polepole
03-08-2013, 04:19 AM
No one? :)

Alfonse Reinheart
03-08-2013, 04:24 AM
This is not exactly a vibrant community of Ruby programmers. You would be more likely to find an answer by asking on a Ruby forum.

polepole
03-12-2013, 09:42 AM
Hmm, I thought coding OpenGL in Ruby wouldn't be that different from coding it with C++. I'm going through the basic NeHe tutorials with the Ruby code for the examples and they seem quite similar..

Alfonse Reinheart
03-12-2013, 02:45 PM
If you're looking for general information about getting started with OpenGL, you should look at the OpenGL Wiki (http://www.opengl.org/wiki/Getting_Started).

stig mann
03-12-2013, 03:37 PM
Hi,
9 years ago I did some Ruby Opengl and liked it. Digging out my old code I find that it begins with:


require 'matrix'
require 'opengl'
require 'glut'


and the bottom of the code, called at the start as I've put procedures I've written above that, is



GLUT.Init
GLUT.InitDisplayMode( GLUT::SINGLE | GLUT::RGB )
GLUT.InitWindowSize( 1000, 700 )
GLUT.InitWindowPosition( 0, 0 )
GLUT.CreateWindow( "Ants" )
init()
GLUT.DisplayFunc( display )
GLUT.MainLoop()


where the "display" function that is passed by DisplayFunc() starts out as



display = Proc.new { # CALLED WHEN DISPLAY CHANGES FOR GRAPHICAL OUTPUT

GL.Clear( GL::COLOR_BUFFER_BIT )
GL.Color( 1.0, 1.0, 1.0 )


So that's a framework of code that worked a long time ago in a galaxy far, far away...sorry I don't remember what dlls I put where (and maybe freeglut has eclipsed the use of glut) but there should be intro sites that cover those basics.
Good luck,
Stig

polepole
03-13-2013, 02:39 PM
Hi, your code should work yeah (if gotten further in Ruby-OpenGL). I know what to do now but have some more specific OpenGL questions so I'll probably make a new thread.

The wiki doesn't seem to hold that much documentation on OpenGL functions..

Thanks for the replies.

Alfonse Reinheart
03-13-2013, 04:18 PM
The wiki doesn't seem to hold that much documentation on OpenGL functions.

Are you sure? (http://www.opengl.org/wiki/Category:Core_API_Reference) The only undocumented functions are those intentionally undocumented: the ones from the compatibility profile.

polepole
03-14-2013, 05:01 AM
Are you sure? (http://www.opengl.org/wiki/Category:Core_API_Reference) The only undocumented functions are those intentionally undocumented: the ones from the compatibility profile.

Oh, guess I may have written it off too soon because I couldn't find anything on Quadrics..
I'll post what I'm trying to make in another thread :)