C++ getting private var from other class (GLfloat).

I'm trying to make a 3d game.
I just started with opengl in c++ but I ran into a problem.
What I have now.

Creating the array:
std::vector<Bullet*> bulls;
In the display function:
1
2
3
4
5
6
7
8
9
   for (unsigned int i=0; i<bulls.size(); i++)
   {
	glBegin(GL_LINE);
            glColor3f(0.0f,1.0f,0.0f);
            glVertex3f(bulls[i]->Get_prevx,0,bulls[i]->Get_prevz);//this is were it crashes
            glVertex3f(bulls[i]->Get_x,0,bulls[i]->Get_y);
	glEnd();
        bulls[i]->Move_Bullet();
   }

Bullet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <GL/gl.h>		   // Open Graphics Library (OpenGL) header
#include <GL/glut.h>	   // The GL Utility Toolkit (GLUT) Header

#ifndef BULLET_H_INCLUDED
#define BULLET_H_INCLUDED

class Bullet
{
	bool Friendly;
private:
	float bulyrot,speed;
    GLfloat bulx,buly,bulz,prevx,prevy,prevz;
public:
    void Set_Values(float,float,float,float);
	void Move_Bullet ();
	bool Outside_Map();
    GLfloat Get_x ()
    {
        return this->bulx;
    }
    GLfloat Get_y ()
    {
        return buly;
    }
    GLfloat Get_z ()
    {
        return bulz;
    }
    GLfloat Get_prevx ()
    {
        return prevx;
    }
    GLfloat Get_prevy ()
    {
        return prevy;
    }
    GLfloat Get_prevz ()
    {
        return prevz;
    }
};

#endif // BULLET_H_INCLUDED

How I create the bullet.
1
2
3
        Bullet* bullet1=new Bullet();
        bullet1->Set_Values(x,y,z,yrot);
        bulls.push_back(bullet1);

But when I try to compile this it gives an error:

cannot convert ‘Bullet::Get_prevx’ from type ‘GLfloat (Bullet::)() {aka float (Bullet::)()}’ to type ‘GLfloat {aka float}’

Does someone know how to fix this?

Thanks in advance.
Last edited on
I already fixed it myself.
I made the variables public and accessed them with
glVertex3f(bulls[i]->prevx,0,bulls[i]->prevz);
glVertex3f(bulls[i]->bulx,0,bulls[i]->buly);
Topic archived. No new replies allowed.