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
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
nomad-lab
VR-demos
Commits
a64b214a
Commit
a64b214a
authored
May 29, 2017
by
Ruben Garcia Hernndez
Browse files
Show bonds in unit cell as well.
parent
047843b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
CAVE/NOMADCaveT/src/main.cpp
View file @
a64b214a
...
...
@@ -125,6 +125,7 @@ GLuint BlendVAO=0, BlendBuffer=0, BlendIndices=0;
int
*
numISOIndices
=
nullptr
/*[ISOS*TIMESTEPS]*/
;
void
RenderAtoms
(
const
float
*
m
);
void
RenderAtomBonds
(
const
float
*
m
);
void
RenderUnitCell
(
const
glm
::
mat4
eyeViewProjection
);
void
RenderAtomTrajectoriesUnitCell
();
void
RenderAtomTrajectories
(
const
glm
::
mat4
eyeViewProjection
);
...
...
@@ -778,6 +779,32 @@ void sceneManager::RenderAtoms(const float *m) //m[16]
//eprintf ("RenderAtoms, end");
}
// render atoms
void
sceneManager
::
RenderAtomBonds
(
const
float
*
t
)
{
GLenum
e
;
if
(
numBonds
)
{
glBindVertexArray
(
AtomTVAO
[
2
]);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds glBindVertexArray timestep =%d: %d, %s
\n
"
,
m_oldTime
,
e
,
gluErrorString
(
e
));
glUseProgram
(
UnitCellP
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds glUseProgram timestep =%d: %d, %s
\n
"
,
m_oldTime
,
e
,
gluErrorString
(
e
));
glUniformMatrix4fv
(
UnitCellMatrixLoc
,
1
,
GL_FALSE
,
t
);
float
color
[
4
]
=
{
0.5
,
0.5
,
1
,
1
};
glUniform4fv
(
UnitCellColourLoc
,
1
,
color
);
if
(
m_oldTime
==
0
||
fixedAtoms
)
glDrawElements
(
GL_LINES
,
numBonds
[
0
],
GL_UNSIGNED_INT
,
(
void
*
)
0
);
else
glDrawElements
(
GL_LINES
,
numBonds
[
m_oldTime
]
-
numBonds
[
m_oldTime
-
1
],
GL_UNSIGNED_INT
,
(
void
*
)(
sizeof
(
int
)
*
numBonds
[
m_oldTime
-
1
])
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds timestep =%d: %d, %s
\n
"
,
m_oldTime
,
e
,
gluErrorString
(
e
));
}
glBindVertexArray
(
0
);
}
void
sceneManager
::
RenderAtomTrajectories
(
const
glm
::
mat4
eyeViewProjection
)
{
int
e
;
...
...
@@ -804,27 +831,7 @@ RenderAtomTrajectoriesUnitCell();
RenderAtoms
(
t
);
//now bonds
//return;
if
(
numBonds
)
{
glBindVertexArray
(
AtomTVAO
[
2
]);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds glBindVertexArray timestep =%d: %d, %s
\n
"
,
m_oldTime
,
e
,
gluErrorString
(
e
));
glUseProgram
(
UnitCellP
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds glUseProgram timestep =%d: %d, %s
\n
"
,
m_oldTime
,
e
,
gluErrorString
(
e
));
glUniformMatrix4fv
(
UnitCellMatrixLoc
,
1
,
GL_FALSE
,
t
);
float
color
[
4
]
=
{
0.5
,
0.5
,
1
,
1
};
glUniform4fv
(
UnitCellColourLoc
,
1
,
color
);
if
(
m_oldTime
==
0
||
fixedAtoms
)
glDrawElements
(
GL_LINES
,
numBonds
[
0
],
GL_UNSIGNED_INT
,
(
void
*
)
0
);
else
glDrawElements
(
GL_LINES
,
numBonds
[
m_oldTime
]
-
numBonds
[
m_oldTime
-
1
],
GL_UNSIGNED_INT
,
(
void
*
)(
sizeof
(
int
)
*
numBonds
[
m_oldTime
-
1
])
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds timestep =%d: %d, %s
\n
"
,
m_oldTime
,
e
,
gluErrorString
(
e
));
}
glBindVertexArray
(
0
);
RenderAtomBonds
(
t
);
}
//RenderAtomTrajectories
...
...
@@ -997,5 +1004,7 @@ void sceneManager::RenderUnitCell(const glm::mat4 eyeViewProjection)
//rgh: disable for now
RenderAtomTrajectoriesUnitCell
();
RenderAtoms
(
t
);
RenderAtomBonds
(
t
);
}
}
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