[gephex-devel] opengl and gephex
Martin Bayer
martin at gephex.org
Mon Jun 13 13:03:40 CEST 2005
Why do we need a single gl_core interface?
+ portability by hiding the glx, wgl, agl subsystem
+ state cache optimization
+ resource management
- existing gl code must be changed to redirect gl* calls
- lots of delegation code needs to be written
Lets say we decide to use such a subsystem that controls the GPU access.
Who constructs that object and how do units and links get access to that
object?
1) The gephex core systems is linked against that gl_core library and
creates the object at startup. The gl_*_units and gl_*_link types are
initialized with a reference to that gl_core object.
- breaks the core shouldn't know anything about the types idea
- the core has a lot of dependencies
+ hackable in 0.4 (changes in the plugin api)
+ a quite clean implementation is possible in 0.5 (via template types)
2) There is only one module/unit that is linked against the gl_core
library. This module has an output and the value of the output is the
reference to the gl_core object. All gl_*_modules need an gl_core_type
input and must be connected to that output. This guarantees that
modules/units have access to the gl_core object at update() time. The
(link) types get the gl_core pointer from the units on their first access.
+ no changes in the gephex 0.4 and 0.5 engine design and codebase
- gl_core_type connections needed
- lacy_init code in the modules/units
3) Link all gl_*_modules and gl_*_types to a shared library with a
singleton that hold the gl_core object.
+ no changes in the engine
+ no gl_core_type connections
+ no lacy init code in the modules/units
- depends on the linker behavior and could be a portability problem
- breaks the "a plugin is an atom" idea
4) Put the gl_core object in the implementation of a link type. All
gl_*_units and gl_*_links have a type variable and we bind that with the
gl_core_link type.
The type of all gl_*_units and links is something like
"gl_output_unit<gl_core_link>" if you use c++ template syntax for the
generic gephex types.
+ plugin only implementation
- only 0.5
I favour (3) for gephex 0.4 and (4) for gephex 0.5. The call syntax in
the unit code is the same and the gl_core stuff can be reused without
changes.
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.gephex.org/pipermail/gephex-devel/attachments/20050613/c66308b3/signature.pgp
More information about the gephex-devel
mailing list