Re: opengl and gephex

Martin Bayer <[email protected]> Sat, 11 Jun 2005 18:23:13 +0200
Newsgroups gmane.comp.video.gephex.devel
Message-ID <[email protected]>
>>> Thus easy
>>> rendering via Input_texture->Set(); and Output_texture->SetActive();
>>> will be possible (this would in the case of opengl bind a texture to a
>>> certain stage and set Output_texture as an active rendertarget). (this
>>> is still just a draft, so thoughts are welcome).   
>>
>> gl_core->texture_input_set(in_tex_1)
>> gl_core->texture_output_set(out_tex_1)
>>
> I'd really prefer the non-id variant (using a texture class instead)

I'm open to use pointers to objects instead off ids. There is no
big difference between both. I just called it id because the effect
coder should not use the pointer to call a method of the "texture object".

But you need the core pointer as parameter. Because at the construction
time of the gl_*_modules and gl_core_link_types there is no reference to
the gl_core wrapper object available.

You need a way to create a new texture if it isn't yet initialized. And
initialization is only possible with a pointer to the gl_core object.
And this object is only available at update() time.

1.) you can wrap all methods in something like that.

if( in_text_1->is_valid() )
 core->create_texture(in_text_1)
in_text_1->set_output()

2.) call the methods indirect via the core

core->texture_set_output(in_text_1)

core can do the lacy init work for you and delegates the method call to
the (new) object

core::texture_set_output(in_text_1)
{
  if( in_text_1->in_valid() )
    create_texture(in_text_1)
  in_text_1->set_output()
}

3.) add the core pointer to all texture methods:

in_text_1->set_output(core)

You can then implement the lacy init stuff in the set_output method of
the texture object.


This is just the interface to the module coder.
The implementation in the background can be very different.


>> It can and must initialize them lacy with the first access.

> Objects are always dependend on the core making it possible for them to
> initialize themselves at construction time and free their own resources
> upon destruction. A core object (and therefore a (possibly hidden at
> first) renderwindow) is crucial for all objects using opengl and has to
> be treaded special (which it is anyway since it will get connected to
> gl-modules automatically), meaning: be initialized.

This is not possible with the current 0.4 and 0.5 design. You need to
initialize them lacy. i don't see another clean way to distribute the
core ptr to the gl_*_modules and gl_*_types.

> Seems like we didn't fully agree after all :)

hehe, i only see some minor conflicts.

Martin

_______________________________________________
gephex-devel mailing list
[email protected]
http://lists.gephex.org/mailman/listinfo/gephex-devel
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCqw/4Cm3i57PRsbsRAtWcAKCABVQW8cUjdqHY9V7CejbDdq4YvwCgpWtS
aiwuh8FZepkPa4HLIyoGjQ0=
=zskQ
-----END PGP SIGNATURE-----