Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
2f7b1f60
Commit
2f7b1f60
authored
Dec 01, 2011
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added getElements to AB and size caching to Buffer
parent
b946f8ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
include/ACGL/OpenGL/Objects/ArrayBuffer.hh
include/ACGL/OpenGL/Objects/ArrayBuffer.hh
+1
-3
include/ACGL/OpenGL/Objects/Buffer.hh
include/ACGL/OpenGL/Objects/Buffer.hh
+9
-4
No files found.
include/ACGL/OpenGL/Objects/ArrayBuffer.hh
View file @
2f7b1f60
...
...
@@ -259,14 +259,12 @@ public:
public:
ArrayBufferX
()
:
Buffer
(
GL_ARRAY_BUFFER
),
//mElements(0),
mStride
(
0
),
mAttributes
()
{}
ArrayBufferX
(
SharedBufferObject
_pBuffer
)
:
Buffer
(
_pBuffer
,
GL_ARRAY_BUFFER
),
//mElements(0),
mStride
(
0
),
mAttributes
()
{}
...
...
@@ -275,7 +273,7 @@ public:
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
//inline GLsizei getElements (void) const { return mElements;
}
inline
GLsizei
getElements
(
void
)
const
{
return
mSize
/
mStride
;
}
inline
GLsizei
getStride
(
void
)
const
{
return
mStride
;
}
inline
const
AttributeVec
&
getAttributes
(
void
)
const
{
return
mAttributes
;
}
...
...
include/ACGL/OpenGL/Objects/Buffer.hh
View file @
2f7b1f60
...
...
@@ -79,7 +79,7 @@ class Buffer
public:
//! Most common default: a new Buffer corresponds to a new GL resource. You might decide on a binding point
//! now or later.
Buffer
(
GLenum
_target
)
:
mTarget
(
_target
)
Buffer
(
GLenum
_target
)
:
mTarget
(
_target
)
,
mSize
(
0
)
{
mBuffer
=
SharedBufferObject
(
new
BufferObject
()
);
}
...
...
@@ -94,7 +94,8 @@ public:
*/
Buffer
(
SharedBufferObject
_pBuffer
,
GLenum
_target
)
:
mTarget
(
_target
),
mBuffer
(
_pBuffer
)
mBuffer
(
_pBuffer
),
mSize
(
0
)
{}
// ==================================================================================================== \/
...
...
@@ -130,11 +131,11 @@ private:
//! not side effect free! will bind this buffer to it's last target!
//! caching of these values on RAM could be a good idea if needed very often!
inline
GLint64
getSize
()
{
return
getParameter64
(
GL_BUFFER_SIZE
);
}
//
inline GLint64 getSize() { return getParameter64( GL_BUFFER_SIZE ); }
inline
GLint64
getMapOffset
()
{
return
getParameter64
(
GL_BUFFER_MAP_OFFSET
);
}
inline
GLint64
getMapLength
()
{
return
getParameter64
(
GL_BUFFER_MAP_LENGTH
);
}
#else // OpenGL pre 3.2:
inline
GLint
getSize
()
{
return
getParameter
(
GL_BUFFER_SIZE
);
}
//
inline GLint getSize() { return getParameter ( GL_BUFFER_SIZE ); }
inline
GLint
getMapOffset
()
{
return
getParameter
(
GL_BUFFER_MAP_OFFSET
);
}
inline
GLint
getMapLength
()
{
return
getParameter
(
GL_BUFFER_MAP_LENGTH
);
}
#endif // OpenGL >= 3.2
...
...
@@ -143,6 +144,8 @@ private:
inline
GLint
getAccessFlags
()
{
return
(
GLint
)
getParameter
(
GL_BUFFER_ACCESS_FLAGS
);
}
inline
GLboolean
isMapped
()
{
return
(
GLboolean
)
getParameter
(
GL_BUFFER_MAPPED
);
}
inline
GLint64
getSize
()
{
return
mSize
;
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
// ===================================================================================================== \/
...
...
@@ -164,6 +167,7 @@ public:
//! Set data for this buffer. Use only to init the buffer!
//! Note: The function is not const, because it changes the corresponding GPU data
inline
void
setData
(
GLenum
_target
,
GLsizeiptr
_size
,
const
GLvoid
*
_pData
=
NULL
,
GLenum
_usage
=
GL_STATIC_DRAW
)
{
mSize
=
_size
;
bind
(
_target
);
glBufferData
(
_target
,
_size
,
_pData
,
_usage
);
openGLRareError
();
...
...
@@ -289,6 +293,7 @@ public:
// =================================================================================================== \/
protected:
GLenum
mTarget
;
GLint64
mSize
;
// as this might get queried often (e.g. ArrayBuffer) we will explicitly mirror it in RAM)
SharedBufferObject
mBuffer
;
};
...
...
Write
Preview
Markdown
is supported
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