Changeset 292 for trunk/src/gl
- Timestamp:
- 07/26/14 04:25:23 (11 years ago)
- Location:
- trunk/src/gl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_device.cc
r245 r292 81 81 return nullptr; 82 82 } 83 image_data* data = new image_data( glm::ivec2( image->w, image->h ), image->format->BytesPerPixel, (nv::uint8*)image->pixels ); 83 // TODO: BGR vs RGB, single channel 84 assert( image->format->BytesPerPixel > 2 ); 85 image_format format(image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE ); 86 image_data* data = new image_data( format, glm::ivec2( image->w, image->h ), (nv::uint8*)image->pixels ); 84 87 return data; 85 88 } 86 89 87 texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ )90 texture2d* gl_device::create_texture2d( ivec2 size, pixel_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ ) 88 91 { 89 92 return new gl_texture2d( size, aformat, adatatype, asampler, data ); -
trunk/src/gl/gl_enum.cc
r237 r292 147 147 } 148 148 149 unsigned int nv::image_format_to_enum( image_format format )149 unsigned int nv::image_format_to_enum( pixel_format format ) 150 150 { 151 151 switch( format ) -
trunk/src/gl/gl_texture2d.cc
r204 r292 10 10 using namespace nv; 11 11 12 nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ )12 nv::gl_texture2d::gl_texture2d( ivec2 size, pixel_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ ) 13 13 : texture2d( size, aformat, adatatype, asampler ), m_name() 14 14 { … … 38 38 { 39 39 glBindTexture( GL_TEXTURE_2D, m_name.get_value() ); 40 glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format ), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );40 glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format.format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format.format), nv::datatype_to_gl_enum(m_format.type), data ); 41 41 glBindTexture( GL_TEXTURE_2D, 0 ); 42 42 }
Note: See TracChangeset
for help on using the changeset viewer.