36 #include <OpenGLFramework/Base/glfFramebufferObject.hh>
37 #include <OpenGLFramework/SpecializedBatches/PlainPerPixelProcessing.hh>
38 #include <OpenGLFramework/RenderingContext/glfPBuffer.hh>
40 #include <Utils/Param.hh>
41 #include <Base/Image/ImageIO.hh>
42 #include <Base/Image/Image.hh>
43 #include <Utils/IOUtils.hh>
49 int main(
int argc,
char* argv[]) {
53 string* shaderFile = params.
AddParamString(
"shader",
"shader to be loaded",
"",
's');
54 string* outputFileName = params.
AddParamString(
"output",
"Filename of output image",
"",
'o');
55 string* inputFileName = params.
AddParamString(
"input",
"Filename of input image",
"",
'i');
56 int* iterations = params.
AddParamInt(
"iterations",
"how often shall the shader be run iteratively?", 1, 1, INT_MAX,
'I');
62 if(argc<2){params.
Usage();
return 0;}
65 bool hasInputImage_ =
false;
66 unsigned int width = 640;
67 unsigned int height = 480;
68 if(inputFileName->size() > 0 ) {
70 BIASERR(
"error loading input image "<<*inputFileName);
73 hasInputImage_ =
true;
99 outputTexture.
Allocate(width, height, GL_RGB);
107 vector<glfTexture2D*> inputTexturesVec;
112 inputTexturesVec.push_back(&inputTexture);
120 for(
int i=0; i<*iterations; i++) {
void SetFragmentShaderFromFile(const std::string &fileName)
void Allocate(int width, int height, GLenum internalFormat, int mipmap=0)
Creates a texture with undefined content.
void AttachTexture(const glfTexture &texture, GLenum attachmentPoint, int attachedMipMapLevel=0, int zSlice=0, GLenum cubeMapSide=0)
Attaches a texture to an attachment point which can be.
void Create()
Creates the texture but does not upload any data yet.
BIASOpenGLFramework_EXPORT void SwapGLObjects(glfTexture &A, glfTexture &B)
void UploadImage(const BIAS::ImageBase &image, GLenum internalFormat=0, int mipmap=0)
Uploads a BIAS::Image to a mipmap of the texture.
void SetOutputSize(unsigned int width, unsigned int height)
Returns the currently set texture set;.
void CopyToImage(ImageBase &image, int mipmap=0)
Copies the pixels of a mipmap of the texture to a BIAS::ImageBase.
Exception class used for run-time errors in the OpenGLFramework.
unsigned int GetWidth() const
virtual void Destroy()
Uninitializes the rendering context.
const std::string & GetMessageString() const
Returns the description of the error including the file name and line number where the error occured...
void Usage(std::ostream &os=std::cout)
print Help-Information to stdout
void CheckComplete() const
Checks whether the framebuffer object is supported in its current state.
unsigned int GetHeight() const
GLX pbuffer rendering context.
Class rendering quad and executing a fragment shader.
static bool ParseCommandLineEvalHelp(Param ¶ms, int argc, char *argv[])
parses the command line, adds parameter "help"
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
virtual void Init(const glfRenderingContextConfig &config)
Initializes the rendering context with the given configuration.
This class Param provides generic support for parameters.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
void Set(GLenum minFilter=GL_NEAREST, GLenum magFilter=GL_NEAREST, GLenum wrapS=GL_CLAMP, GLenum wrapT=GL_CLAMP, GLint textureNr=GL_TEXTURE0)
Convenience wrapper.
void SetRenderTarget(BIAS::glfRenderTarget *rt)
int * AddParamInt(const std::string &name, const std::string &help, int deflt=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), char cmdshort=0, int Group=GRP_NOSHOW)
For all adding routines:
void ClearColorBuffer(float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=0.0f)
Clears the color buffer of the render target with the given color.
void SetTextures(const std::vector< BIAS::glfTexture2D * > &inputTextures)
Adds textures in their respective index order and assigns them the default names img<index> in the sh...
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)
Configuration for a rendering context.
void Create()
Creates the framebuffer object.