Basic Image AlgorithmS Library
2.8.0
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
OpenGLFramework
RenderingContext
glfRenderingContext.hh
1
/*
2
This file is part of the BIAS library (Basic ImageAlgorithmS).
3
4
Copyright (C) 2008, 2009 (see file CONTACT for details)
5
Multimediale Systeme der Informationsverarbeitung
6
Institut fuer Informatik
7
Christian-Albrechts-Universitaet Kiel
8
9
10
BIAS is free software; you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation; either version 2.1 of the License, or
13
(at your option) any later version.
14
15
BIAS is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with BIAS; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
*/
24
25
#ifndef __glfRenderingContext_hh__
26
#define __glfRenderingContext_hh__
27
28
#include <OpenGLFramework/Base/glfCommon.hh>
29
#include <Base/Image/Image.hh>
30
31
namespace
BIAS {
32
33
/**
34
* Configuration for a rendering context.
35
*/
36
struct
BIASOpenGLFramework_EXPORT
glfRenderingContextConfig
37
{
38
glfRenderingContextConfig
();
39
void
Dump(std::ostream& out = std::cout);
40
41
int
width
;
42
int
height
;
43
bool
doubleBuffer
;
44
int
redSize
;
45
int
greenSize
;
46
int
blueSize
;
47
int
alphaSize
;
48
int
depthSize
;
49
int
stencilSize
;
50
};
51
52
/**
53
* Interface for OpenGL rendering contexts.
54
* \author 05/2007 jkollmann
55
*/
56
class
BIASOpenGLFramework_EXPORT
glfRenderingContext
{
57
public
:
58
59
virtual
~glfRenderingContext
() {}
60
61
/**
62
* Initializes the rendering context with the given configuration.
63
* All implementations should call <code>MakeCurrent</code> and
64
* <code>InitGlew</code> in this method. A context may be initialized
65
* multiple times.
66
* \param config Requested configuration
67
*/
68
virtual
void
Init(
const
glfRenderingContextConfig
& config) = 0;
69
70
/**
71
* Uninitializes the rendering context. This method must be called
72
* before the application quits and after all Open GL resources
73
* (textures etc.) have been deleted.
74
*/
75
virtual
void
Destroy() = 0;
76
77
/**
78
* Makes this context the current target for OpenGL calls. Must be
79
* called when switching between multiple rendering contexts.
80
*/
81
virtual
void
MakeCurrent() = 0;
82
83
/**
84
* Removes the current state of this context. Must be
85
* called before MakeCurrent is called from another thread.
86
*/
87
virtual
void
DoneCurrent
(){
88
std::cerr <<
"WARNING: DoneCurrent() is not implemented. This function should be overloaded."
<< std::endl;
89
};
90
91
/**
92
* Gets the currently used config of the rendering context. The rendering
93
* context must have been successfully initialized before this method may
94
* be called.
95
* \param config The config structure to be filled
96
*/
97
virtual
void
GetConfig(
glfRenderingContextConfig
& config) = 0;
98
99
/**
100
* Frame buffer data that can be retrieved by <code>Grab</code>.
101
*/
102
enum
GrabSource
{
103
GRAB_COLOR
,
/**< Grab RGB image. */
104
GRAB_DEPTH
,
/**< Grab depth buffer. */
105
GRAB_STENCIL
/**< Grab stencil buffer. */
106
};
107
108
/**
109
* Copies the contents of the framebuffer to an image.
110
* This method calls <code>MakeCurrent</code> on this rendering context.
111
*/
112
void
Grab(
BIAS::Image<unsigned char>
& image, GrabSource source = GRAB_COLOR,
113
int
x = 0,
int
y = 0,
int
width = 0,
int
height = 0);
114
115
protected
:
116
117
/**
118
* Initializes GLEW if enabled in the BIAS configuration. If not,
119
* this method does nothing. Should be called during <code>Init</code> by
120
* every <code>glfRenderingContext</code> implementation.
121
*/
122
void
InitGlew();
123
};
124
125
}
// namespace BIAS
126
127
#endif // __glfRenderingContext_hh__
BIAS::glfRenderingContextConfig::depthSize
int depthSize
Definition:
glfRenderingContext.hh:48
BIAS::glfRenderingContextConfig::height
int height
Definition:
glfRenderingContext.hh:42
BIAS::glfRenderingContextConfig::alphaSize
int alphaSize
Definition:
glfRenderingContext.hh:47
BIAS::glfRenderingContextConfig::width
int width
Definition:
glfRenderingContext.hh:41
BIAS::glfRenderingContextConfig::greenSize
int greenSize
Definition:
glfRenderingContext.hh:45
BIAS::glfRenderingContext::DoneCurrent
virtual void DoneCurrent()
Removes the current state of this context.
Definition:
glfRenderingContext.hh:87
BIAS::glfRenderingContextConfig::doubleBuffer
bool doubleBuffer
Definition:
glfRenderingContext.hh:43
BIAS::glfRenderingContext::GRAB_COLOR
Grab RGB image.
Definition:
glfRenderingContext.hh:103
BIAS::glfRenderingContextConfig::redSize
int redSize
Definition:
glfRenderingContext.hh:44
BIAS::glfRenderingContext
Interface for OpenGL rendering contexts.
Definition:
glfRenderingContext.hh:56
BIAS::Image< unsigned char >
BIAS::glfRenderingContext::GRAB_DEPTH
Grab depth buffer.
Definition:
glfRenderingContext.hh:104
BIAS::glfRenderingContextConfig::blueSize
int blueSize
Definition:
glfRenderingContext.hh:46
BIAS::glfRenderingContext::~glfRenderingContext
virtual ~glfRenderingContext()
Definition:
glfRenderingContext.hh:59
BIAS::glfRenderingContext::GrabSource
GrabSource
Frame buffer data that can be retrieved by Grab.
Definition:
glfRenderingContext.hh:102
BIAS::glfRenderingContextConfig
Configuration for a rendering context.
Definition:
glfRenderingContext.hh:36
BIAS::glfRenderingContextConfig::stencilSize
int stencilSize
Definition:
glfRenderingContext.hh:49
Generated on Tue Feb 6 2018 02:01:42 for Basic Image AlgorithmS Library by
1.8.5