Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actual__SKYe

Posted 20 February 2013 - 04:50 PM

The



 Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

 

should only be set once at the program initialization, you don't need to set it every frame (also, the background color you get is set by this call, which is black here).

 

Then:



private void Box_Paint(object sender, PaintEventArgs e)
        {
            // set background colour and clear it
            Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
 
            // set up camera
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluOrtho2D(0, 1, 0, 1);
            
            //You have to switch back to the ModelView matrix here after setting the projection matrix
            GL.glMatrixMode(GL_MODELVIEW);
            GL.glLoadIdentity();
            ...

 

 

 

 

You need to switch back to the modelview matrix after setting the projection matrix (ortho/perspective).

 

See if it works.


#1__SKYe

Posted 20 February 2013 - 04:49 PM

The

 Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

 

should only be set once at the program initialization, you don't need to set it every frame (also, the background color you get is set by this call, which is black here).

 

Then:

private void Box_Paint(object sender, PaintEventArgs e)
        {
            // set background colour and clear it
            Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
 
            // set up camera
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluOrtho2D(0, 1, 0, 1);
            
            //You have to switch back to the ModelView matrix here after setting the projection matrix
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();

 

You need to switch back to the modelview matrix after setting the projection matrix (ortho/perspective).

 

See if it works.


PARTNERS