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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:21:14+00:00 2026-06-04T06:21:14+00:00

I am doing the following to render multiple balls move around the screen but

  • 0

I am doing the following to render multiple balls move around the screen but only 1 ball is seen to appear and function. I don’t know why the rest (count-1) balls are not being drawn

 public void onDrawFrame(GL10 gl) {
            // TODO Auto-generated method stub
            gl.glDisable(GL10.GL_DITHER);
             gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);   
             gl.glMatrixMode(GL10.GL_MODELVIEW);
            gl.glClientActiveTexture(DRAWING_CACHE_QUALITY_HIGH);
             gl.glLoadIdentity();
             for(int i=0;i<mParticleSystem.getParticleCount();i++){
                gl.glPushMatrix();
                      gl.glTranslatef(mParticleSystem.getPosX(i), mParticleSystem.getPosY(i), -3.0f);
                      gl.glScalef(0.3f, 0.3f, 0.3f);
                      gl.glColor4f(r.nextFloat(), r.nextFloat(), r.nextFloat(), 1);
                      gl.glEnable(GL10.GL_TEXTURE_2D);   
                      mParticleSystem.getBall(i).draw(gl);
                gl.glPopMatrix();

             }


        }

EDIT My void draw(GL10 gl) method

    public void draw(GL10 gl){

    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glEnable(GL10.GL_SMOOTH);
    gl.glEnable(GL10.GL_DEPTH_TEST);
//  gl.glTranslatef(0.2f, 0.2f, -3.0f);
//  gl.glScalef(size, size, 1.0f);

    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

 }

I couldnt take the snapshot on my Samsung Phone but here is the emulator screenshot. In reality, the ball moves around with change in orientation and acceleration and keeps changing color randomly (due to r.nextFLoat()) . However, the other 35 balls arent even being rendered as you can see. How can I fix this?

enter image description here

  • 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-04T06:21:15+00:00Added an answer on June 4, 2026 at 6:21 am

    When this is called gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);, the second time the loop comes back should have gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); otherwise nothing else will be drawn.

    I bet you have gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); in you onsurfacecreated(). This means is only called once. While gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); is being called infinitely.

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

Sidebar

Related Questions

I find myself doing the following a lot, and i don't know if there
I'm doing the following in Objective-C and expecting 180 as the output but I'm
Hello in a helper I'm doing the following: render(:template =>feeds/_feed_item.html.erb, :locals => { :feed_item
I'm doing the following to load and render a node via ajax: $node =
I my index lets say I have field field named full_name. I'm doing following
I need help doing the following: a preprocessor macro label(x) shall output #x, e.g.,
I'm currently doing the following as part of my iPhone application NSArray *paths =
I'm doing the following and always get green pins: pin.pinColor = MKPinAnnotationColorRed; [self.mapView addAnnotation:pin];
I am doing the following class RuleObject implements Comparable{ @Override public String toString() {
I'm doing the following: static GLfloat vertices[3][3] = { {0.0, 1.0, 0.0}, {1.0, 0.0,

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.