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

  • SEARCH
  • Home
  • 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 9262401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:20:27+00:00 2026-06-18T13:20:27+00:00

Please keep in mind that I am new to android development and I have

  • 0

Please keep in mind that I am new to android development and I have no experience of using OpenGL before.
I followed this lesson:
http://developer.android.com/training/graphics/opengl/environment.html

and my current code is:

OpenGLESTestActivity.java:

package com.KML;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.opengl.*;

import com.KML.MyGLRenderer;

public class OpenGLESTestActivity extends Activity {
    /** Called when the activity is first created. */

    private GLSurfaceView mGLView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLView = new MyGLSurfaceView(this);
        setContentView(mGLView);
    }
}

class MyGLSurfaceView extends GLSurfaceView {


    public MyGLSurfaceView(Context context) {
        super(context);
        setRenderer(new MyGLRenderer());
        this.setEGLContextClientVersion(2);
        this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    }
}

in MyGLRenderer.java:

package com.KML;

import android.opengl.GLES20;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.opengl.GLSurfaceView;


public class MyGLRenderer implements GLSurfaceView.Renderer {

    public void onSurfaceCreated(GL10 unused, EGLConfig config) {
        GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
    }

    public void onDrawFrame(GL10 unused) {
        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
    }

    public void onSurfaceChanged(GL10 unused, int width, int height) {
        GLES20.glViewport(0, 0, width, height);
    }

}

This is giving me “Unfortunately, OpenGLESTest has stopped.” on my android device.

Thanks

  • 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-06-18T13:20:28+00:00Added an answer on June 18, 2026 at 1:20 pm

    OpenGLES on Android – IllegalStateException: setRenderer has already been called for this instance

    public MyGLSurfaceView(Context context) 
    {
        super(context);
        setEGLContextClientVersion(2);
        setRenderer (new MyRenderer());
        setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    }
    

    It’s the order you are setting up everything that is wrong.

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

Sidebar

Related Questions

Please keep in mind that I am VERY new to all of this javascript/node.js
I am new to programming in general so please keep that in mind when
Please keep in mind that I am new to world of .Net and F#.
Note: please keep in mind that this is not a generic question on the
Please keep in mind that I'm rather new to how MVC, Json, jQuery, etc.
Okay, so I'm very new to website design, so please keep that in mind.
Please keep in mind that I'm new to C# and OOP so I apologize
Keep in mind that I am still very new to python coding as I
To keep things simple, please allow the assumption that some code requires the use
I have a new challenge today. I will develop a script that will take

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.