NGL
6.5
The NCCA Graphics Library
|
simple texture object using QImage to load and convert to OpenGL texturing, needs loads of work for multi texture support etc as well as different texture types More...
#include <Texture.h>
Public Member Functions | |
Texture ()=default | |
Constructor using no parameters. More... | |
~Texture ()=default | |
destructor More... | |
Texture (const Texture &)=delete | |
make not copyable More... | |
Texture & | operator= (const Texture &)=delete |
Texture (const std::string &_fname) | |
Constructor passing the file to load. More... | |
bool | loadImage (const std::string &_fname) |
method to load the image file into the texture class More... | |
unsigned char * | getPixels () const |
method to access the pixel data pointer More... | |
GLuint | setTextureGL () const noexcept |
set the image as an OpenGL texture object More... | |
void | setMultiTexture (const GLint _id) noexcept |
set the texture object to be different texture in multitexture More... | |
GLuint | getWidth () const noexcept |
Get the width of the texture. More... | |
GLuint | getHeight () const noexcept |
Get the height of the texture. More... | |
GLuint | getFormat () const noexcept |
Get the pixel format. More... | |
const Image & | getImage () const |
Protected Attributes | |
Image | m_image |
the actual image data loaded packed in r,g,b,a format in contiguous memory stored in a smart_pointer for safety More... | |
GLuint | m_width =0 |
the size of the image in the X direction More... | |
GLuint | m_height =0 |
the size of the image in the Y direction More... | |
GLuint | m_channels =3 |
A pointer to the start of the image data. More... | |
GLint | m_multiTextureID =0 |
the MultiTexture ID for the current texture Object More... | |
GLuint | m_format =GL_RGB |
the image format (i.e rgb or rgba) More... | |
simple texture object using QImage to load and convert to OpenGL texturing, needs loads of work for multi texture support etc as well as different texture types
make it more flexible for different types of texture operations
write save method at some stage as well this could grab info from framebuffer and replace the frame writer class
|
default |
Constructor using no parameters.
|
default |
destructor
|
delete |
make not copyable
ngl::Texture::Texture | ( | const std::string & | _fname | ) |
Constructor passing the file to load.
[in] | &_fName | the name of the file to load |
Definition at line 30 of file Texture.cpp.
References ngl::Image::channels(), ngl::Image::format(), ngl::Image::height(), ngl::Image::load(), m_channels, m_format, m_height, m_image, m_multiTextureID, m_width, and ngl::Image::width().
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
bool ngl::Texture::loadImage | ( | const std::string & | _fname | ) |
method to load the image file into the texture class
[in] | _fName | the name of the file to load imageMagick will determine if it can load the file |
Definition at line 41 of file Texture.cpp.
References ngl::Image::channels(), ngl::Image::format(), ngl::Image::height(), ngl::Image::load(), m_channels, m_format, m_height, m_image, m_multiTextureID, m_width, and ngl::Image::width().
set the texture object to be different texture in multitexture
_id | the texture id |
Definition at line 81 of file Texture.cpp.
References m_multiTextureID.
|
noexcept |
set the image as an OpenGL texture object
Definition at line 64 of file Texture.cpp.
References ngl::Image::getPixels(), GL_LINEAR, GL_TEXTURE0, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_UNSIGNED_BYTE, glActiveTexture, glBindTexture(), glGenerateMipmap, glGenTextures(), glTexImage2D(), glTexParameteri(), m_format, m_height, m_image, m_multiTextureID, and m_width.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |