views:

55

answers:

2

im trying to do something here but that error shows up i really have no idea how to get it done right i tried to put all the variables in the Figure.h as GLfloat instead of just float and the same error keeps appearing any idea? here is my Figure.h

Class Figure
{
    public:
        Figure(float x,float y,float z);
        void Parameters(float x,float y,float z);
        void Draw();
        float paramx(){
        return x1;
        }
        float paramy(){
        return y1;
        }
        float paramz(){
        return z1;
        }
    protected:
    private:
    float x1,y1,z1;
    list <Figure> m_vertices;
};

and here is my .cpp the one giving me all the trouble >.<

Figure::Figure(float x,float y,float z){
this->x1=x;
this->y1=y;
this->z1=z;
}
void Figure::Parameters(float x,float y,float z)
{
m_vertices.push_back(Figure(x, y, z));
}
void Figure::Draw()
{
    list<Figure>::iterator p = m_vertices.begin();
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();
    gluLookAt(0.0,0.0,4.0,0.0,0.0,0.0,0.0,1.0,0.0);

    glBegin(GL_TRIANGLES);
    while(p != m_vertices.end()){
        glNormal3f(p->paramx,p->paramy,p->paramz);
        glVertex3f(p->paramx,p->paramy,p->paramz);
        p++;
    }
    glEnd();

}

Supposedly the problem is at glNormal3f and glVertex3f any help would be REALLY appreciated thank you very much

+3  A: 

You need to call the functions:

    glNormal3f(p->paramx(), p->paramy(), p->paramz());
    glVertex3f(p->paramx(), p->paramy(), p->paramz());
GMan
hahaha damn! such a newbie mistake thank you very much haha
Makenshi
@Makenshi: It happens to everybody at some point. :)
GMan
A: 

list<Figure>::iterator p ... so p is an iterator which means you need to access the underlying data like this (*p).paramx(). But that may not be the whole problem. If there's no implicit conversion from float to GLfloat then the compiler will still complain.

[EDIT] I stand corrected. (*p).paramx() is the same as p->paramx()

dgnorton
`p->` is the same as `(*p).`.
GMan
@GMan, I stand corrected...thanks!
dgnorton