Skip to content

Commit

Permalink
GLSupport: range loop refactoring (#2968)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joilnen authored Nov 15, 2023
1 parent 1a1d1c2 commit bfda481
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
19 changes: 7 additions & 12 deletions RenderSystems/GLSupport/src/EGL/OgreEGLSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,10 @@ namespace Ogre {

void load(EGLSupport* const glSupport, EGLConfig glConfig)
{
std::map<int,int>::iterator it;

for (it = fields.begin(); it != fields.end(); it++)
for (auto& f : fields)
{
it->second = EGL_NONE;

glSupport->getGLConfigAttrib(glConfig, it->first, &it->second);
f.second = EGL_NONE;
glSupport->getGLConfigAttrib(glConfig, f.first, &f.second);
}
}

Expand All @@ -237,12 +234,10 @@ namespace Ogre {
}
}

std::map<int,int>::iterator it;

for (it = fields.begin(); it != fields.end(); it++)
for (auto& f : fields)
{
if (it->first != EGL_CONFIG_CAVEAT &&
fields[it->first] > alternative.fields[it->first])
if (f.first != EGL_CONFIG_CAVEAT &&
fields[f.first] > alternative.fields[f.first])
{
return true;
}
Expand Down Expand Up @@ -312,7 +307,7 @@ namespace Ogre {

::EGLContext EGLSupport::createNewContext(EGLDisplay eglDisplay,
::EGLConfig glconfig,
::EGLContext shareList) const
::EGLContext shareList) const
{
EGLint contextAttrs[] = {
EGL_CONTEXT_MAJOR_VERSION, 3,
Expand Down
16 changes: 3 additions & 13 deletions RenderSystems/GLSupport/src/OgreGLVertexArrayObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Ogre {
rs->_destroyVao(mCreatorContext, mVAO);
}
}

void GLVertexArrayObject::bind(GLRenderSystemCommon* rs)
{
if(mCreatorContext && mCreatorContext != rs->_getCurrentContext()) // VAO is unusable with current context, destroy it
Expand All @@ -69,13 +69,8 @@ namespace Ogre {
if(mNeedsUpdate)
return true;

VertexDeclaration::VertexElementList::const_iterator elemIter, elemEnd;
elemEnd = mElementList.end();

for (elemIter = mElementList.begin(); elemIter != elemEnd; ++elemIter)
for (const auto& elem : mElementList)
{
const VertexElement & elem = *elemIter;

uint16 source = elem.getSource();

if (!vertexBufferBinding->isBufferBound(source))
Expand Down Expand Up @@ -111,13 +106,8 @@ namespace Ogre {
mAttribsBound.clear();
mInstanceAttribsBound.clear();

VertexDeclaration::VertexElementList::const_iterator elemIter, elemEnd;
elemEnd = mElementList.end();

for (elemIter = mElementList.begin(); elemIter != elemEnd; ++elemIter)
for (const auto& elem : mElementList)
{
const VertexElement& elem = *elemIter;

uint16 source = elem.getSource();

if (!vertexBufferBinding->isBufferBound(source))
Expand Down

0 comments on commit bfda481

Please sign in to comment.