small medium large xlarge

04 May 2016, 05:25
Sanil Khurana (1 post)

I just started this book. I have a good amount of experience with Java and also created a couple of games with Android(without any engine) . Anyway, I got this book and I am stuck in the first chapter. there is no post like this anywhere else so I’m probably making a very beginner mistake. anyway when I am coding FirstOpenGLProjectRenderer class, typing glViewport, glClear etc. i get error saying cannot resolve method. I am coding in Android studio instead of Eclipse. I resolved this by changing it to gl.glViewport(int,int,int,int); and did the same to other method calls as well. This worked perfectly well but I have a feeling that changing code could become a problem, especially when solutions are not as obvious as this one. I am continuing at the moment but can anyone please explain why did this happen ? Am I missing to extend something ?

06 May 2016, 22:28
Kevin Brothaler (47 posts)

Hi Sanil,

It sounds like you’re missing the static imports! You can either prefix all the method calls with GLES20, or type “import static android.opengl.GLES20.*;” to the top of the file and then all the symbols should resolve.

You must be logged in to comment