Changeset 350 for trunk/src/gl
- Timestamp:
- 02/04/15 16:37:00 (10 years ago)
- Location:
- trunk/src/gl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_device.cc
r331 r350 49 49 image_data* data = new image_data( format, glm::ivec2( image->w, image->h ), (nv::uint8*)image->pixels ); 50 50 return data; 51 } 52 53 // this is a temporary function that will be removed once we find a way to 54 // pass binary file data around 55 image_data* gl_device::create_image_data( const uint8* data, uint32 size ) 56 { 57 load_sdl_image_library(); 58 SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( (void*)data, size ), 1, "tga" ); 59 if ( !image ) 60 { 61 NV_LOG( LOG_ERROR, "Image binary data cannot be loaded found!" ); 62 return nullptr; 63 } 64 // TODO: BGR vs RGB, single channel 65 assert( image->format->BytesPerPixel > 2 ); 66 image_format format( image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE ); 67 image_data* idata = new image_data( format, glm::ivec2( image->w, image->h ), ( nv::uint8* )image->pixels ); 68 return idata; 51 69 } 52 70 -
trunk/src/gl/gl_enum.cc
r340 r350 296 296 case BYTE_VECTOR_3 : return GL_INT_VEC3; 297 297 case BYTE_VECTOR_4 : return GL_INT_VEC4; 298 default : return 0; // TODO: throw! 298 // remove, error or ? 299 case UBYTE_VECTOR_2: return GL_INT_VEC2; 300 case UBYTE_VECTOR_3: return GL_INT_VEC3; 301 case UBYTE_VECTOR_4: return GL_INT_VEC4; 302 default: return 0; // TODO: throw! 299 303 } 300 304 }
Note: See TracChangeset
for help on using the changeset viewer.