c - OpenGL glTexImage2D memory issue -
i'm loading cubemap create skybox, fine , skybox renders correct texture application.
however, decided check program safety valgrind, valgrind gives error: http://pastebin.com/seqmxjyx
the line 53 in sky.c
is:
glteximage2d(gl_texture_cube_map_positive_x + i, 0, gl_rgb, texture.width, texture.height, 0, gl_bgr, gl_unsigned_byte, texture.pixels); protoype: void glteximage2d( glenum target, glint level, glint internalformat, glsizei width, glsizei height, glint border, glenum format, glenum type, const glvoid *pixels )
the texture width , height unsigned int (1024x1024), , pixels have bmp texture format.
it correctly parsed sure (as said before, rendered correctly, opengl returns no error, invalid write of 4 valgrind).
(this invalid write appear every time load texture)
so read man, , made me more confused, it:
gl_invalid_value generated if width or height less 0 or greater 2 + gl_max_texture_size, or if either cannot represented 2^k +2 (border) integer value of k.
glgeterror()
gives me gl_no_error
, when i'm sending 1024*1024 parameters, not (2^k + 2)
i read border
parameter, seems kind of useless opengl use, link overwrite?
finally, said, works properly, know these invalids writes coming from.
the full project: https://github.com/toss-dev/minetoss
which man page quoting? there multiple man pages available, not mapping same opengl version.
anyways, idea behind + 2 (border)
have 2 multiplied value of border
, in case 0. code fine. border
feature not supported latest gl versions , therefore absent more recent man pages.
now, problem. valgrind error coming within geforce gl driver, unless access source, it's unlikely you'll anywhere investigating (you can try contact driver maintainers if want... may have hard time getting answer).
Comments
Post a Comment