WIP: GUI Toolkit
This commit is contained in:
15
texture.cc
15
texture.cc
@@ -101,10 +101,10 @@ void TextureCubeMap::bind() const
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, _texID);
|
||||
}
|
||||
|
||||
Texture2D::Texture2D()
|
||||
: texID_(0), width_(0), height_(0), alpha_(false)
|
||||
{
|
||||
}
|
||||
// Texture2D::Texture2D()
|
||||
// : texID_(0), width_(0), height_(0), alpha_(false)
|
||||
// {
|
||||
// }
|
||||
|
||||
Texture2D::Texture2D(unsigned width, unsigned height, bool alpha)
|
||||
: texID_(0), width_(width), height_(height), alpha_(alpha)
|
||||
@@ -202,14 +202,15 @@ void Texture2D::copyFromSurface(SDL_Surface *src)
|
||||
surf = src;
|
||||
}
|
||||
|
||||
if (SDL_MUSTLOCK(surf))
|
||||
SDL_LockSurface(surf);
|
||||
|
||||
SDLSurfaceScopedLock lock{surf};
|
||||
bind();
|
||||
if(surf->format->Amask == 0)
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surf->w, surf->h, GL_RGB, GL_UNSIGNED_BYTE, surf->pixels);
|
||||
else
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surf->w, surf->h, GL_RGBA, GL_UNSIGNED_BYTE, surf->pixels);
|
||||
|
||||
lock.unlock();
|
||||
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user