Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Macros | Functions | Variables
ImageTransformsGPU.cpp File Reference

Support functions for GPU remapping. More...

#include <iostream>
#include <iomanip>
#include "hugin_config.h"
#include <GL/glew.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:

Go to the source code of this file.

Namespaces

 vigra_ext
 

Macros

#define ___NCFILE___   ((char *) __FILE__)
 
#define CHECK_GL()   checkGLErrors(__LINE__, ___NCFILE___)
 
#define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX   0x9048
 
#define TEXTURE_FREE_MEMORY_ATI   0x87FC
 

Functions

long getms ()
 
static void checkGLErrors (int line, char *file)
 
static void printInfoLog (GLhandleARB obj)
 
static bool checkFramebufferStatus (int line, char *file)
 
static void compileGLSL (const char *programName, GLhandleARB &programObject, GLhandleARB &shaderObject, const char **source)
 
static void makeChunks (const int width, const int height, const int maxTextureSize, const long long int maxPixels, vector< Rect2D > &result)
 
void vigra_ext::SetGPUDebugMessages (const bool doPrint)
 
bool vigra_ext::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

static GLenum XGLMap []
 
static const char * XGLStringMap []
 
static int BytesPerPixel []
 
static const char * AlphaCompositeKernelSource
 
static 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, see http://www.gnu.org/licenses/.

Definition in file ImageTransformsGPU.cpp.

Macro Definition Documentation

#define ___NCFILE___   ((char *) __FILE__)

Definition at line 82 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

#define CHECK_GL ( )    checkGLErrors(__LINE__, ___NCFILE___)

Definition at line 83 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

#define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX   0x9048
#define TEXTURE_FREE_MEMORY_ATI   0x87FC

Function Documentation

static bool checkFramebufferStatus ( int  line,
char *  file 
)
static

Definition at line 183 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

static void checkGLErrors ( int  line,
char *  file 
)
static

Definition at line 125 of file ImageTransformsGPU.cpp.

static void compileGLSL ( const char *  programName,
GLhandleARB &  programObject,
GLhandleARB &  shaderObject,
const char **  source 
)
static

Definition at line 215 of file ImageTransformsGPU.cpp.

References printDebug, and printInfoLog().

Referenced by vigra_ext::transformImageGPUIntern().

long getms ( )

Definition at line 64 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

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

Definition at line 252 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

static void printInfoLog ( GLhandleARB  obj)
static

Definition at line 169 of file ImageTransformsGPU.cpp.

Referenced by compileGLSL().

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 113 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 106 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().

bool printDebug =false
static
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 86 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 96 of file ImageTransformsGPU.cpp.

Referenced by vigra_ext::transformImageGPUIntern().