]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.cpp
Remove the usage member from Buffer entirely
[libs/gl.git] / source / texture.cpp
index a7e4898c1edae7d73de8efe9bf425dbb69ccc569..68e4486120cb9cecdc919142727eb5f881a8d8a6 100644 (file)
@@ -97,24 +97,24 @@ DataType Texture::get_alloc_type(PixelFormat fmt)
 
 void Texture::set_internal_format(PixelFormat fmt)
 {
-       if(!get_component_size(fmt) && OES_required_internalformat)
-               fmt = get_default_sized_pixelformat(fmt);
-
        FormatSwizzle swiz = NO_SWIZZLE;
        if(ARB_texture_rg && ARB_texture_swizzle)
        {
-               if(fmt==LUMINANCE8)
+               if(fmt==LUMINANCE)
                {
-                       fmt = R8;
+                       fmt = RED;
                        swiz = R_TO_LUMINANCE;
                }
-               else if(fmt==LUMINANCE8_ALPHA8)
+               else if(fmt==LUMINANCE_ALPHA)
                {
-                       fmt = RG8;
+                       fmt = RG;
                        swiz = RG_TO_LUMINANCE_ALPHA;
                }
        }
 
+       if(!get_component_size(fmt) && OES_required_internalformat)
+               fmt = get_default_sized_pixelformat(fmt);
+
        require_pixelformat(fmt);
        ifmt = fmt;
        swizzle = swiz;
@@ -132,6 +132,12 @@ PixelFormat Texture::get_upload_format(PixelFormat fmt) const
 
 void Texture::update_parameter(int mask) const
 {
+       if(!id)
+       {
+               dirty_params |= mask;
+               return;
+       }
+
        if(!ARB_direct_state_access && TexUnit::current().get_texture()!=this)
        {
                TexUnit *unit = TexUnit::find_unit(this);