stuff
This commit is contained in:
parent
5ff134abe4
commit
be5e710521
2 changed files with 11 additions and 5 deletions
|
|
@ -29,7 +29,8 @@ namespace fishbone {
|
|||
}
|
||||
~Texture();
|
||||
|
||||
void use();
|
||||
void begin();
|
||||
void end();
|
||||
};
|
||||
|
||||
class Mesh {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,16 @@ fishbone::Texture::~Texture() {
|
|||
delete this->impl;
|
||||
}
|
||||
|
||||
void fishbone::Texture::use() {
|
||||
void fishbone::Texture::begin() {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, this->impl->texture);
|
||||
}
|
||||
|
||||
void fishbone::Texture::end() {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
struct fishbone::Mesh::Impl {
|
||||
GLuint v_vbo;
|
||||
GLuint t_vbo;
|
||||
|
|
@ -105,10 +111,9 @@ void fishbone::Mesh::draw() {
|
|||
glNormalPointer(GL_FLOAT, 0, nullptr);
|
||||
|
||||
glColor3f(1, 1, 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
if(this->texture != nullptr) this->texture->use();
|
||||
if(this->texture != nullptr) this->texture->begin();
|
||||
glDrawArrays(GL_TRIANGLES, 0, this->impl->count);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
if(this->texture != nullptr) this->texture->end();
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue