Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
[Shader:setConstant] Cannot push lua table with >256 floats into array — Gideros Forum

[Shader:setConstant] Cannot push lua table with >256 floats into array

n1cken1cke Maintainer
edited September 2015 in General questions
Hello.
I want create "canvas" for simple paint app. Since there is no direct access to texture I m trying to use primitive shader. I push table with setConstant, but it works only if floats number is less or equal 256. For vec4 this number is 64 and for matricies 4x4 this number is 16. Array elements in the shader simply init to 0 in this case like they was not pushed from the table at all.
How to remove this restriction?

Comments

  • hgy29hgy29 Maintainer
    Accepted Answer
    As far as I know, we didn't set any restriction on constant array length, but your GPU might! Constants shouldn't be used the way you try to use them, you should rather set up a texture and let your fragment/pixel shader lookup the texture

    Likes: n1cke

    +1 -1 (+1 / -0 )Share on Facebook
  • n1cken1cke Maintainer
    I concede, I cannot emulate renderToTexture feature fast enough:) Anyway mobile glsl doesn't support arrays in current version so I think there is no point to create another paint only for PC or Mac.
  • hgy29hgy29 Maintainer
    Accepted Answer
    A discussion about array length limitations can be found here: https://www.opengl.org/discussion_boards/showthread.php/166170-Max-uniform-matrix-array-size
    It looks like GL specs requires GPU to support at least 128 vec4.

    But maybe I misunderstood what you want to do, because I don't see why you couldn't do a paint program with gideros: you can render to texture (rendertarget), create shaders which use multiple input textures (see NormalMapping), so you can do almost anything you want.

    Your canvas will be a RenderTarget texture, you can paint on it using the draw() method from lua, and you can display it by attaching it to a Bitmap...

    Likes: n1cke

    +1 -1 (+1 / -0 )Share on Facebook
  • n1cken1cke Maintainer
    hgy29, thank you very much! RenderTarget is exactly that I need. I overlooked that feature and tried to simulate it by rgba-table and shader:)
Sign In or Register to comment.