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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:25:44+00:00 2026-05-27T21:25:44+00:00

Im working on an application for android that is using canvas operations to do

  • 0

Im working on an application for android that is using canvas operations to do all the drawing at the moment but Im switching everything over to opengles to gain performance. My only problem is I have no idea how to draw to screen a dynamically changing scene in opengles. I have a few questions so I guess Ill list them.

1.) How do I dynamically add onscreen objects based on a constantly changing list using opengles.

2.) Do I need to pass some kind of list/array/object container to the renderer or the GLSurfaceView itself.

3.) If I want to translate/move the objects according to an updated position how would I update the actual position vector in the container for each object.

  • 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-27T21:25:44+00:00Added an answer on May 27, 2026 at 9:25 pm

    I think you have the right idea already. I would pass your container to the renderer and on each onDrawFrame(GL10) call, iterate through the container and perform the drawing. It might be worth synchronizing over the container as well if you are going to add objects dynamically.

    In terms of moving the objects. I assume that you will have image textures as well as an array of vertices defining a rectangle over which the texture should be drawn. You could, for each object, store the vertices of the rectangle. When ‘moving’ the objects I would probably recommend you simply alter the value of the vertices instead of using translate.

    Perhaps It would be helpful if you provided a bit more information about what sort of things you are trying to draw and when/how you want to add new objects.

    snippet of example code:

    Bubble

    public class Bubble{
        float[] boundingBox;
        int textureNumber;
    
        Bubble(int n){
           textureNumber = n;
           boundingBox[0] = 0; boundingBox[1] = 100; boundingBox[2] = 0;
           boundingBox[3] = 100; boundingBox[4] = 100; boundingBox[5] = 0;
           boundingBox[6] = 0; boundingBox[7] = 0; boundingBox[8] = 0;
           boundingBox[9] = 100; boundingBox[10] = 0; boundingBox[11] = 0;
    }
    

    Renderer

    ArrayList<Bubble> bubbles;
    FloatBuffer bubbleVertexBuffer;
    
    onSurfaceCreated(..){
        ByteBuffer bb = ByteBuffer.allocateDirect(12*4);
        bb.order(ByteOrder.nativeOrder());
        bubbleVertexBuffer = bb.asFloatBuffer();
    }
    
     onDrawFrame(GL10 gl){
    
       gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
       gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
       gl.glColor4f(0.0f, 1.0f, 0.0f,0.0f);
    
                int size = bubbles.size();
                for(int i = 0; i < size; i++){
                    Bubble b = bubbles.get(i);
                    bubbleVertexBuffer.put(b.boundingBox);
                    bubbleVertexBuffer.position(0);
                    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, bubbleVertexBuffer); 
                    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0,4);
                }
            }    
    
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I built an Android application that requires OAuth. All was working well using a
I have an Android application that I've been working on, and it's implemented using
I'm working on an Android application that will send MMS internally without using the
I changed some code on an android application that was working perfectly fine at
I'm new to Android development and working on an Android application that requires the
I'm working on an Android application that has several Activities. In it I have
I am working on an Android application that is required to connect to a
Hi I am working Android application development using titanium studio.I have developed small application.my
I have android application that I need to debug using eclipse. When I right
Hi am working on an android application. And am using a listview in some

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.