Android GLES20 link/compile debugging -


i having problems gles shaders failing compile , app crashes "unfortunately, app has stopped.". note not shaders assuming other code load , run shaders ok.

i have tried adding following code app detect , display debug info when compile fails.

gles20.glcompileshader(shader); int[] compiled = new int[1]; gles20.glgetshaderiv(shader, gles20.gl_compile_status, compiled, 0); if (compiled[0] == 0) {     log.e("app", "could not compile shader");     log.e("app", gles20.glgetshaderinfolog(globals.shaderprogram));     log.e("app", "could not compile shader 2"); } 

when running android studio (just updated latest , greatest 1.4 version) logcat shows "could not compile shader" log entry not give me further info makes trying determine why shader fails difficult. gles20.glgetshaderinfolog not return anything. see next "could not complile shader 2" code continues.

because linking fails app crashes when gets gles20.gllinkprogram call. final logcat error "glcreateprogram: glerror 1281"

is there way can more meaningful debug messages when gles links (and compiles) shaders see crashes over? under windows able info compiler , display error line numbers etc when shader failed.

any appreciated.

here fixed code. referring wrong variable.

gles20.glcompileshader(shader); //checkglerror("voc", "glcompileshader"); int[] compiled = new int[1]; gles20.glgetshaderiv(shader, gles20.gl_compile_status, compiled, 0); if (compiled[0] == 0) {     log.e("voc", "could not compile shader");     log.e("voc", gles20.glgetshaderinfolog(shader));     gles20.gldeleteshader(globals.shaderprogram);     shader = 0;     log.e("voc", "could not compile shader 2"); } 

as pointed out reto, once use variable returned glgetshaderiv works , returned error "0(45) : error c7011: implicit cast "float" "vec3". seems gles more picky casting. in windows (or nvidia) accepts

vec3 tex = 1.0; 

but android (at least samsung galaxy note 5) needs

vec3 tex = vec3(1.0,1.0,1.0); 

thanks help! getting line number , error makes easier debug.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -