Wierd opengl coding problem

Oracle

New member
Hey guys i just started a opengl course this semester and all the code i run at uni machines works fine but i wanted to try it at home so i downloaded the virgin code and tried to run it and it ran fine

but

if i run another opengl project the previous graphic will appear along side the new one i.e

prog 1 spiral

close down c++

Start C++

new prog circle

output spiral within a circle (looks good but wrong)

and i cant understand why? below is the circle code

can ne one help?

//////////////////////////////////////////////////////////////////////

#include <windows.h>
#include <math.h>
#include <glut.h>

#define PI 3.1415926535898


void init(void)
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f) ;
glShadeModel(GL_SMOOTH) ; //or GL_FLAT

}


void display(void)
{

int i,c_points = 100;
float angle;

glBegin(GL_LINE_LOOP);
for(i=0; i<c_points; i++){
angle = 2*PI*i/c_points;
glVertex2f(cos(angle), sin(angle));
}
glEnd();

glutSwapBuffers();

}



int main(int argc, char** argv)
{
glutInit (&argc, argv) ;
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB) ;
glutInitWindowSize (500, 500) ;
glutInitWindowPosition (100, 100) ;
glutCreateWindow ("example1") ;

//init() ; //initialise opengl settings
glutDisplayFunc (display) ; //set up call back for display
glutMainLoop () ;


return 0 ;


}
 
Add a glClear(); to the top of your display function.

glClearColor will only set the color the buffer will be cleared to, it won't perform the clear itself.
 
it must be something native to my pc, i mean the code will work on other pc's wothout this problem occouring so i wish i knew what was doing it

stilll it does look rather pretty

hmmmm
 
dont worry guys solved it:)

bascially i just need to disable the dx8 stuff in the hardware troubleshooting section of the advanced settings on my graphics card it sorts the problem rite out

many thanks for all of ur help

Oracle (hoping to be a frequent 3d coders forum browser)
 
Back
Top