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: imageStore

  1. #1
    Intern Contributor
    Join Date
    Oct 2012
    Posts
    52

    imageStore

    Hi

    I have two questions.

    1.When I use imageStore to write to a image3D
    layout (binding=0) uniform image3D myVol;

    imageStore(myVol,TexCoord,vec4(1,0,0,0));

    Here vec3 TexCoord are just coordinates generated by me based on some condition like position in a volume and it is a vector tuple of floating values.


    I get an error saying:
    error C1115: unable to find compatible overloaded function "imageStore(struct image3D,vec3,vec4):

    I noticed that the definition of imageStore goes:
    void imageStore(gimage3D image, ivec3 P, gvec4 data);

    Does ivec3 mean that the coordinates are integers only? And if so, can i never be able to fill in values at intermediate coordinates like (0.3,0.3,0.3)?

    2.I go through a grid and generate some vertices. I compute the texccordinates of the vertices alongside with the logic:
    texcoord.x = vertex position.x/ length of grid in x axis
    texcoord.y = vertex position.y/ length of grid in y axis
    texcoord.z = vertex position.z/ length of grid in z axis

    Is there a better way to compute the texture coordinates than doing it manually?

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    491
    Quote Originally Posted by driver View Post
    I noticed that the definition of imageStore goes:
    void imageStore(gimage3D image, ivec3 P, gvec4 data);

    Does ivec3 mean that the coordinates are integers only? And if so, can i never be able to fill in values at intermediate coordinates like (0.3,0.3,0.3)?
    Yes. Use e.g.
    Code :
        imageStore(myVol,ivec3(TexCoord*imageSize(myVol)),vec4(1,0,0,0))
    to store a value in the cell containing the specified texture coordinates.

    Fractional coordinates are only meaningful for sampling, where you could be using bilinear interpolation and/or mipmaps.

    Quote Originally Posted by driver View Post
    2.I go through a grid and generate some vertices. I compute the texccordinates of the vertices alongside with the logic:
    texcoord.x = vertex position.x/ length of grid in x axis
    texcoord.y = vertex position.y/ length of grid in y axis
    texcoord.z = vertex position.z/ length of grid in z axis

    Is there a better way to compute the texture coordinates than doing it manually?
    Well, there's no need to do it one component at a time; you can just use e.g.
    Code :
    texcoord = position / grid_length;
    where all 3 variables are 3-element vectors.

Tags for this Thread

Posting Permissions

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