Sometimes objects don't draw

Why would the following code only draw some of the objects some of the time? I may run the program and everything draws. Then I may run the program again and everything draws the first frame, then only the first object get’s drawn after that.

All objects are in a curcular linked list. FocalPoint points to the first object in the list. Relvec give the vector relative to FocalPoint’s Location, CentreX and CentreY gives the projection’s centre. Size = 3.5. I’ve counted how many times each object is drawn using DrawCount and it matches how many frames are drawn.

glLoadIdentity(); // Clear matrix.

// Clear colour and double buffer.
glTranslated(CentreX, CentreY, -1);
// Translate to screen’s centre.
ogsObject *tObject = Game->Objects->Next;
// Create pointer to object.
glColor3f(0.8f, 0.8f, 0.4f);// Set object colour.
while (tObject != Game->Objects) {
// For each object in game.
if (tObject->IsSet(ogsVISIBLEFLAG)) {
// If object is visible.
glPushMatrix(); // Save current matrix.
tVec = FocalPoint->RelVec(tObject->Loc);
// Get position of object relative to focal point.
glTranslated(tVec.x, tVec.y, 0);
// Translate to object’s relative position.
glRotated(tObject->Dir, 0, 0, -1);
// Rotate to direction object faces.
// Draw triangle.

  		// (TODO) remove diagnostic output.

  		glVertex2d(0, tObject->Size);
  		glVertex2d(-tObject->Size * 0.7, -tObject->Size * 0.7);
  		glVertex2d(tObject->Size * 0.7, -tObject->Size * 0.7);
  	glPopMatrix();		// Restore current matrix.
  tObject = tObject->Next;// Move to next object.


[EDIT] Deleted previous message.

I changed my code format to match NeHe’s tutorial 1 and plugged in the drawing code. The problem still persists. It draws sometimes when run, and sometimes the correct look may flash on the screen then the following frames only draws the object focussed on.

Does anyone have an idea of what could be causing this?

[This message has been edited by Furrage (edited 03-19-2002).]

Pervious edit didn’t change its postion.

Problem solved. The objects move based on the time interval since the last frame. However, I did not initialise the time at program start, so when I multiplied speed by elapsed time the points jumped way off screen. Hence the difference between frame 1 and 2.