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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:54:37+00:00 2026-06-15T02:54:37+00:00

I’ve seen a similar post about this subject here , however, my question is

  • 0

I’ve seen a similar post about this subject here, however, my question is a little bit different.

I have a 2D plot which will be comprised of circles at varying locations with varying sizes. Currently, my rendering scheme uses a display list to store a pre-drawn circle which can be actively re-sized and translated by the user using glScalef/glTranslatef. However, because I am rendering thousands of circles, the resize and drawing becomes extremely slow. Each circle can have a different radius and color so these things must be done within the loop.

What would be some things I could try to improve the speed of circle rendering when the user changes say the size of the circles? I’ve looked into VBO like the above link says but it was ambiguous to how much of a performance gain I would receive for this type of application where my object is constantly changing in size.

  • 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-15T02:54:38+00:00Added an answer on June 15, 2026 at 2:54 am

    because I am rendering thousands of circles, the resize and drawing becomes extremely slow

    With just vertex arrays this is getting about 60ms per frame on an Intel HD Graphics 3000 with 10,000 circles:

    // g++ -O3 circles.cpp -o circles -lglut -lGL
    #include <GL/glut.h>
    #include <vector>
    #include <iostream>
    #include <cmath>
    using namespace std;
    
    // returns a GL_TRIANGLE_FAN-able buffer containing a unit circle
    vector< float > glCircle( unsigned int subdivs = 20 )
    {
        vector< float > buf;
    
        buf.push_back( 0 );
        buf.push_back( 0 );
        for( unsigned int i = 0; i <= subdivs; ++i )
        {
            float angle = i * ((2.0f * 3.14159f) / subdivs);
            buf.push_back( cos(angle) );
            buf.push_back( sin(angle) );
        }
    
        return buf;
    }
    
    struct Circle
    {
        Circle()
        {
            x = ( rand() % 200 ) - 100;
            y = ( rand() % 200 ) - 100;
            scale = ( rand() % 10 ) + 4;
            r = rand() % 255;
            g = rand() % 255;
            b = rand() % 255;
            a = 1;
        }
    
        float x, y;
        float scale;
        unsigned char r, g, b, a;
    };
    
    vector< Circle > circles;
    vector< float > circleGeom;
    void init()
    {
        srand( 0 );
        for( size_t i = 0; i < 10000; ++i )
            circles.push_back( Circle() );
        circleGeom = glCircle( 100 );
    }
    
    void display()
    {
        int beg = glutGet( GLUT_ELAPSED_TIME );
    
        glClear( GL_COLOR_BUFFER_BIT );
    
        glMatrixMode( GL_PROJECTION );
        glLoadIdentity();
        double w = glutGet( GLUT_WINDOW_WIDTH );
        double h = glutGet( GLUT_WINDOW_HEIGHT );
        double ar = w / h;
        glOrtho( -100 * ar, 100 * ar, -100, 100, -1, 1);
    
        glMatrixMode( GL_MODELVIEW );
        glLoadIdentity();
    
        glEnableClientState( GL_VERTEX_ARRAY );
        glVertexPointer( 2, GL_FLOAT, 0, &circleGeom[0] );
    
        for( size_t i = 0; i < circles.size(); ++i )
        {
            Circle& c = circles[i];
            c.scale = ( rand() % 10 ) + 4;
    
            glPushMatrix();
            glTranslatef( c.x, c.y, 0 );
            glScalef( c.scale, c.scale, 0 );
            glColor3ub( c.r, c.g, c.b );
            glDrawArrays( GL_TRIANGLE_FAN, 0, circleGeom.size() / 2 );
            glPopMatrix();
        }
    
        glDisableClientState( GL_VERTEX_ARRAY );
    
        glutSwapBuffers();
    
        int end = glutGet( GLUT_ELAPSED_TIME );
        double elapsed = (double)( end - beg );
        cout << elapsed << "ms" << endl;
    }
    
    void timer(int extra)
    {
        glutPostRedisplay();
        glutTimerFunc(16, timer, 0);
    }
    
    int main( int argc, char **argv )
    {
        glutInit( &argc, argv );
        glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE );
        glutInitWindowSize( 600, 600 );
        glutCreateWindow( "Circles" );
    
        init();
    
        glutDisplayFunc( display );
        glutTimerFunc(0, timer, 0);
        glutMainLoop();
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.