Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


glsl writes to the other texture?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Yours3!f   Members   -  Reputation: 1417

Like
0Likes
Like

Posted 21 March 2014 - 02:37 PM

hi there,

 

I'm trying to read from one uimage1D and read/write the other uimage1D.

they're declared like this:

layout(location=0, r32ui) readonly uniform uimage1D first;
layout(location=1, r32ui) uniform uimage1D second;

and I'm writing into the second one like this:

void main()
{
  imageStore(second, 0, uvec4(floatBitsToUint(1)) );
}

However what happens is that when I read them back on the cpu side, it turns out that the imageStore actually modifies the READONLY first texture (so it's first element will be 1). I'm puzzled about what happens, I check if I'm binding the correct texture to the correct binding point.
 

glBindImageTexture( 0, first_tex, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R32UI );
glBindImageTexture( 1, second_tex, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI );

also the compiler does give me an error when I'm trying to write the first texture directly.

 

texture creation:

GLuint first_tex = 0;
glGenTextures( 1, &first_tex );
glBindTexture( GL_TEXTURE_1D, first_tex );
//need unsigned int format for atomics
glTexImage1D( GL_TEXTURE_1D, 0, GL_R32UI, 4 * 8, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, 0 );
glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );

GLuint second_tex = 0;
glGenTextures( 1, &second_tex );
glBindTexture( GL_TEXTURE_1D, second_tex );
//need unsigned int format for atomics
glTexImage1D( GL_TEXTURE_1D, 0, GL_R32UI, 4 * 6, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, 0 );
glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );

cpu side readback:

float firstdata[4*8] = {0};
glBindTexture( GL_TEXTURE_1D, first_tex );
glGetTexImage( GL_TEXTURE_1D, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, firstdata );

float seconddata[4*6] = {0};
glBindTexture( GL_TEXTURE_1D, second_tex );
glGetTexImage( GL_TEXTURE_1D, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, seconddata );

any idea what am I doing wrong?

Best regards,

Yours3!f


Edited by Yours3!f, 21 March 2014 - 02:44 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS