Original Post
Hi guys,
Ive been trying to find this problem that I'm seeing with a program that I've been working on for a while now. I'm not sure what I am doing wrong with this so please bare with me. Basically in my main program I have a set of geometries in display lists that I call at given positions in the scene, this works fine for a while but after a certain amount of time the scene goes blank (black screen) with only a single pixel lit.
I got hold of one of nehe's tutorial codes to see if it was my compiler or opengl that had issues but they are fine, so I decided to paste my display code into one of those tutorial codes only replacing the display lists for GL_Points and then a simple for loop to draw a small block on the screen. After about 13-14 minutes of runtime it completely disappears apart from what seems to be a random lit pixel.
Here is the code from the simplified display function, i literally pasted this into one of nehe's (i used tut 25) in place of the original function to reproduce the error.
Sorry if the code is a bit scrappy, I rushed it when I did that as a test. I'm at a total loss about this, been trying on and off for 3 weeks to fix it so any help would be greatly appreciated.
Ive been trying to find this problem that I'm seeing with a program that I've been working on for a while now. I'm not sure what I am doing wrong with this so please bare with me. Basically in my main program I have a set of geometries in display lists that I call at given positions in the scene, this works fine for a while but after a certain amount of time the scene goes blank (black screen) with only a single pixel lit.
I got hold of one of nehe's tutorial codes to see if it was my compiler or opengl that had issues but they are fine, so I decided to paste my display code into one of those tutorial codes only replacing the display lists for GL_Points and then a simple for loop to draw a small block on the screen. After about 13-14 minutes of runtime it completely disappears apart from what seems to be a random lit pixel.
Here is the code from the simplified display function, i literally pasted this into one of nehe's (i used tut 25) in place of the original function to reproduce the error.
void DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(cx,cy,cz); glRotatef(xrot,1,0,0); glRotatef(yrot,0,1,0); glRotatef(zrot,0,0,1); // Problem with this i think GLfloat offsetx=0.0f,offsety=0.0f,offsetz=0.0f; GLfloat tx,ty,tz; int i,j; for(i=0;i<101;i++){ for(j=0;j<101;j++){ tx=float(i),tz=float(j),ty=1.0f; glTranslatef((tx-offsetx)*0.00905f,(tz-offsetz)*0.01590f,(ty-offsety)*0.00760f); glBegin(GL_POINTS); glColor3f(1.0f,1.0f,1.0f); glVertex3f(0.0f, 0.0f, 0.0f); glEnd(); glTranslatef((-tx+offsetx)*0.00905f,(-tz+offsetz)*0.01590f,(-ty+offsety)*0.00760f); }} //end problem area}Sorry if the code is a bit scrappy, I rushed it when I did that as a test. I'm at a total loss about this, been trying on and off for 3 weeks to fix it so any help would be greatly appreciated.