• Create Account

Need scary sound effects or creepy audio loops for your next horror-themed game? Check out Highscore Vol.3 - The Horror Edition in our marketplace. 50 sounds and 10 loops for only \$9.99!

### #Actualmhagain

Posted 14 February 2012 - 04:15 PM

@Yours3!f - glMapBuffer doesn't work that way. I strongly suggest that you read the documentation for it. The "fix" you gave will actually crash the program (if you're lucky).
@MarkS - the code does make sense. That's the way glMapBuffer works, and it's correct and in accordance with the documentation (aside from an extra unnecessary glBindBuffer which shouldn't be a cause of the observed leak).

@OP: have you tried this using glBufferSubData instead of glMapBuffer? It would be interesting to know if the same symptoms are observed with that. The following should be equivalent:
void mapAndCopyToBuffer(char* img1)
{
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pixelbufferHandle);
glBufferSubData (GL_PIXEL_UNPACK_BUFFER_ARB, 0, w * h * s, img1);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
}

Oh - and make sure that the value of s is 4. ;)

### #3mhagain

Posted 14 February 2012 - 12:59 PM

@Yours3!f - glMapBuffer doesn't work that way. I strongly suggest that you read the documentation for it. The "fix" you gave will actually crash the program (if you're lucky).
@MarkS - the code does make sense. That's the way glMapBuffer works, and it's correct (aside from an extra unnecessary glBindBuffer which shouldn't be a cause of the observed leak) in accordance with the documentation.

@OP: have you tried this using glBufferSubData instead of glMapBuffer? It would be interesting to know if the same symptoms are observed with that. The following should be equivalent:
void mapAndCopyToBuffer(char* img1)
{
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pixelbufferHandle);
glBufferSubData (GL_PIXEL_UNPACK_BUFFER_ARB, 0, w * h * s, img1);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
}

Oh - and make sure that the value of s is 4. ;)

### #2mhagain

Posted 14 February 2012 - 12:58 PM

@Yours3!f - glMapBuffer doesn't work that way. I strongly suggest that you read the documentation for it. The "fix" you gave will actually crash the program (if you're lucky).
@MarkS - the code does make sense. That's the way glMapBuffer works, and it's correct (aside from an extra unnecessary glBindBuffer which shouldn't be a cause of the observed leak) in accordance with the documentation.

@OP: have you tried this using glBufferSubData instead of glMapBuffer? It would be interesting to know if the same symptoms are observed with that. The following should be equivalent:
void mapAndCopyToBuffer(char* img1)
{
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pixelbufferHandle);
glBufferSubData (GL_PIXEL_UNPACK_BUFFER_ARB, 0, w * h * s, img1);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
}

### #1mhagain

Posted 14 February 2012 - 12:53 PM

@Yours3!f - glMapBuffer doesn't work that way. I strongly suggest that you read the documentation for it. The "fix" you gave will actually crash the program (if you're lucky).

@OP: have you tried this using glBufferSubData instead of glMapBuffer? It would be interesting to know if the same symptoms are observed with that.

PARTNERS