pgl
PrimitiveOpenGL3Dprimitivelibrary
All Classes Files Functions Variables
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
pgl::Texture Class Reference

Texture. More...

#include <pgl.h>

Inheritance diagram for pgl::Texture:
Inheritance graph
[legend]

Public Member Functions

 Texture (int width, int height, unsigned char *data, bool interpolate=false)
 Loads texture data from existing RGB array. Data can be discarded afterwards.
 
 Texture (const std::string &file, bool interpolate=true)
 Loads texture from Portable Pixmap (PPM) file.
 
 operator bool () const
 Returns whether texture is valid.
 
void bind () const
 Use this texture as the current OpenGL 2D texture.
 

Public Attributes

int width = 0
 Texture width. Do not modify.
 
int height = 0
 Texture height. Do not modify.
 

Protected Types

typedef std::shared_ptr< GLuint > GLuintPtr
 

Protected Member Functions

void make (int _width, int _height, unsigned char *data, bool interpolate)
 
void eatcomments (std::ifstream &ifs)
 
int readint (std::ifstream &ifs)
 Read integer value from PPM file, ignoring comments and whitespace.
 

Protected Attributes

GLuintPtr texture_ = 0
 OpenGL texture identifier.
 

Detailed Description

Texture.

Loads data into an OpenGL texture. This is a lightweight class that can be copied at will.


The documentation for this class was generated from the following file: