user969416
user969416

Reputation:

glColor() not declared in this scope

I have the following header file:

#ifndef CLASSES_H
#define CLASSES_H

class Mouse // Handles clicking of the mouse

{

private:



public:

Mouse()
{

    // Constructor

}

void handle_input(int x, int y) // Takes arguments of xloc and yloc of the mouse          pointer
{



}

};

class Game_Grid

{

private:



public:



};

class Red_Jewel // Is a circle shape

{

private:

int offset;

public:

Red_Jewel(int offset)
{

    this -> offset = offset;

}

void draw()
{

    glColor(256,0,0); // Red


}

};

class Green_Jewel // Is a triangle shape

{

private:

int offset;

public:

Green_Jewel(int offset)
{

    this -> offset = offset;

}

void draw()
{

    glColor(0,256,0); // Green

}

};

class Blue_Jewel // Is a square shape

{

private:

int offset;

public:

Blue_Jewel(int offset)
{

    this -> offset = offset;

}

void draw()
{

    glColor(0,0,256); // Blue

}

};

// Define objects here; circle jewel, triangle jewel, square jewel, the game grid

#endif // CLASSES_H

which is being included in a .cpp main file that has the following inclusions:

#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "classes.h" // objects within the game
#include <iostream>

The use of glColor() in the header file is giving me "Was not declared in this scope" error even when I include all of the above headers in the header file. I have never experienced this before and don't know why I am getting the errors.

Thanks for any and all help!

Upvotes: 3

Views: 1586

Answers (1)

Skyler Saleh
Skyler Saleh

Reputation: 3991

The call you are looking for is glColor3ub(255,0,0); not glColor(255,0,0);

Upvotes: 4

Related Questions