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 8165861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:40:03+00:00 2026-06-06T19:40:03+00:00

I have looked through the solutions and haven’t really found one. I am getting

  • 0

I have looked through the solutions and haven’t really found one. I am getting this error because it seems like the execution happens outside of the gl thread. However I am not sure how to fix this. The code is as follows:

public shape()
{
    super();        



    vertexShader = Shader.loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode); //<============
    fragmentShader = Shader.loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);      

    ByteBuffer buffer = ByteBuffer.allocateDirect(getCoordinates().length * 4);
    buffer.order(ByteOrder.nativeOrder());
    vertexBuffer = buffer.asFloatBuffer();

    vertexBuffer.put(getCoordinates());
    vertexBuffer.position(0);

    ByteBuffer drawListBuffer = ByteBuffer.allocateDirect(getOrderOfDraw().length * 2);

    drawListBuffer.order(ByteOrder.nativeOrder());

    listBuffer = drawListBuffer.asShortBuffer();
    listBuffer.put(getOrderOfDraw());

    listBuffer.position(0);


     mProgram = GLES20.glCreateProgram();             // create empty OpenGL Program
     GLES20.glAttachShader(mProgram, vertexShader);   // add the vertex shader to program
     GLES20.glAttachShader(mProgram, fragmentShader); // add the fragment shader to program
     GLES20.glLinkProgram(mProgram); 

}

and the calling renderer is

    Square square = new Square(5, 5);

public void onDrawFrame(GL10 unused) 
{

    unused.glLoadIdentity();
    unused.glClear(GLES20.GL_COLOR_BUFFER_BIT);
    square.Draw();
}

Square extends from shape

  • 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-06T19:40:06+00:00Added an answer on June 6, 2026 at 7:40 pm

    If that new Square(5,5); is not part of any of the opengl callbacks (I assume you’re using a glSurfaceView), then I don’t think it runs on the OpenGL thread. It will be executed when your glSurfaceView is created, which I believe is on the main android thread.

    Try moving new Square(5,5); inside of onSurfaceCreated.

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

Sidebar

Related Questions

I've looked through several posts but I haven't quite found any answers that have
I have looked through the solutions on stackoverflow and none of them seem to
Ok.. I have looked through this site and just can't seem to find the
I have looked through these forums to find a solution to this problem, and
I have googled this, searched this, looked through SO and other sites (I've been
This may be an easy one. I looked through previous questions (and other places
I have found several topics with this title, but none of their solutions worked
I have looked through all of the other solutions and none of them are
I have looked through many similar questions and tried the solutions with no success.
I seem to have looked through many solution on here and the web and

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.