0

I am using JNI and NDK to build an OpenGL project, everything is ok on my phone (galaxy nexus), but i've tried to start this app on several tablet pcs (huawei and acer) and find a strange behaviour:

in my fragment shader there is a value:

    uniform float current;
    ...
    gl_FragColor = (...,current);

in my code i do:

    g_currentAreaLoc = glGetUniformLocation(g_nGLESProgram, "current" );
    ...
    glUseProgram(g_nGLESProgram);
    glUniform1f(g_currentAreaLoc, area);

When i try this code on the phone everything is perfect but on tablets there is no expecting results.

BUT if i hadcode for example 0.0 instead of current - everything is ok on this tablet.

I can't figure out why this variable works on phone and there are troubles on tablets (maybe depends on OS version).

dilix
  • 3,761
  • 3
  • 31
  • 55
  • Do you have proper compile/link error checking? How about glGetError? – Tim Nov 13 '12 at 18:17
  • I'll check it now - but this code works on the phone =( – dilix Nov 13 '12 at 18:19
  • That's pretty much irrelevant. Just cause some piece of code works on one opengl implementation doesn't mean it will work on all. You should always do proper error handling and testing on multiple platforms. – Tim Nov 13 '12 at 18:20
  • Yes you are right, but glGetError always return 0. Maybe some trouble of using variable in shader... – dilix Nov 13 '12 at 18:27
  • I think it happens because shader needs to have float variable as 0.0 (with dot) and when i pass the variable smth strange happens :( – dilix Nov 13 '12 at 19:07
  • even glUniform1f(g_currentAreaLoc, 0.0f); fails, only "current = 0.0" works – dilix Nov 13 '12 at 19:13

0 Answers0