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 2 of 2

Thread: Window refresh problems

  1. #1
    Guest

    Window refresh problems

    Hi - I am using a Radeon 9000 pro with the ATI drivers on my system. I was doing some of the simple examples in Computer Graphics Using Open GL. I have never had this happen before, but whenever I compile and run the program, id does what it is supposed to except that it keeps the underlying background as though a window trancparency were enables (I use enlightenment if that helps). Could somebody point me in a direction? I have no idea what could be causing this. If anyone needs to see my small progrma, here it is:
    Code :
    #include X11/Xlib.h
    #include GL/gl.h
    #include GL/glu.h
    #include GL/glut.h
    #include cstdlib
     
    //carrots removed because message board thinks it is HTML
     
    class GLintPoint{
    public:
            GLint x,y;
    };
     
    int random(int m)
    {
            return rand()%m;
    }
     
    void drawDot(GLint x, GLint y)
    {
            //draw dot at integer point (x,y)
     glBegin(GL_POINTS);
                    glVertex2i(x,y);
            glEnd();
    }
     
    void myInit(void)
    {
            glClearColor(0.0,0.0,0.0,0.0);  //black background color
            glColor3f(1.0f,1.0f,1.0f);      //set drawing color
            glPointSize(2.0);               //dot is 4x4 pixels
            glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluOrtho2D(0.0,640.0,0.0,480.0);
    }
     
    void Sierpinsky(void)
    {
            GLintPoint T[3]={{10,10},{300,30},{200,300}};
     int index = random(3);        //0,1,2 equally likely
            GLintPoint point = T[index];  //initial point
            drawDot(point.x,point.y);     //draw initial point
            for(int i = 0;i < 1000;i++)       //draw 100 dots
            {
                    index = random(3);
                    point.x = (point.x + T[index].x) / 2;
                    point.y = (point.y + T[index].y) / 2;
                    drawDot(point.x,point.y);
            }
            glFlush();
    }
     
    int main(int argc, char** argv)
    {
            glutInit(&amp;argc, argv);                       //initalize toolkit
            glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); //set display mode
     
            glutInitWindowSize(640,480);                 //set window size
            glutInitWindowPosition(100,150);             //set wondow position
            glutCreateWindow("Sierpinski Triangle");     //open the window
            glutDisplayFunc(Sierpinsky);                 //register redraw function
            myInit();
            glutMainLoop();                              //Loop forever and ever
            return(0);
    }
     
    Any help or ideas would be appriciated.  I have no idea where to begin.  Thanks!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    601

    Re: Window refresh problems

    You probably need a glClear( GL_COLOR_BUFFER_BIT ) call at the beginning of your Sierpinsky function. Otherwise it is probably some transparency setting with enlightenment...

Posting Permissions

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