Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Most effecient way to draw a sphere

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    Corydon,IA,USA
    Posts
    2

    Most effecient way to draw a sphere

    Sorry if this seems like a stupid question, but my boss wants me to ask. I am trying to draw as many spheres as possible at one time. Currently using gluSphere(*,3,2), I can display about 300,000 spheres (RAM 1GB). If I use glVertex3d and GL_POINT_SMOOTH, they look spherical and I can get about 3,000,000, but they don't function correctly when I zoom in on them (they get smaller).
    Are there any functions, settings, etc. that I am missing that would allow me to draw more (properly functioning) spheres in a windows openGL view?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jan 2004
    Location
    Los Angeles, CA, USA
    Posts
    216

    Re: Most effecient way to draw a sphere

    If you are drawing points, it's not a surprise that that they don't behave like spheres.

    Why do you need to draw so many (tiny) spheres? Is this a particle system?

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    Corydon,IA,USA
    Posts
    2

    Re: Most effecient way to draw a sphere

    Originally posted by endash:
    If you are drawing points, it's not a surprise that that they don't behave like spheres.
    Why do you need to draw so many (tiny) spheres? Is this a particle system?
    I understand that points won't work. We are trying to visualize the sampling of a 3D space and want to "show" the millions of sampling positions as spheres in that 3D space. gluSphere seems to require so much memory that on a 1GB RAM machine the view fails with around 300,000 spheres using the minimal gluSphere(3,2), and at around 100,000 spheres using gluSphere(6,4). Just wanted to make sure there wasn't an option or alternative that I was missing.
    Thanks
    Les

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: Most effecient way to draw a sphere

    Why create 300000 spheres when you can create 1 and render it as many times as you want.
    Use display lists or VBO.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2004
    Location
    Ukraine
    Posts
    15

    Re: Most effecient way to draw a sphere

    If your driver allows you can use GL_ARB_point_parameters extension (see OpenGL Extensions Registry for description). It was specially disigned for this kind of application.

  6. #6
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Huntsville, AL. USA
    Posts
    319

    Re: Most effecient way to draw a sphere

    Or ... just a simple billboarded quad with a sphere texture on it (e.g. particle system).
    Obsessive - A word used by the lazy to describe the motivated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •