Opengl,android Considerations Initialization Sequence Nullpointer

Source: Internet
Author: User

BUG:

caused By:java.lang.IllegalStateException:setRenderer have already been called for this instance.

or nullpointer Error


Workaround:

Put Seteglcontextclientversion (2) and move to Setrenderer () front. The comment on the method is written to "If This method is called, it must are called before is setRenderer(Renderer) called.
”。


Expand:

and Setrender () before the method call order, is also fixed. For details, see the code comment as follows:

This method should is called once and only once in the life-cycle of a glsurfaceview.

(These methods are only available in Clsurfaceview and can only be called once)

The following Glsurfaceview methods can only be called before Setrenderer are called:

(Setrender, of course, including seteglcontextclientversion (2))

    • setEGLConfigChooser(boolean)
    • setEGLConfigChooser(EGLConfigChooser)
    • setEGLConfigChooser(int, int, int, int, int, int)

The following Glsurfaceview methods can only are called after Setrenderer are called:

(called after Setrender)

    • getRenderMode()
    • onPause()
    • onResume()
    • queueEvent(Runnable)
    • requestRender()
    • setRenderMode(int)

Opengl,android Considerations Initialization Sequence Nullpointer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.