Hello Alex,
thanks for your answer. It made me to not try any more to do what I
was trying. Instead I now bypassed the problem with such construction:
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
void main()
{
vec2 texCoord = gl_TexCoord[0].xy;
vec4 tex[3];
tex[0] = texture2D(texture0, texCoord);
tex[1] = texture2D(texture1, texCoord);
tex[2] = texture2D(texture2, texCoord);
//Multiply color by texture
gl_FragColor = tex[0] + tex[1];
}
This way I can use the array for computations that are done in a for-
loop.
There is now some other concern.
I'm using QuartzComposer to develop a GLSL shader to use in another
environment.
There I need to do computations with Color and Depth Buffers.
I already solved it to have those as textures by using FBOs.
My concern is now that I don't know how a GLSL Shader reacts on this
mixed textures.
The colorbuffer is a GL_RGBA using GL_UNSIGNED_BYTE while the
depthbuffer is a GL_DEPTH_COMPONENT using GL_FLOAT.
(a 4 component image consisting of bytes and a 1 component image
consisting of floats)
This is something I don't know how to reproduce in QuartzComposer.
Any idea whether this is going to work ?
Regards,
Michael
Am 23.08.2008 um 17:42 schrieb Alex Drinkwater:
Hiya!
On 23 Aug 2008, at 15:40, Michael Kwasnicki wrote:
Hi,
I was playing around with the CoreImage Kernel Language for a long
time and want to make a step forward.
But here I've got some starting problems. What I would like is to
attach some textures and do various computations in a for-loop.
Unfortunately the GLSL Patch in QuartzComposer does not seem to
like my texture arrays.
As long as I am only using one texture from that array (e.g..
texture[0]) I am able to connect an image to that texture.
As soon as I add something which uses a second texture from the
same array (e.g.. texture[1]) all the inputs vanish from the patch.
I also tried to use "OpenGL Shader Builder.app" instead but there
I've got the problem that I don't know how to bind the textures.
Instead of all the textures I provided I get only TEXTURE0 no
matter what index of the texture array I use.
VertexShader:
void main()
{
//Transform vertex by modelview and projection matrices
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
//Forward current color and texture coordinates after applying
texture matrix
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
FragmentShader:
uniform sampler2D texture[2];
void main()
{
vec2 texCoord = gl_TexCoord[0].xy;
//Multiply color by texture
gl_FragColor = texture2D(texture[0], texCoord) +
texture2D(texture[1], texCoord);
I may be wrong, but I think you have to explicitly declare 2
separate texture2D uniforms ie
uniform sampler2D texture0;
uniform sampler2D texture1;
or in a shorter form
uniform sampler2D texture0, texture1;
should work fine.
GLSL is funny about arrays generally, but in the QC implementation,
only certain variable types show up as input ports anyway (vecs,
floats bools, indices and sampler2Ds are the only uniform variable
types that will show up as input ports for a QC GLSL Shader patch,
as far as I know).
Hope this helps, and good luck,
a|x
http://machinesdontcare,wordpress.com
}
Thanks in advance,
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected]
)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/the_voder%40yahoo.co.uk
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]