ImageTransformsGPU.cpp File Reference

Support functions for GPU remapping. More...

#include <iostream>
#include <iomanip>
#include <GL/glew.h>
#include <GL/glut.h>
#include <string.h>
#include <vigra/diff2d.hxx>
#include <vigra/utilities.hxx>
#include <vigra/error.hxx>
#include <vigra_ext/ImageTransformsGPU.h>
#include <sys/time.h>
#include <time.h>
#include <vector>

Include dependency graph for ImageTransformsGPU.cpp:

Include dependency graph

Go to the source code of this file.

Namespaces

namespace  vigra_ext

Defines

#define GLEW_STATIC
#define ___NCFILE___   ((char *) __FILE__)
#define CHECK_GL()   checkGLErrors(__LINE__, ___NCFILE___)

Functions

long getms ()
void checkGLErrors (int line, char *file)
void printInfoLog (GLhandleARB obj)
bool checkFramebufferStatus (int line, char *file)
void compileGLSL (const char *programName, GLhandleARB &programObject, GLhandleARB &shaderObject, const char **source)
void makeChunks (const int width, const int height, const int maxTextureSize, const long long int maxPixels, vector< Rect2D > &result)
void SetGPUDebugMessages (const bool doPrint)
bool transformImageGPUIntern (const std::string &coordXformGLSL, const std::string &interpolatorGLSL, const int interpolatorSize, const std::string &photometricGLSL, const vector< double > &invLut, const vector< double > &destLut, const vigra::Diff2D srcSize, const void *const srcBuffer, const int srcGLInternalFormat, const int srcGLTransferFormat, const int srcGLFormat, const int srcGLType, const void *const srcAlphaBuffer, const int srcAlphaGLType, const vigra::Diff2D destUL, const vigra::Diff2D destSize, void *const destBuffer, const int destGLInternalFormat, const int destGLTransferFormat, const int destGLFormat, const int destGLType, void *const destAlphaBuffer, const int destAlphaGLType, const bool warparound)

Variables

GLenum XGLMap []
const char * XGLStringMap []
int BytesPerPixel []
const char * AlphaCompositeKernelSource
bool printDebug = false


Detailed Description

Support functions for GPU remapping.

Author:
Andrew Mihal
$Id$

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition in file ImageTransformsGPU.cpp.


Define Documentation

#define ___NCFILE___   ((char *) __FILE__)
 

Definition at line 75 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

 
#define CHECK_GL  )     checkGLErrors(__LINE__, ___NCFILE___)
 

Definition at line 76 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

#define GLEW_STATIC
 

Definition at line 30 of file ImageTransformsGPU.cpp.


Function Documentation

bool checkFramebufferStatus int  line,
char *  file
[static]
 

Definition at line 141 of file ImageTransformsGPU.cpp.

References cerr.

Referenced by vigra_ext::transformImageGPUIntern().

void checkGLErrors int  line,
char *  file
[static]
 

Definition at line 118 of file ImageTransformsGPU.cpp.

References cerr.

void compileGLSL const char *  programName,
GLhandleARB &  programObject,
GLhandleARB &  shaderObject,
const char **  source
[static]
 

Definition at line 173 of file ImageTransformsGPU.cpp.

References cerr, and printInfoLog().

Referenced by vigra_ext::transformImageGPUIntern().

long getms  ) 
 

Definition at line 57 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

void makeChunks const int  width,
const int  height,
const int  maxTextureSize,
const long long int  maxPixels,
vector< Rect2D > &  result
[static]
 

Definition at line 210 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

void printInfoLog GLhandleARB  obj  )  [static]
 

Definition at line 126 of file ImageTransformsGPU.cpp.

References cout.

Referenced by compileGLSL().

IMPEX void vigra_ext::SetGPUDebugMessages const bool  doPrint  ) 
 

Definition at line 272 of file ImageTransformsGPU.cpp.

References printDebug.

Referenced by main().

bool transformImageGPUIntern const std::string coordXformGLSL,
const std::string interpolatorGLSL,
const int  interpolatorSize,
const std::string photometricGLSL,
const vector< double > &  invLut,
const vector< double > &  destLut,
const vigra::Diff2D  srcSize,
const void *const   srcBuffer,
const int  srcGLInternalFormat,
const int  srcGLTransferFormat,
const int  srcGLFormat,
const int  srcGLType,
const void *const   srcAlphaBuffer,
const int  srcAlphaGLType,
const vigra::Diff2D  destUL,
const vigra::Diff2D  destSize,
void *const   destBuffer,
const int  destGLInternalFormat,
const int  destGLTransferFormat,
const int  destGLFormat,
const int  destGLType,
void *const   destAlphaBuffer,
const int  destAlphaGLType,
const bool  warparound
 

Definition at line 277 of file ImageTransformsGPU.cpp.

References ___NCFILE___, AlphaCompositeKernelSource, BytesPerPixel, CHECK_GL, checkFramebufferStatus(), compileGLSL(), cout, getms(), M_PI, makeChunks(), XGLMap, and XGLStringMap.


Variable Documentation

const char* AlphaCompositeKernelSource [static]
 

Initial value:

 {
"#version 110\n"
"#extension GL_ARB_texture_rectangle : enable\n"
"uniform sampler2DRect SrcAlphaTexture;\n"
"void main(void)\n"
"{\n"
"   float alpha = texture2DRect(SrcAlphaTexture, gl_TexCoord[0].st).a;\n"
"   if (alpha != 0.0) discard;\n"
"   gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
"}\n"
}

Definition at line 106 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

int BytesPerPixel[] [static]
 

Initial value:

 {
    1, 1, 2, 2, 4, 4, 4,
    4, 8, 16, 2, 4, 8,
    3, 6, 12, 1, 2, 4,
    0, 0, 0, 0
}

Definition at line 99 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

bool printDebug = false [static]
 

Definition at line 139 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::SetGPUDebugMessages().

GLenum XGLMap[] [static]
 

Initial value:

 {
    
    GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT,
    
    GL_RGBA8, GL_RGBA16, GL_RGBA32F_ARB, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE16_ALPHA16, GL_LUMINANCE_ALPHA32F_ARB,
    GL_RGB8,  GL_RGB16,  GL_RGB32F_ARB,  GL_LUMINANCE8,        GL_LUMINANCE16,         GL_LUMINANCE32F_ARB,
    
    GL_LUMINANCE, GL_RGB, GL_LUMINANCE_ALPHA, GL_RGBA
}

Definition at line 79 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

const char* XGLStringMap[] [static]
 

Initial value:

 {
    
    "GL_BYTE", "GL_UNSIGNED_BYTE", "GL_SHORT", "GL_UNSIGNED_SHORT", "GL_INT", "GL_UNSIGNED_INT", "GL_FLOAT",
    
    "GL_RGBA8", "GL_RGBA16", "GL_RGBA32F_ARB", "GL_LUMINANCE8_ALPHA8", "GL_LUMINANCE16_ALPHA16", "GL_LUMINANCE_ALPHA32F_ARB",
    "GL_RGB8",  "GL_RGB16",  "GL_RGB32F_ARB",  "GL_LUMINANCE8",        "GL_LUMINANCE16",         "GL_LUMINANCE32F_ARB",
    
    "GL_LUMINANCE", "GL_RGB", "GL_LUMINANCE_ALPHA", "GL_RGBA"
}

Definition at line 89 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().


Generated on Wed Jul 16 01:25:44 2014 for Hugintrunk by  doxygen 1.3.9.1