Changeset 461 for trunk/src


Ignore:
Timestamp:
08/19/15 19:01:16 (10 years ago)
Author:
epyon
Message:
  • quaternion fixes
  • image_data/device/gl_device/gl_enum - single channel texture support (RED)
Location:
trunk/src/gl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gl/gl_device.cc

    r439 r461  
    5151        }
    5252        // TODO: BGR vs RGB, single channel
    53         assert( image->format->BytesPerPixel > 2 );
    54         image_format format(image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
     53        pixel_format pformat = RGBA;
     54        switch ( image->format->BytesPerPixel )
     55        {
     56        case 4: pformat = RGBA; break;
     57        case 3: pformat = RGB; break;
     58        case 1: pformat = RED; break;
     59        default: NV_ASSERT( false, "BytesPerPixel != 4,3 or 1!" );
     60        }
     61        image_format format( pformat, UBYTE );
    5562        image_data* data = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
    5663        return data;
  • trunk/src/gl/gl_enum.cc

    r438 r461  
    184184        case BGR     : return GL_BGR;
    185185        case BGRA    : return GL_BGRA;
     186        case RED     : return GL_RED;
    186187        NV_RETURN_COVERED_DEFAULT( 0 );
    187188        }
     
    200201        case BGR     : return GL_RGB8;
    201202        case BGRA    : return GL_RGBA8;
     203        case RED     : return 0x8040; // GL_LUMINANCE8; // TODO: change to GL_R8!
     204
    202205        NV_RETURN_COVERED_DEFAULT( 0 );
    203206        }
Note: See TracChangeset for help on using the changeset viewer.