Update of /cvsroot/playerstage/code/gazebo/server/sensors/Camera
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18066
Modified Files:
Camera.cc GLContext.cc
Log Message:
Fixed Camera to save frames in color
Index: GLContext.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/sensors/Camera/GLContext.cc,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** GLContext.cc 26 Apr 2005 18:29:46 -0000 1.20
--- GLContext.cc 6 Jun 2007 12:20:21 -0000 1.21
***************
*** 534,562 ****
// TODO: honor color bits request
!
int attrib[] =
! {
! // GLX_DOUBLEBUFFER, False,
! GLX_RED_SIZE, 1,
! GLX_GREEN_SIZE, 1,
! GLX_BLUE_SIZE, 1,
! GLX_DEPTH_SIZE, this->reqDepth,
! GLX_RENDER_TYPE, GLX_RGBA_BIT,
! // GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
! None
! };
int pbufAttrib[] =
! {
! GLX_PBUFFER_WIDTH, this->reqWidth,
! GLX_PBUFFER_HEIGHT, this->reqHeight,
! // GLX_RENDER_TYPE, GLX_RGBA_BIT,
! // GLX_DEPTH_SIZE, this->reqDepth,
! GLX_LARGEST_PBUFFER, False,
! None
! };
int a[10];
!
PRINT_MSG0(2, "trying GLXP pbuffer rendering");
--- 534,562 ----
// TODO: honor color bits request
!
int attrib[] =
! {
! // GLX_DOUBLEBUFFER, False,
! GLX_RED_SIZE, 1,
! GLX_GREEN_SIZE, 1,
! GLX_BLUE_SIZE, 1,
! GLX_DEPTH_SIZE, this->reqDepth,
! GLX_RENDER_TYPE, GLX_RGBA_BIT,
! // GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
! None
! };
int pbufAttrib[] =
! {
! GLX_PBUFFER_WIDTH, this->reqWidth,
! GLX_PBUFFER_HEIGHT, this->reqHeight,
! // GLX_RENDER_TYPE, GLX_RGBA_BIT,
! // GLX_DEPTH_SIZE, this->reqDepth,
! GLX_LARGEST_PBUFFER, False,
! None
! };
int a[10];
!
PRINT_MSG0(2, "trying GLXP pbuffer rendering");
***************
*** 569,573 ****
return -1;
}
!
for (i=0;i<nitems;i++)
{
--- 569,582 ----
return -1;
}
!
! // Get the rendering context
! this->context = glXCreateNewContext(::display, configs[0], GLX_RGBA_TYPE,
shareList, True);
! PRINT_GL_ERR();
! if (!this->context)
! {
! PRINT_MSG0(2, "unable to create context");
! return -1;
! }
!
for (i=0;i<nitems;i++)
{
***************
*** 578,581 ****
--- 587,591 ----
break;
}
+
if (!this->pbuffer)
{
***************
*** 583,590 ****
return -1;
}
!
// Use this buffer as our drawable
this->drawable = pbuffer;
!
// Get the visual
visual = glXGetVisualFromFBConfig(::display, config);
--- 593,600 ----
return -1;
}
!
// Use this buffer as our drawable
this->drawable = pbuffer;
!
// Get the visual
visual = glXGetVisualFromFBConfig(::display, config);
***************
*** 596,608 ****
}
- // Get the rendering context
- this->context = glXCreateContext(::display, visual, shareList, True);
- PRINT_GL_ERR();
- if (!this->context)
- {
- PRINT_MSG0(2, "unable to create context");
- return -1;
- }
-
glXGetFBConfigAttrib(::display, config, GLX_RED_SIZE, a + 0);
glXGetFBConfigAttrib(::display, config, GLX_GREEN_SIZE, a + 1);
--- 606,609 ----
***************
*** 610,618 ****
glXGetFBConfigAttrib(::display, config, GLX_ALPHA_SIZE, a + 3);
glXGetFBConfigAttrib(::display, config, GLX_DEPTH_SIZE, a + 4);
!
// Print some info about the configuration
! PRINT_MSG6(1, "rendering: [GLXP pbuffer] direct [%s] RGBA [%d %d %d %d]
depth [%d]",
! (glXIsDirect(::display, this->context) ? "yes" : "no"),
! a[0], a[1], a[2], a[3], a[4]);
return 0;
#else
--- 611,618 ----
glXGetFBConfigAttrib(::display, config, GLX_ALPHA_SIZE, a + 3);
glXGetFBConfigAttrib(::display, config, GLX_DEPTH_SIZE, a + 4);
!
// Print some info about the configuration
! PRINT_MSG6(1, "rendering: [GLXP pbuffer] direct [%s] RGBA [%d %d %d % d]
depth [%d]", (glXIsDirect(::display, this->context) ? "yes" : "no"), a[0],
a[1], a[2], a[3], a[4]);
!
return 0;
#else
Index: Camera.cc
===================================================================
RCS file: /cvsroot/playerstage/code/gazebo/server/sensors/Camera/Camera.cc,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -d -r1.75 -r1.76
*** Camera.cc 16 Dec 2006 19:02:23 -0000 1.75
--- Camera.cc 6 Jun 2007 12:20:21 -0000 1.76
***************
*** 297,302 ****
GL_RGB, GL_UNSIGNED_BYTE, this->rgbImage);
! glReadPixels(0, 0, this->imageWidth, this->imageHeight,
GL_GREEN, GL_UNSIGNED_BYTE, this->greyImage);
PRINT_GL_ERR();
--- 297,303 ----
GL_RGB, GL_UNSIGNED_BYTE, this->rgbImage);
! /*glReadPixels(0, 0, this->imageWidth, this->imageHeight,
GL_GREEN, GL_UNSIGNED_BYTE, this->greyImage);
+ */
PRINT_GL_ERR();
***************
*** 545,550 ****
fprintf( fp, "P5\n# Gazebo\n%d %d\n255\n", this->imageWidth,
this->imageHeight);
for (int i = this->imageHeight-1; i >= 0; i--)
! // fwrite( this->rgbImage + i * this->imageWidth * 3, 1, this->imageWidth
* 3, fp );
! fwrite( this->greyImage + i * this->imageWidth, 1, this->imageWidth, fp );
fclose( fp );
--- 546,551 ----
fprintf( fp, "P5\n# Gazebo\n%d %d\n255\n", this->imageWidth,
this->imageHeight);
for (int i = this->imageHeight-1; i >= 0; i--)
! fwrite( this->rgbImage + i * this->imageWidth * 3, 1, this->imageWidth *
3, fp );
! // fwrite( this->greyImage + i * this->imageWidth, 1, this->imageWidth, fp
);
fclose( fp );
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit