Results 1 to 3 of 3

Thread: Display Sphere

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2002
    Posts
    19

    Display Sphere

    1. trying to generate 50 random sphere in random location.

    2. using random # to find coordinates and using glTranslatef() to move.

    the problem is when i am trying to display the next sphere the previous sphere is disappaearing... is there anyway to retain the previous frame into the memory and when the next sphere is drawn update with the previous frame???

    commands used:
    glTranslatef(rand()%50, rand()%30, rand()%10)

    glutSolidSphere(rand()%20, 50, 50)

    i am using double buffering to accomplish the task.

    pls help asap with this problem. to retain r to merge each sphere when trying to draw the next sphere.

    thanx.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Display Sphere

    You should be drawing all the spheres every frame before you swap the buffers.
    Deiussum
    Software Engineer and OpenGL enthusiast

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Display Sphere

    Simple code to draw 50 circles.

    Code :
    int i;
     
    for(i=0; i < 50; i++) Draw Sphere 50 times
      {
      glPushMatrix();
      glTranslatef(rand()%50, rand()%30, rand()%10)
      glutSolidSphere(rand()%20, 50, 50)
      glPopMatrix();
       }
    Originally posted by ajmrm:
    1. trying to generate 50 random sphere in random location.

    2. using random # to find coordinates and using glTranslatef() to move.

    the problem is when i am trying to display the next sphere the previous sphere is disappaearing... is there anyway to retain the previous frame into the memory and when the next sphere is drawn update with the previous frame???

    commands used:
    glTranslatef(rand()%50, rand()%30, rand()%10)

    glutSolidSphere(rand()%20, 50, 50)

    i am using double buffering to accomplish the task.

    pls help asap with this problem. to retain r to merge each sphere when trying to draw the next sphere.

    thanx.

Similar Threads

  1. Replies: 4
    Last Post: 05-23-2012, 10:24 AM
  2. Render a trimmed sphere ? (a quarter of sphere)
    By HaVyThoai in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-07-2007, 12:05 PM
  3. Sphere-sphere collision detection
    By Billy Lee in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-08-2003, 11:03 AM
  4. Remote display NT->Irix for stereo display
    By YvesRubin in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 05-09-2002, 02:29 AM
  5. Sphere with triangular display
    By dream2000 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-08-2002, 08:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean