Results 1 to 2 of 2

Thread: Uniform blocks and offsets

  1. #1
    Newbie Newbie
    Join Date
    Jul 2015
    Posts
    1

    Question Uniform blocks and offsets

    Question: when querying a uniforms in a block (shared layout), is the offset of each uniform always in the order they are declared in the shader, or is this not guaranteed?
    Hope that makes sense. Been learning GL for a while, first time poster.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,678
    Quote Originally Posted by wizardbox View Post
    Question: when querying a uniforms in a block (shared layout), is the offset of each uniform always in the order they are declared in the shader, or is this not guaranteed?
    Hope that makes sense. Been learning GL for a while, first time poster.
    The `shared` layout guarantees nothing about the layout except that, if you define a uniform block with the same members in the same order (including their names), then the two blocks will have identical layouts. If you need a more consistent layout, use `std140`.

Similar Threads

  1. Uniform Blocks and Uniform Buffers only?
    By Septimra in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 07-08-2015, 07:32 AM
  2. Uniform blocks
    By teravilp in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-27-2012, 02:15 PM
  3. Problem with uniform blocks
    By giucam in forum OpenGL: GLSL
    Replies: 10
    Last Post: 06-29-2012, 04:49 AM
  4. Uniform blocks
    By lexez in forum OpenGL: GLSL
    Replies: 0
    Last Post: 09-11-2010, 02:54 AM
  5. Multiple uniform blocks (is it possible?)
    By BrianDFS in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 05-16-2010, 06:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean