Opengl Bullets not showing.

closed account (2NywAqkS)
I have done various tests so I know the bullets are there but its just not drawing.
This is the function that actually draws it:
1
2
3
4
5
6
7
void Bullet::Draw_Bullet ()
{
	glBegin(GL_LINE);
    glVertex2d(x,y);
	glVertex2d(prevy,prevy);
	glEnd();
}

This is the Bullet class:
1
2
3
4
5
6
7
8
9
10
11
class Bullet
{
	bool Friendly;
private:
	double x,y,prevx,prevy,speed,direction;
public:
	void Move_Bullet ();
	void Draw_Bullet ();
	bool Outside_Map();
	Bullet(double,double,double,double);
};

This moves the bullet:
1
2
3
4
5
6
7
void Bullet::Move_Bullet ()
{
	prevx = x;
	prevy = y;
	x += cos(direction) * speed;
	y += sin(direction) * speed;
}

This is the reshape function:
1
2
3
4
5
6
7
8
9
void reshape()
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
	glOrtho(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}


I have been trying to work out what's wrong with it all day and its probably some small detail I didn't pick up on but any help is much appreciated. If needed please ask for more code or/and any other questions
Thanks
Are there other objects in your game that get rendered correctly? It may be an issue with how your updating the window bitmap. glVertex2d(prevy,prevy); That line may also be the issue, your using prevy for both coords.
closed account (2NywAqkS)
The other object

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
	GLuint texture;

	texture = LoadTextureRAW( filename, TRUE, filew, fileh);

	glEnable( GL_TEXTURE_2D );
	glBindTexture( GL_TEXTURE_2D, texture );

	float X = size/2;
	float O = -size/2;
	glBegin(GL_QUADS);
      glTexCoord2d(0.0,0.0); glVertex2d(O,O);
      glTexCoord2d(1.0,0.0); glVertex2d(X,O);
      glTexCoord2d(1.0,1.0); glVertex2d(X,X);
      glTexCoord2d(0.0,1.0); glVertex2d(O,X);
	glEnd();


Renders fine. And yes the double prevy was a mistake but correcting that didn't help
Topic archived. No new replies allowed.