1

I have noticed that if I try to call API calls before surface is created such as

GLES20.glGenTextures(textures.size(), textureHandle,0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[i]);

They don't behave properly, for example texture handler being returned as 0 all the time.

So I put my initiation methods under onSurfaceCreated call.

public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) {
    if(initiated)return;
    BitmapLoader.onOpenglGLInitiated();
    program.init();
    initiated = true;

}

However such results in being recalled whenever surface is recreated; when a user pauses and resumes as well. In which reuslts in double initiation, thus an error. I want to know where exactly should be a better place to put my initiation codes.

1 Answer 1

1

So far what I´ve seen, it´s quite convenient to load textures in onSurfaceCreated

Example 6: Texture (Nehe Lesson 6: Texture)

Which errors do you exactly get?

Sign up to request clarification or add additional context in comments.

1 Comment

It does not return me proper address. GLES20.glGenTextures(textures.size(), textureHandle,0); not returning proper handler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.