Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Arrays of textures

16 views
Skip to first unread message

VelociChicken

unread,
May 9, 2013, 8:49:13 AM5/9/13
to
Hello, I have an array of 8 different cubemaps that I want to accessfrom
within a single fragment shader.

I have a selection declared by the following:

uniform samplerCube RenderCube[8];

And I want toaccess it in the fragment shader with something like:

colour = textureCube(RenderCube[n], normal);

It compiles without error, but how do I decare the sting of eight
cubemaps inthe calling C++ code?

I'm able to do this with an arrary of sequencial (0-7) numbers by using:-

glUniform1iv(GetUniform("RenderCube"), 8, (GLint*)&cubeMapsReferences);
Where GetUniform is my function for grabbing the shader variable uniform
number.

for (int n = 0; n < 8; n++)
{
glActiveTextureARB(GL_TEXTURE0_ARB+n);
...code forbinding each cubemap texture...
}


But it's doesn't seem to work at all, is this the correct way of doing this?
Iknowit's an odd thing to want todo, but it's what I need to do with my
current experiment.
Thanks,
Dave.






VelociChicken

unread,
May 9, 2013, 9:34:17 AM5/9/13
to
Nevermind, it was an error elsewhere....
0 new messages