From: Lyle Johnson Date: 2001-11-30T01:34:52+09:00 Subject: [ruby-talk:26929] Re: FXGLViewer - rotate a primitive? Note sure if this made it last time... > > Also observe this is on the FOX side, not the FXRuby side. In the latest release (FXRuby-0.99.180) those FXGLShape subclasses are actually coded completely in Ruby (see lib/fox/glshapes.rb), so it may be a little easier to examine the code to see what's going on. The base class (FXGLShape) is still a wrapper around the C++ class but I may try to change that too. > Then the issue would be A> FXRuby took them seriously, B> I don't want to > ship a FOX patch, or any C++ source, with my project, and C> I don't know > how to derive from FXGLObject within Ruby yet. But the last option would > appear to be the best. > > Lyle - can I inherit from FXGLObject thru Ruby? I'm asking you first to > avoid trying and getting all tangled up. Recall that "inherit" imlies I can > override the draw() methods. Yes, you can absolutely derive new Ruby classes from FXGLObject (or its subclasses) and override their virtual methods. I've attached a subclass of FXGLCylinder (called MyCylinder) that uses a different rotation matrix for the cylinder, and a modified version of the "glviewer.rb" that shipped with FXRuby-0.99.180 that draws one of these MyCylinder shapes instead of a stock FXGLCylinder. You might choose to add an accessor method that lets you plug in a different rotation matrix or whatever, but I think you can take it from there. Hope this helps, Lyle