0

i'm trying to render a simple square on screen, for some reason sometimes it looks ok. and sometimes it doesn't.

here it looks as i wanted

and here are examples of it looking weird:

not supposed to look like this

also random weirdness

another to demonstrate..

the strange thing is that when i click the recent apps button, the activity's onPause get called, which calls the GlSurfaceView's onPause method.. and when i return to the app it calls onResume as expected. and everytime i go out and in again, the graphic looks different..

i've read another question here that seem to be relevant - Here but according to that, the problem is that when returning to the app, the openGl context was lost and everything needs to be restarted - textures and such.. but in my code i do all that in the onSurfaceCreated method, which is called when the app resumes, i also tried to update the Context variable inside the Renderer class, but still no good results.. any tips/advice?

ariel t
  • 137
  • 1
  • 8
  • 1
    Maybe post your code that issues the draw call. The count you pass to glDrawArrays/glDrawElements should be 4 (for GL_TRIANGLE_STRIP) or 6 (for GL_TRIANGLES), but it looks like it's rendering more triangles than that. – Columbo Feb 13 '18 at 09:42
  • :) you are right... i use GL_TRIANGLES, and passed in the length of the vertex array, only the array contained more information (U.V coordinates etc..) indeed a rookie's mistake – ariel t Feb 13 '18 at 19:29

0 Answers0