Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
60d3caf0
Commit
60d3caf0
authored
Sep 13, 2011
by
Janis Born
Browse files
Added support for Multisampling to RenderBuffer
* Extended RenderBufferControl accordingly
parent
feffe0fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Controller/RenderBufferControl.hh
View file @
60d3caf0
...
...
@@ -24,6 +24,7 @@ public:
RenderBufferControl
(
void
)
:
mWidth
(
0
),
mHeight
(
0
),
mSamples
(
0
),
mInternalFormat
()
{}
virtual
~
RenderBufferControl
()
{}
...
...
@@ -32,8 +33,10 @@ public:
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline
RenderBufferControl
&
size
(
GLsizei
_width
,
GLsizei
_height
)
{
mWidth
=
_width
;
mHeight
=
_height
;
return
*
this
;
}
inline
RenderBufferControl
&
internalFormat
(
GLenum
_internalFormat
)
{
mInternalFormat
=
_internalFormat
;
return
*
this
;
}
inline
RenderBufferControl
&
size
(
GLsizei
_width
,
GLsizei
_height
)
{
mWidth
=
_width
;
mHeight
=
_height
;
return
*
this
;
}
inline
RenderBufferControl
&
size
(
GLsizei
_width
,
GLsizei
_height
,
GLsizei
_samples
)
{
mWidth
=
_width
;
mHeight
=
_height
;
mSamples
=
_samples
;
return
*
this
;
}
inline
RenderBufferControl
&
samples
(
GLsizei
_samples
)
{
mSamples
=
_samples
;
return
*
this
;
}
inline
RenderBufferControl
&
internalFormat
(
GLenum
_internalFormat
)
{
mInternalFormat
=
_internalFormat
;
return
*
this
;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
...
...
@@ -42,7 +45,7 @@ public:
virtual
SharedRenderBuffer
create
(
void
)
{
SharedRenderBuffer
renderBuffer
(
new
RenderBuffer
(
mInternalFormat
));
renderBuffer
->
setSize
(
mWidth
,
mHeight
);
renderBuffer
->
setSize
(
mWidth
,
mHeight
,
mSamples
);
return
renderBuffer
;
}
...
...
@@ -52,6 +55,7 @@ public:
protected:
GLsizei
mWidth
;
GLsizei
mHeight
;
GLsizei
mSamples
;
GLenum
mInternalFormat
;
};
...
...
include/ACGL/OpenGL/Objects/RenderBuffer.hh
View file @
60d3caf0
...
...
@@ -30,7 +30,8 @@ public:
:
mObjectName
(
0
),
mInternalFormat
(
_internalFormat
),
mWidth
(
0
),
mHeight
(
0
)
mHeight
(
0
),
mSamples
(
0
)
{
glGenRenderbuffers
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
...
...
@@ -55,10 +56,23 @@ public:
inline
GLsizei
getWidth
(
void
)
const
{
return
mWidth
;
}
inline
GLsizei
getHeight
(
void
)
const
{
return
mHeight
;
}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
//! Get the actual number of samples
inline
int_t
getSamples
(
void
)
const
{
glBindRenderbuffer
(
GL_RENDERBUFFER
,
mObjectName
);
GLint
samples
;
glGetRenderbufferParameteriv
(
GL_RENDERBUFFER
,
GL_RENDERBUFFER_SAMPLES
,
&
samples
);
return
(
int_t
)
samples
;
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
// ===================================================================================================== \/
public:
public:
//! Bind the renderbuffer
inline
void
bind
(
void
)
const
{
...
...
@@ -68,12 +82,20 @@ public:
//! Set texture size and NULL data
inline
void
setSize
(
GLsizei
_width
,
GLsizei
_height
)
GLsizei
_height
,
GLsizei
_samples
=
0
)
{
mWidth
=
_width
;
mHeight
=
_height
;
mSamples
=
_samples
;
glBindRenderbuffer
(
GL_RENDERBUFFER
,
mObjectName
);
#if (ACGL_OPENGL_VERSION >= 30)
glRenderbufferStorageMultisample
(
GL_RENDERBUFFER
,
mSamples
,
mInternalFormat
,
mWidth
,
mHeight
);
#else
glRenderbufferStorage
(
GL_RENDERBUFFER
,
mInternalFormat
,
mWidth
,
mHeight
);
#endif // OpenGL >= 3.0
}
// =================================================================================================== \/
...
...
@@ -84,6 +106,7 @@ protected:
GLenum
mInternalFormat
;
GLsizei
mWidth
;
GLsizei
mHeight
;
GLsizei
mSamples
;
};
ACGL_SHARED_TYPEDEF
(
RenderBuffer
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment