java - Android problem drawing a bitmap with opengl es -
i'm using https://github.com/markfguerra/glwallpaperservice/ make android live wallpaper. i'm trying load png file fullscreen background, black screen.
i've searched few days still haven't found out problem. i'm doing following:
public void onsurfacecreated(gl10 gl, eglconfig config) { gl.glenable(gl10.gl_texture_2d); gl.gltexparameterf(gl10.gl_texture_2d, gl10.gl_texture_min_filter, gl10.gl_linear); gl.gltexparameterf(gl10.gl_texture_2d, gl10.gl_texture_mag_filter, gl10.gl_linear); }
and every frame:
public void ondrawframe(gl10 gl) { bitmap bitmap = bitmapfactory.decoderesource(context.getresources(), r.drawable.target00074); int[] textures = new int[1]; gl.glgentextures(1, textures, 0); gl.glbindtexture(gl10.gl_texture_2d, textures[0]); glutils.teximage2d(gl10.gl_texture_2d, 0, bitmap, 0); }
i recommend dive opengl basics don't seem know doing. screen black because uploading texture (something should @ initialization instead of every frame) , not drawing anything. need define arrays defining vertex , texture positions start. refer http://blog.jayway.com/2009/12/04/opengl-es-tutorial-for-android-%e2%80%93-part-ii-building-a-polygon/
as fullscreen background, create single polygon texture
Comments
Post a Comment