2
* Copyright © 2014 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Kevin DuBois <kevin.dubois@canonical.com>
19
#include "mir/graphics/gl_texture.h"
21
namespace mg = mir::graphics;
23
mg::GLTexture::GLTexture() :
26
//If you need to tweak the TexParameters, best to do it within the class
27
//so the object has a cogent idea of what the texture it represents is doing
28
glBindTexture(GL_TEXTURE_2D, id);
29
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
30
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
31
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
32
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
35
void mg::GLTexture::bind() const
37
glBindTexture(GL_TEXTURE_2D, id);
40
mg::GLTexture::~GLTexture()
42
glDeleteTextures(1, &id);
45
GLuint mg::GLTexture::generate_id() const
48
glGenTextures(1, &id);