Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Accessing array elements

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Aug 2000
    Location
    Haifa, ISRAEL
    Posts
    101

    Accessing array elements

    Is there a way to access an array's element such as:
    int array[10];
    int index = 1;
    int b = array[index];

    The compiler report error of 'indirect access not aloud'.

    How can I bypass this problem?

    Many thanks,

    Yossi

  2. #2
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Santa Clara, CA
    Posts
    85

    Re: Accessing array elements

    Is this in a fragment shader?

    Fragment shaders do not support indexing into constant memory. This is a quirk of the way current hardware works. If you want random access, encode the data in a texture and use a texture lookup.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •