On Thu, 2009-07-23 at 17:28 +0200, Vladimir Nadvornik wrote:
> On čt 23. července 2009, Robert Bragg wrote:
> >
> > If there is functionality missing in Cogl, I would be more interested in
> > improving Cogl than finding ways to work around it via direct GL calls.
> >
> > Binding 1D and 3D textures is a valid feature request for Cogl, but so
> > far I haven't been able to work through what it would take to expose in
> > a nice and compatible way. If you could come up with a proposal or
> > better still patches :-) for Cogl I think that's the only way we will be
> > able to reliably support your use-case.
> >
>
> I don't know Cogl internals much, but I can try to create something. At the
> first look I think that the best way to add this would be:
> - add 3rd dimension to CoglBitmap
I think we can avoid needing to extend CoglBitmap, instead we would
potentially just give the option to use 2D CoglBitmaps as a source for
defining separate layers of a 3D texture object. Also since, I think,
glTexImage3D essentially expects your 3D layer data to be arranged as if
you have a large 2D texture divided into subregions vertically for the
layers, we could even just have a utility function for loading all
layers from a single, normal 2D CoglBitmap.
> - add new methods to CoglBitmap and CoglTexture that takes 3 dimensions
right, potentially just some new cogl_texture_new_ and cogl_texture_get_
variants for supplying 1d or 3d data.
> - the original methods would assume depth = 1
> - the texture dimension (GL_TEXTURE_3D or GL_TEXTURE_2D) would be determined
> by the method used for creating the CoglTexture instance
yes, that sounds about right.
e.g. counterparts to other cogl_texture_ functions, that might be
necessary: cogl_texture_1d_new_with_length,
cogl_texture_3d_new_with_volume, cogl_texture_{1d,3d}_new_with_data,
cogl_texture_{1d,3d}_set_region, cogl_texture_{1d,3d}_new_from_file,
cogl_texture_{1d,3d}_new_from_foreign,
cogl_texture_{1d,3d}_get_data
Note: although Cogl doesn't have a very formal object model at this
point, I think it would make sense to consider 1d and 3d textures as
subclasses for CoglTexture. Internally even things specific to 2d
textures would also become part of a 2d subclass. (we could possibly
even add cogl_texture_2d_ API and deprecate some of the cogl_texture_
API as appropriate.)
Note: since we are talking about exposing more texture targets; as well
as 1d and 3d textures we may also want to have 'rect' or 'rectangle'
textures to more formally expose GL_TEXTURE_RECTANGLE_ARB, which can be
useful for applying image filters in shaders due to the un-normalized
texture coordinate space. (though, alternatively we could just add some
kind of 2d texture property like cogl_texture_set_normalize_coords (tex,
FALSE), and continue to hide GL_TEXTURE_RECTANGLE_ARB) - anyway this is
a bit offtopic.
if you take a stab at implementing this, please keep me posted, and I'll
try and provide feedback and assistance if I can.
kind regards,
- Robert
--
Robert Bragg, Intel Open Source Technology Center
--
To unsubscribe send a mail to [email protected]