TextRenderer class for rendering text with OpenGL I'm writing a class called TextRenderer to render text with OpenGL.

Here's my TextRenderer.hpp file

class TextRenderer
{
public:
    void renderText(std::string text, int x, int y);
private:
    void setup();
    GLuint program;
};


Here's my TextRenderer.cpp file:

#include "TextRenderer.hpp"
#include &lt;string&gt;
#include &lt;GL/glew.h&gt;

void TextRenderer::setup()
{

}


Here's my main file:

#include &lt;GL/glew.h&gt;
#include &lt;GLFW/glfw3.h&gt;
#include &lt;ft2build.h&gt;
#include FT_FREETYPE_H
#include "TextRenderer.hpp"

int main()
{
    //Init GLFW
    glfwInit();
    //Set OpenGL version to 3.2
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);

    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    //Make window un-resizable
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    //Create GLFW window in fullscreen mode
    GLFWwindow* window = glfwCreateWindow(800, 600, "MOBA", glfwGetPrimaryMonitor(), nullptr);
    glfwMakeContextCurrent(window);

    //Init FreeType
    FT_Library ft;
    if (FT_Init_FreeType(&amp;ft)) {
        fprintf(stderr, "FATAL: Could not init FreeType");
        return 1;
    }
    //Init Arial FreeType Face
    FT_Face arial;
    if (FT_New_Face(ft, "Arial", 0, &amp;arial))
    {
        fprintf(stderr, "FATAL: Could not init font \"Arial\"");
        return 1;
    }

    //Main loop
    while (!glfwWindowShouldClose(window))
    {
        glfwSwapBuffers(window);
        glfwPollEvents();

        //Close on Esc key press
        //TODO: Bring up quit dialog
        if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
        {
            glfwSetWindowShouldClose(window, GL_TRUE);
        }
    }
    //Terminate GLFW
    glfwTerminate();
    return 0;
}


Notice how I have a private GLuint, program. To do this I have to #include &lt;GL/glew.h&gt; (in TextRenderer.cpp), and I already have GL/glew.h included in my main.cpp file. What's the best way to do this?
Most include files are written so that they are safe to be included multiple times. So, if your TextRenderer.h needs types from glew.h, you include it. Writing your own include files so that they include everything needed to use them (types, enums, ...) is usually a good thing.

You might write your TextRenderer.hpp something like this:

#ifndef TEXTRENDERER_HPP
#define TEXTRENDERER_HPP

#include &lt;GL/glew.h&gt; // For GLuint

class TextRenderer
{
    ...
}
#endif


The define TEXTRENDERER_HPP is there to make the header safe to be included multiple times. You may choose any unique identifier you like, but usually people use file names with some amounts of underscores at start and end.