Hi

On Mon, 29 Mar 2010 09:29:22 +0200, Roland Peffer wrote:

> I want to use 2 rectangle textures created with
> cogl_texture_new_from_foreign and target GL_TEXTURE_RECTANGLE_ARB in
> an GLSL fragment shader.
> 
> The problem is that if I put the 2nd texture into the texture actors
> material as layer 1, I get the following error message:
>                   g_warning ("Skipping layers 1..n of your material since "
>                                "the first layer doesn't support hardware "
>                                "repeat (e.g. because of waste or use of "
>                                "GL_TEXTURE_RECTANGLE_ARB) and you supplied "
>                                "texture coordinates outside the range [0,1]."
>                                "Falling back to software repeat assuming "
>                                "layer 0 is the most important one keep");
> 
> 
> So layer 1 is redirected to layer 0.  As ar as I understand from the
> cogl source code the support for GL_TEXTURE_RECTANGLE_ARB textures in
> materials is on the TODO list, and that's why the fall back to texture
> 0 is done for now.  But in my case, I don't want to use the
> clutter_texture's standard drawing. Just want to access the 2nd
> textures data for reading in the shader.
> 
> Does anybody have a hint for me how to workaround that for the moment?

Rectangle textures should work with multitexturing provided you don't
require repeating. GL_TEXTURE_RECTANGLE_ARB doesn't support GL_REPEAT
wrap modes so if you try to reneder a repeated texture Cogl will end up
submitting more geometry to compensate, but it can't do this if there
are multiple layers.

Note that although in OpenGL the texture coordinate system for rectangle
textures is (0,image_width], Cogl hides this and still presents the
coordinate system as (0,1]. So if you are passing pixel-based
coordinates to cogl_rectangle_with_texture_coords it will think you are
trying to repeat the texure hundreds of times which is probably why it
is giving you the warning. Of course in the shader it will still end up
with pixel-based coordinates.

Perhaps if you want to pass in pixel-based coordinates as an input to
your shader you could use a separate custom vertex attribute input and
leave the texture coordinates at the default 0->1 ?

Currently the rectangle texture support is just there to support GPUs
that don't have NPOT support. Eventually we would like to add proper
support for rectangle textures and I assume we'd want to expose the
pixel-based texture coordinates in that case.

Hope that helps.

- Neil
-- 
To unsubscribe send a mail to [email protected]

Reply via email to