#include <Texture.h>
Collaboration diagram for pge::Texture:
Public Member Functions | |
Texture (Image *image, const std::string &name) | |
Constructor. | |
~Texture (void) | |
Destructor. | |
GLuint | getDescriptor (void) |
std::string | getName (void) |
void | setName (const std::string &name) |
void | createTexture2D (bool mipmap, GLuint minFilter, GLuint magFilter, GLuint wrapS, GLuint wrapT) |
void | bind (void) |
void | setAlphaBlending (bool alphaEnabled) |
bool | hasAlphaBlending (void) |
int | getWidth (void) |
int | getHeight (void) |
Private Attributes | |
std::string | m_name |
GLuint | m_descriptor |
int | m_width |
int | m_height |
Image * | m_image |
bool | m_alphaBlending |
|
Constructor.
Definition at line 18 of file Texture.cpp. References pge::Image::getHeight(), pge::Image::getWidth(), m_alphaBlending, m_descriptor, m_height, m_image, m_name, and m_width.
00018 { 00019 m_name = name; 00020 m_descriptor = 0; 00021 m_width = image->getWidth(); 00022 m_height = image->getHeight(); 00023 m_image = image; 00024 m_alphaBlending = false; 00025 } |
Here is the call graph for this function:
|
Destructor.
Definition at line 49 of file Texture.cpp. References m_descriptor, and m_image.
|
|
Definition at line 125 of file Texture.cpp. References m_descriptor.
00125 { 00126 glBindTexture(GL_TEXTURE_2D, m_descriptor); 00127 } |
|
Definition at line 93 of file Texture.cpp. References pge::Image::getImage(), pge::Image::getType(), m_descriptor, m_height, m_image, and m_width. Referenced by pge::TextureFactory::createTexture2D().
00093 { 00094 glGenTextures(1, &m_descriptor); 00095 glBindTexture(GL_TEXTURE_2D, m_descriptor); 00096 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS); 00097 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT); 00098 00099 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); 00100 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); 00101 00102 if(m_image->getType() == Image::RGBA) { 00103 if(!mipmap) { 00104 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_image->getImage()); 00105 } else { 00106 gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_image->getImage()); 00107 } 00108 } else if(m_image->getType() == Image::RGB) { 00109 if(!mipmap) { 00110 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, m_image->getImage()); 00111 } else { 00112 gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, m_width, m_height, GL_RGB, GL_UNSIGNED_BYTE, m_image->getImage()); 00113 } 00114 } else { 00115 // TODO: Error message 00116 } 00117 } |
Here is the call graph for this function:
|
Definition at line 63 of file Texture.cpp. References m_descriptor. Referenced by pge::GPUWater::render(), pge::GPUFire::render(), and pge::renderer::setTexture().
00063 { 00064 return m_descriptor; 00065 } |
|
Definition at line 66 of file Texture.h. References m_height.
00066 { 00067 return this->m_height; 00068 } |
|
Definition at line 73 of file Texture.cpp. References m_name. Referenced by pge::TextureDatabase::containsTexture(), and pge::TextureDatabase::getTextureByName().
00073 { 00074 return m_name; 00075 } |
|
Definition at line 62 of file Texture.h. References m_width.
00062 { 00063 return this->m_width; 00064 } |
|
Definition at line 58 of file Texture.h. References m_alphaBlending. Referenced by pge::Sprite::render(), pge::Mesh::renderImmediate(), and pge::SingleTexturedMesh::renderVBO().
00058 { 00059 return m_alphaBlending; 00060 } |
|
Definition at line 54 of file Texture.h. References m_alphaBlending. Referenced by pge::TextureFactory::createTexture2D().
00054 { 00055 m_alphaBlending = alphaEnabled; 00056 } |
|
Definition at line 83 of file Texture.cpp. References m_name.
00083 { 00084 m_name = name; 00085 } |
|
Definition at line 82 of file Texture.h. Referenced by hasAlphaBlending(), setAlphaBlending(), and Texture(). |
|
Definition at line 78 of file Texture.h. Referenced by bind(), createTexture2D(), getDescriptor(), Texture(), and ~Texture(). |
|
Definition at line 80 of file Texture.h. Referenced by createTexture2D(), getHeight(), and Texture(). |
|
Definition at line 81 of file Texture.h. Referenced by createTexture2D(), Texture(), and ~Texture(). |
|
|
|
Definition at line 79 of file Texture.h. Referenced by createTexture2D(), getWidth(), and Texture(). |