[GEM-dev] tutorials for extending Gem

IOhannes m zmoelnig zmoelnig at iem.at
Tue Oct 29 17:04:36 CET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 2013-10-29 13:39, Claude Heiland-Allen wrote:
> Hi,
> 
> I want to write a new Geo.
> 
> Looking for a tutorial, I found the documentation at 
> gem/doc/manual/WriteCode.html which essentially says "use the
> source, Luke".  But 140k lines of code are quite daunting...

ahja, this document has not been touched since i took over Gem 13 or
so years ago...

> 
> Where should I start?

derive your object-class from GemBasse


> I need 3 methods, respectively called

> after OpenGL context creation,

virtual void startRendering();

> at render time

virtual void render(GemState *state);


> and before context destruction.

virtual void stopRendering();


to there's also a
 virtual bool isRunnable();
that get's called (usually once) for each context so you can add some
checks whether the current openGL-context provides everything you
need: if isRunnable() returns FALSE, the object will not be part of
the rendering chain. (this is mainly to prevent continuous triggers of
invalid calls)


start/stopRendering is not really tied to context creation/destruction
but to turning rendering on/off (which has been enough for most
use-case so far)
once the multi-context support is finished, stopRendering() will also
be called if a context is destroyed.


in order to make your object multi-context aware, you should use
gem::ContextData for any per-context variable.

something like:
  gem::ContextData<GLenum>m_id;

in most cases, you can use `m_id` just as if it was a GLenum (that is:
the template-argument type), but it will hold a different value for
each context.


hope this helps.

fgmasdr
IOhannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBCAAGBQJSb9yQAAoJELZQGcR/ejb40WIP/2J7Ln0okBVi/KOOrTGbJ/KX
H45JCmeZ+Np8cyHk3MA0OMUmmmVmckVZvYAHZTmLnVQf6JRnmRcIbFMaoMDA3t6a
DxygfkTdLQAGHRfKmPahvdu/lBkBB3tuMDUVo88uzU4SDDQJqahSQHErE4FcTW+g
OWY0wrnZyA+qWPH65Z/P7HKJxXbhrqz3c7oQ4U1wsZfbMrZhdnbwgNxJ2ODwWi1b
EtuqDVL+drsqLeEjUA6Kl7ePKLRj8Kbr3lO59v4WLdX0HJHyruYGDhFPW2VQawtG
Au+/SFpytZqQsXTD6F2pNRWxdvXFYwGA2Fif76bUjM2TIXL/PO4W/Jz1QQdOOd1S
+3LPKRjUm7K3lLEkFQhXl7fjNTCgqoVVdrvbmT4WUqehg1r+5xPus1dBg9jPc8JC
TLIsP2G197DVx/l0FePrqQRei1GOUJKfc2FjC1tSyhw9jF8F5iOTm88iLmRgbzw1
Sw1yeLt1zeISG1/OAh0FoZBeCGTkMG0MVD+mm4Yt3sR+S2T3LEilQpwxBWbZNyQ7
51I8RcN5p/rPWgYRdm+dZZcH8Mwa2zGY6OH9gltGruVMGQbRb+Mt1PxQt+ElVHoa
tuka0kRu7Bsv3SRqSqb/6rGjaJsxAp47JyddHUkf0LCgGRxJBdt1wVbKMZcsTpPB
yP0g4u6jQmAdkH5Q7ohH
=ypAk
-----END PGP SIGNATURE-----



More information about the GEM-dev mailing list