X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture.cpp;h=3eb48b8b2eb426dafebd1791ab11d4fba09b4c63;hb=2e7f0e8b226fdeea3306e2e0eef22a8f200ae16b;hp=3a4b1096f99cb2edee54137194f64cb3b805b808;hpb=baf53e7a2db1c27376a04b088b6954eeee81f009;p=libs%2Fgl.git diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 3a4b1096..3eb48b8b 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -34,10 +34,8 @@ Texture::Texture(GLenum t, ResourceManager *m): { if(m) set_manager(m); - else if(ARB_direct_state_access) - glCreateTextures(target, 1, &id); else - glGenTextures(1, &id); + generate_id(); } Texture::~Texture() @@ -49,6 +47,16 @@ Texture::~Texture() glDeleteTextures(1, &id); } +void Texture::generate_id() +{ + if(id) + throw invalid_operation("Texture::generate_id"); + if(ARB_direct_state_access) + glCreateTextures(target, 1, &id); + else + glGenTextures(1, &id); +} + void Texture::set_format(PixelFormat fmt) { PixelComponents comp = get_components(fmt);