Gl Graph

Gl Graph Source of gltexture.h


#ifndef GL_TEXTURE_H
#define GL_TEXTURE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
 
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
#include <GL/glxext.h>
#include <GL/glut.h>
class GlTexture   {
private:
    unsigned int width;
    unsigned int height;
    unsigned char * data;
    unsigned int imageSize;
    unsigned int pixelsize;
    GLuint textureID;
 
public:
    GlTexture(std::string filename);
    void readPng(std::string filename);
 
    void printGlError(const char *msg);
 
 
    void bind()
    {
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, textureID);
 
    }
 
 
    void unbind()
    {
        glBindTexture(GL_TEXTURE_2D, 0);
        glDisable(GL_TEXTURE_2D);
 
    }
 
};
 
#endif