Problems Rendering projectiles

Hi everyone

This is my first post on here so please bear with me.

I am making a version of the space invaders game in 2d and I am having problems with the rendering side of things. My problem at the moment is the rendering of the bullets from the player ship. Every time I press the fire button (in this case the space bar) it renders the max number of bullets which i have set to 3 instead of just the one. Also it re-renders these bullets at the player ships position deleting the previous bullets. One more thing it also renders a bullet at a position on the screen without the fire button.

That’s the main problem I am having at the moment.

If it helps here is the part that renders the bullets

glBindTexture(GL_TEXTURE_2D, shipBullet);

    for(int i=0; i<NUM_SHELLS; i++)		
		glTexCoord2d(0,0); glVertex2f(game.Shells[i].getX(), game.Shells[i].getY());
		glTexCoord2d(1,0); glVertex2f(game.Shells[i].getX()+6, game.Shells[i].getY());
		glTexCoord2d(1,1); glVertex2f(game.Shells[i].getX()+6, game.Shells[i].getY()+30);
		glTexCoord2d(0,1); glVertex2f(game.Shells[i].getX(), game.Shells[i].getY()+30);

Here is the function that handles the players fire button:

bool Game::HandleFireMessage()
for(int i=0; i<NUM_SHELLS; i++)

			return true;
return false;


If there is anything you else you need to know I will do my best to answer.

Hope someone can help me, thanks.

Why are you doing


if you are not modifing any matrix?
bullet position are in world space or local (or spaceship) space?
If are in world space the modelViewMatrix is set to camera matrix?
If are in local space where are the glMultMatrix (localBulletMatrix)?
How did you update the bullet position?

I was just playing with statements trying to fix my problem.

To move the bullet position I have a move function that I have created inside a PlayingPiece class and then I created a Ship and Bullet object which I have called Shells. The move function looks like this,

bool PlayingPiece::move(double millieseconds)

return true;


This function is called within another function called makeOneMove() and this handles all the movement and collision detection, I haven’t sorted the collision detection yet. makeOneMove() is called through every step of a while loop that runs until the program has exited.

I’m thinking now that the way I’m updating is wrong, so any help you can give would be appreciated


Sorry but I can’t debug from here and still I don’t have a clear vision of the problem, looks more a game logic problem that a openGl problem.
Isolating the game logic from the problem, if you set the correct game state (harcoding buller and spaceship position) and put the game in pause the rendering is correct?

I see, I will look closer at my logic. Thanks for your time anyway Rosario