Skip to content

Commit

Permalink
Add RGBA128F named video format type and rename RGBA to RGBA32
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenlovegrove committed Jul 7, 2016
1 parent d772723 commit 451c24e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
8 changes: 8 additions & 0 deletions include/pangolin/gl/gl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ inline void GlTexture::Download(TypedImage& image) const
image.Alloc(width, height, VideoFormatFromString("RGB24"));
Download(image.ptr, GL_RGB, GL_UNSIGNED_BYTE);
break;
case GL_RGBA:
image.Alloc(width, height, VideoFormatFromString("RGBA32"));
Download(image.ptr, GL_RGBA, GL_UNSIGNED_BYTE);
break;
case GL_LUMINANCE32F_ARB:
image.Alloc(width, height, VideoFormatFromString("GRAY32F"));
Download(image.ptr, GL_LUMINANCE, GL_FLOAT);
Expand All @@ -250,6 +254,10 @@ inline void GlTexture::Download(TypedImage& image) const
image.Alloc(width, height, VideoFormatFromString("RGB96F"));
Download(image.ptr, GL_RGB, GL_FLOAT);
break;
case GL_RGBA32F:
image.Alloc(width, height, VideoFormatFromString("RGBA128F"));
Download(image.ptr, GL_RGBA, GL_FLOAT);
break;
default:
throw std::runtime_error( "GlTexture::Download - Unknown internal format");
}
Expand Down
2 changes: 1 addition & 1 deletion src/display/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void SaveFramebuffer(std::string prefix, const Viewport& v)
#ifdef HAVE_PNG
Image<unsigned char> buffer;

VideoPixelFormat fmt = VideoFormatFromString("RGBA");
VideoPixelFormat fmt = VideoFormatFromString("RGBA32");
buffer.Alloc(v.w, v.h, v.w * fmt.bpp/8 );
glReadBuffer(GL_BACK);
glPixelStorei(GL_PACK_ALIGNMENT, 1); // TODO: Avoid this?
Expand Down
2 changes: 1 addition & 1 deletion src/display/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void SaveViewFromFbo(std::string prefix, View& view, float scale)

#ifdef HAVE_PNG
Image<unsigned char> buffer;
VideoPixelFormat fmt = VideoFormatFromString("RGBA");
VideoPixelFormat fmt = VideoFormatFromString("RGBA32");
buffer.Alloc(w, h, w * fmt.bpp/8 );
glReadBuffer(GL_BACK);
glPixelStorei(GL_PACK_ALIGNMENT, 1); // TODO: Avoid this?
Expand Down
3 changes: 2 additions & 1 deletion src/image/image_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ const VideoPixelFormat SupportedVideoPixelFormats[] =
{"RGB48", 3, {16,16,16}, 48, false},
{"BGR48", 3, {16,16,16}, 48, false},
{"YUYV422", 3, {4,2,2}, 16, false},
{"RGBA", 4, {8,8,8,8}, 32, false},
{"RGBA32", 4, {8,8,8,8}, 32, false},
{"GRAY32F", 1, {32}, 32, false},
{"GRAY64F", 1, {64}, 64, false},
{"RGB96F", 3, {32,32,32}, 96, false},
{"RGBA128F", 4, {32,32,32,32}, 128, false},
{"",0,{0,0,0,0},0,0}
};

Expand Down
4 changes: 2 additions & 2 deletions src/image/image_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ VideoPixelFormat TgaFormat(int depth, int color_type, int color_map)
if(depth == 24) {
return VideoFormatFromString("RGB24");
}else if(depth == 32) {
return VideoFormatFromString("RGBA");
return VideoFormatFromString("RGBA32");
}
}else if(color_type == 3){
// Greyscale
Expand Down Expand Up @@ -127,7 +127,7 @@ VideoPixelFormat PngFormat(png_structp png_ptr, png_infop info_ptr )
if( colour == PNG_COLOR_MASK_COLOR ) {
return VideoFormatFromString("RGB24");
} else if( colour == (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) ) {
return VideoFormatFromString("RGBA");
return VideoFormatFromString("RGBA32");
} else if( colour == PNG_COLOR_MASK_ALPHA ) {
return VideoFormatFromString("Y400A");
} else {
Expand Down

0 comments on commit 451c24e

Please sign in to comment.