38#include <Inventor/elements/SoViewportRegionElement.h>
39#include <Inventor/errors/SoDebugError.h>
52 static bool first =
true;
60 const SbViewportRegion& aViewPortRegion
62:SoGLRenderAction(aViewPortRegion)
78 SoDebugError::post(
"SoGL2PSAction::enableFileWriting",
84 const SbViewportRegion& vpr = getViewportRegion();
85 SoViewportRegionElement::set(getState(),vpr);
116 if(!
fFile)
return false;
118 glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID,&valid);
119 if(!valid)
return false;
121 glGetFloatv(GL_CURRENT_RASTER_POSITION,
pos);
122 int xoff = -(int)(aXmove + aXorig);
123 int yoff = -(int)(aYmove + aYorig);
124 int x = (int)(
pos[0] + xoff);
125 int y = (int)(
pos[1] + yoff);
128 glGetIntegerv(GL_VIEWPORT,vp);
131 if(x+w>(vp[0]+vp[2])) w = vp[0]+vp[2]-x;
132 if(y+h>(vp[1]+vp[3])) h = vp[1]+vp[3]-y;
134 if(
s<=0)
return false;
135 float* image = (
float*)::malloc(
s *
sizeof(
float));
136 if(!image)
return false;
137 glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image);
151 const SbViewportRegion& vpr = getViewportRegion();
152 SoViewportRegionElement::set(getState(),vpr);
158 SoGLRenderAction::beginTraversal(aNode);
162 SoGLRenderAction::beginTraversal(aNode);
static const G4double pos
static constexpr double s
bool G4gl2psBegin()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setFileName(const char *)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool enableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SoGL2PSAction(const SbViewportRegion &)
bool addBitmap(int, int, float=0, float=0, float=0, float=0)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
virtual void beginTraversal(SoNode *)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void disableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//