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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:47:38+00:00 2026-06-07T16:47:38+00:00

I need to draw small circles on a frame and make them to disappear

  • 0

I need to draw small circles on a frame and make them to disappear after few frames (fading out). How can I achieve this with OpenGL ES?

This is what I have so far, the code to draw the circle in a frame:

 [EAGLContext setCurrentContext:context];
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
    glViewport(0, 0, backingWidth, backingHeight);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
    glMatrixMode(GL_MODELVIEW);

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    GLfloat vertices[720];

    for (int i = 0; i < 720; i += 2) {
        vertices[i]   = (cos(DEGREES_TO_RADIANS(i)) * 1);
        vertices[i+1] = (sin(DEGREES_TO_RADIANS(i)) * 1);
    }

    glVertexPointer(2, GL_FLOAT, 0, vertices);
    glEnableClientState(GL_VERTEX_ARRAY);

    glColor4f(1.0f, 1.0f, 0.0f, 1.0f);

    glDrawArrays(GL_TRIANGLE_FAN, 0, 360);

    glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];

What I don’t understand is how to keep track of the same circle and fade it in the successive frames.
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-07T16:47:39+00:00Added an answer on June 7, 2026 at 4:47 pm

    You will need to re-render all objects (circles) on every frame. So you need to keep around a data structure which holds the information about the circles (probably their center, radius, and opacity would be sufficient). Something like this:

    typedef struct Circle {
        NSPoint center;
        float radius;
        float opacity;
    } Circle;
    
    Circle allCircles [ kMaxNumCircles ];
    

    Then, when you go to draw them, you iterate over the array of circles, updating their opacity and then drawing them:

    for (int i = 0; i < kMaxNumCircles; i++)
    {
        allCircles [ i ].opacity -= someDelta;
        drawCircle (allCircles [ i ]);
    }
    

    The drawCircle() function could just be what you’ve written above:

    void drawCircle(Circle c)
    {
        GLfloat vertices[720];
    
        for (int i = 0; i < 720; i += 2) {
            vertices[i]   = (cos(DEGREES_TO_RADIANS(i)) * 1) + c.center.x;
            vertices[i+1] = (sin(DEGREES_TO_RADIANS(i)) * 1) + c.center.y;
        }
    
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glEnableClientState(GL_VERTEX_ARRAY);
    
        glColor4f(1.0f, 1.0f, 0.0f, c.opacity);
    
        glDrawArrays(GL_TRIANGLE_FAN, 0, 360);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a small application in asp.net where user could draw a
I need to draw a rectange,circle and line and then animate them(press left ->
I need to display a large number (500+) of small circles on a form
I work for the small ISP. We need to draw network topology in our
I am developing a small flash application. In my application a user can draw
I need to draw circles in my Android application. Actually it is a Pacman
I'm trying to make a small XNA-based game, and I need to be able
I need to draw vertical and horizontal rectangle / bands (like in Gantt charts)
I need to draw simple alpha maps in xna which depends on current game
I need to draw a chart to show the evolution of data in real

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.