OpenGL Texture 2D arrays and mipmapping -
i trying understand how mipmap texture arrays .from understand,texture array 3 dimensional structure each texture 2d has depth param in gltexstorage3d sets given texture position in array.but how specify number of mipmaps per texture?can specify different number of mipmaps per texture?
is right way it?
gltexstorage3d(gl_texture_2d_array,10,gl_rgba8,width,height,numtextures); gltexparameteri(gl_texture_2d_array,gl_texture_min_filter,gl_linear_mipmap_linear); gltexparameteri(gl_texture_2d_array,gl_texture_mag_filter,gl_linear); gltexparameteri(gl_texture_2d_array,gl_texture_wrap_s,gl_clamp_to_edge); gltexparameteri(gl_texture_2d_array,gl_texture_wrap_t,gl_clamp_to_edge); for(int =0 ; <numtextures;++i){ gltexsubimage3d(gl_texture_2d_array,/*what goes here???*/, 0, 0, 0, width, height, /*what goes here?*/, gl_rgba, gl_unsigned_byte, data); } glgeneratemipmap(gl_texture_2d_array);
i don't know pass second , 8 parameters of gltexsubimage3d. should second param number of mipmaps , 8th - depth of current texture?
the second param mipmap level of texture want load. in case, since want rely on gl generate mipmaps, it's 0.
the eighth parameter depth. in case of arrays, means number of layers you're passing. you, it's 1, since you're passing single layer per iteration of loop.
the 5th parameter, however, offset in depth of want store data you're passing in. in case, it's layer you're loading i
.
Comments
Post a Comment