Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 843141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:04:39+00:00 2026-05-15T06:04:39+00:00

The GLSurfaceView.Renderer interface of the Android SDK gives me a GL interface as parameter

  • 0

The GLSurfaceView.Renderer interface of the Android SDK gives me a GL interface as parameter which has the type GL10. This interface is implemented by some private internal jni wrapper class. But there is also the class GLES10 where all the GL methods are available as static methods. Is there an important difference between them? So what if I ignore the gl parameter of onDrawFrame and instead use the static methods of GLES10 everywhere?

Here is an example. Instead of doing this:

void onDrawFrame(GL10 gl)
{
    drawSomething(gl);
}

void drawSomething(GL10 gl)
{
    gl.glLoadIdentity();
    ...
}

I could do this:

void onDrawFrame(GL10 gl)
{
    drawSomething();
}

void drawSomething()
{
    GLES10.glLoadIdentity();
    ...
}

The advantage is that I don’t have to pass the GL context to all called methods. But even it it works (And it works, I tried it) I wonder if there are any disadvantages and reasons to NOT do it like that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:04:39+00:00Added an answer on May 15, 2026 at 6:04 am

    I’ve been poking around in the source code trying to answer that very question. As far as I can tell, both ways of invoking the OpenGL implementation go to the same native function call. However, my understanding is that the Java-side access is faster through static methods rather than through virtual method dispatch (see http://developer.android.com/guide/practices/design/performance.html#prefer_static).

    The tradeoff is that you sacrifice a certain amount of type-checking when accessing calls that are only available in later versions of OpenGL. When you access the call through the object, you have to do a cast first, and that cast will fail if the version of GL you’re using doesn’t support the interface. When accessing the call through the static method, I think what will happen is that the OpenGL error state will be set, which can be harder to detect unless you’ve set the debugging mode on the GLSurfaceView.

    For right now I’m accessing everything through the static methods, and I’ll leave debug-mode on in the GLSurfaceView until the code is stable, at which point I’ll turn it off.

    • Kris
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 425k
  • Answers 425k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you're building a CRUD app and you're comfortable with… May 15, 2026 at 12:27 pm
  • Editorial Team
    Editorial Team added an answer Its worthwile to install a enterprise message queue because DRB… May 15, 2026 at 12:27 pm
  • Editorial Team
    Editorial Team added an answer Yes, but don't do it. May 15, 2026 at 12:27 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.