Changeset 43 for trunk/src/gl


Ignore:
Timestamp:
05/28/13 14:09:36 (12 years ago)
Author:
epyon
Message:
  • texture2d object interface and implementation
Location:
trunk/src/gl
Files:
1 added
1 edited

Legend:

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

    r42 r43  
    134134}
    135135
     136unsigned int nv::texture_format_to_enum( texture2d::format format )
     137{
     138        switch( format )
     139        {
     140        case texture2d::RGB  : return GL_RGB;
     141        case texture2d::RGBA : return GL_RGBA;
     142        default : return 0; // TODO: throw!
     143        }
     144}
     145
     146unsigned int nv::texture_datatype_to_enum( texture2d::datatype datatype )
     147{
     148        switch( datatype )
     149        {
     150        case texture2d::UINT   : return GL_UNSIGNED_INT;
     151        case texture2d::UBYTE  : return GL_UNSIGNED_BYTE;
     152        case texture2d::FLOAT  : return GL_FLOAT;
     153        default : return 0; // TODO: throw!
     154        }
     155}
     156
     157unsigned int nv::texture_filter_to_enum( texture2d_sampler::filter filter )
     158{
     159        switch( filter )
     160        {
     161        case texture2d_sampler::LINEAR                 : return GL_LINEAR;
     162        case texture2d_sampler::NEAREST                : return GL_NEAREST;
     163        case texture2d_sampler::NEAREST_MIPMAP_NEAREST : return GL_NEAREST_MIPMAP_NEAREST;
     164        case texture2d_sampler::LINEAR_MIPMAP_NEAREST  : return GL_LINEAR_MIPMAP_NEAREST;
     165        case texture2d_sampler::NEAREST_MIPMAP_LINEAR  : return GL_NEAREST_MIPMAP_LINEAR;
     166        case texture2d_sampler::LINEAR_MIPMAP_LINEAR   : return GL_LINEAR_MIPMAP_LINEAR;
     167        default : return 0; // TODO: throw!
     168        }
     169}
     170
     171unsigned int nv::texture_wrap_to_enum( texture2d_sampler::wrap wrap )
     172{
     173        switch( wrap )
     174        {
     175        case texture2d_sampler::CLAMP_TO_EDGE   : return GL_CLAMP_TO_EDGE;
     176        case texture2d_sampler::CLAMP_TO_BORDER : return GL_CLAMP_TO_BORDER;
     177        case texture2d_sampler::MIRRORED_REPEAT : return GL_MIRRORED_REPEAT;
     178        case texture2d_sampler::REPEAT          : return GL_REPEAT;
     179        default : return 0; // TODO: throw!
     180        }
     181}
     182
     183
    136184unsigned int nv::type_to_gl_enum( type type )
    137185{
Note: See TracChangeset for help on using the changeset viewer.