VR-Vantage 3.1 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
sensorFx
include
fbObject.h
Go to the documentation of this file.
1
2
// Copyright JRM Enterprises, Inc. 2006
3
// All rights reserved.
4
//
5
// This code is the intellectual property of JRM Enterprises, Inc.
6
// It may not be used or released as source or compiled binary form
7
// without the prior written consent of JRM Enterprises, Inc.
8
//
9
// Original Authors: Ken George
11
12
#ifndef FBOBJECT__H
13
#define FBOBJECT__H
14
15
#ifndef __gl_h_
16
#include <GL/glew.h>
17
#ifdef _WIN32
18
#include <GL/wglew.h>
19
#else
20
#include <GL/glxew.h>
21
#endif
22
#endif
23
24
// simple wrapper to encapsulate a framebuffer_object using render-to-texture and its associated texture object
25
26
class
fbObject
{
27
public
:
28
fbObject
(
int
width
,
int
height
,
GLenum
target
,
GLenum
texInternalFormat);
29
30
~fbObject
();
31
32
void
setPreviousFBO
(
GLuint
id
)
33
{
34
m_prevFBO
=
id
;
35
}
36
37
GLuint
getPreviousFBO
()
const
38
{
39
return
m_prevFBO
;
40
}
41
42
GLuint
getCurrentFBO
()
const
43
{
44
return
m_fbo
;
45
}
46
47
// activate this fbo for rendering
48
void
Activate
(
bool
clear =
false
);
49
// activate the standard frame buffer for rendering
50
void
Deactivate
();
51
52
// bind the texture associated with this fbo as texture
53
void
Bind
() {
glBindTexture
(
m_target
,
m_tex
); }
54
55
// release the texture - no operation necessary with fbo
56
void
Release
() { }
57
58
inline
int
GetWidth
() {
return
m_width
; }
59
inline
int
GetHeight
() {
return
m_height
; }
60
61
private
:
62
63
void
CheckFramebufferStatus
();
64
65
GLuint
m_fbo
;
// color render target
66
GLuint
m_prevFBO
;
// Previously bound FBO
67
GLuint
m_tex
;
// texture for each buffer
68
GLenum
m_target
;
// texture target type
69
int
m_width
;
// width of fbo/texture
70
int
m_height
;
// height of fbo/texture
71
};
72
#endif
73
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (
www.mak.com
)