Changeset 43 for trunk


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

Legend:

Unmodified
Added
Removed
  • trunk/nv/gl/gl_enum.hh

    r42 r43  
    1616#include <nv/interface/render_state.hh>
    1717#include <nv/interface/vertex_buffer.hh>
     18#include <nv/interface/texture2d.hh>
    1819#include <nv/types.hh>
    1920
     
    3031        unsigned int stencil_operation_to_enum( stencil_test_face::operation type );
    3132        unsigned int buffer_hint_to_enum( buffer_hint hint );
     33        unsigned int texture_format_to_enum( texture2d::format format );
     34        unsigned int texture_datatype_to_enum( texture2d::datatype datatype );
     35        unsigned int texture_filter_to_enum( texture2d_sampler::filter filter );
     36        unsigned int texture_wrap_to_enum( texture2d_sampler::wrap wrap );
    3237
    3338        unsigned int type_to_gl_enum( type type );
  • 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.