java - GL_INVALID_VALUE from GLUtils.texImage2D -


i'm trying develop small game android using opengles2.0, , have issue stops me achieving compatibility between devices. i'm testing app in 2 devices, xperia z1 , galaxy s2 (as emulator not work opengles2.0). if call glutils.teximage2d load texture bitmap came image of resolution lower or equal 1024x1024 works fine in both devices. using texture of 2048x2048 works on s2, no longer on z1 (it returns gl_invalid_value). loading higher not work in z1, nor in s2. however, checked gl_max_texture_size, , in both devices set 4096. not know wrong, call teximage2d follows:

gles20.glgentextures(1,texture,0); bitmap bmp = bitmapfactory.decoderesource(mcontext.getresources(), r.drawable.test); gles20.glactivetexture(gles20.gl_texture0); gles20.glbindtexture(gles20.gl_texture_2d, texture[0]); gles20.gltexparameteri(gles20.gl_texture_2d, gles20.gl_texture_min_filter, gles20.gl_linear); gles20.gltexparameteri(gles20.gl_texture_2d, gles20.gl_texture_mag_filter, gles20.gl_linear); glutils.teximage2d(gles20.gl_texture_2d, 0, bmp, 0); 

thanks in advance!

ok, i'll answer own question found out wrong. i'm in stages of android development, put textures in drawable folder. android auto scales images depending on dpi of device, , xperia z1 has 441dpi screen, against 217dpi of galaxy s2, resulting in larger factor resize, reaching gl_max_texture_size limit smaller texture when creating bitmap. i'm using drawable-nodpi folder , works, i'll learn more this.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -