Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
VR-demos
Commits
c505ddc5
Commit
c505ddc5
authored
Apr 20, 2017
by
Ruben Jesus Garcia Hernandez
Browse files
Complete move of functionality.
parent
efd3eb3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
NOMADVRLib/IsosurfacesGL.cpp
View file @
c505ddc5
...
...
@@ -349,14 +349,17 @@ return glGetError();
GLenum
SetupBlending
(
GLuint
*
vao
,
GLuint
*
vertex
,
GLuint
*
indices
)
{
GLenum
e
;
float
z
=
0.0
f
;
//(m_fNearClip + m_fFarClip) / 2.0f;
const
float
points
[]
=
{
-
1
,
-
1
,
z
,
0
,
0
,
-
1
,
1
,
z
,
0
,
1
,
1
,
1
,
z
,
1
,
1
,
1
,
-
1
,
z
,
1
,
0
};
glGenVertexArrays
(
1
,
myvao
);
glBindVertexArray
(
*
myvao
);
const
GLuint
iData
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
glGenVertexArrays
(
1
,
vao
);
glBindVertexArray
(
*
vao
);
glGenBuffers
(
1
,
vertex
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
vertex
);
glBufferData
(
GL_ARRAY_BUFFER
,
4
*
5
*
sizeof
(
GLfloat
),
points
,
GL_STATIC_DRAW
);
...
...
@@ -375,10 +378,10 @@ GLenum SetupBlending (GLuint *vao, GLuint *vertex, GLuint *indices)
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glGenBuffers
(
1
,
ind
ex
);
glGenBuffers
(
1
,
ind
ices
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
*
ind
ex
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
*
ind
ices
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
iData
),
iData
,
GL_STATIC_DRAW
);
...
...
@@ -395,12 +398,12 @@ void DeleteBlendingBuffers(GLuint *vao, GLuint *vertex, GLuint *indices)
glDeleteVertexArrays
(
1
,
vao
);
}
void
BlendTextures
(
GLuint
textures
)
void
BlendTextures
(
GLuint
*
textures
,
int
zlayers
)
{
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
for
(
int
zl
=
ZLAYERS
-
1
;
zl
>=
0
;
zl
--
)
{
for
(
int
zl
=
zlayers
-
1
;
zl
>=
0
;
zl
--
)
{
glBindTexture
(
GL_TEXTURE_2D
,
textures
[
2
+
zl
]);
glDrawElements
(
GL_TRIANGLES
,
6
,
GL_UNSIGNED_INT
,
0
);
}
...
...
NOMADVRLib/IsosurfacesGL.h
View file @
c505ddc5
...
...
@@ -30,5 +30,7 @@ bool SetupDepthPeeling(int renderWidth, int renderHeight, int zlayers, GLuint *t
void
CleanDepthTexture
(
GLuint
t
);
GLenum
EnableDepthFB
(
unsigned
int
zl
,
const
GLuint
transP
,
const
GLuint
peelingFramebuffer
,
const
GLuint
*
texture
/*[2+ZLAYERS]*/
);
void
DeleteBlendingBuffers
(
GLuint
*
vao
,
GLuint
*
vertex
,
GLuint
*
indices
);
void
BlendTextures
(
GLuint
*
textures
,
int
zlayers
);
#endif
#endif // __ISOSURFACESGL_H
OpenVR/TimestepData/hellovr_opengl_main.cpp
View file @
c505ddc5
...
...
@@ -2194,19 +2194,13 @@ void CMainApplication::RenderScene(vr::Hmd_Eye nEye)
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
dprintf
(
"Gl error after zlayer: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
for
(
int
zl
=
ZLAYERS
-
1
;
zl
>=
0
;
zl
--
)
{
glBindTexture
(
GL_TEXTURE_2D
,
m_iTexture
[
3
+
zl
]);
glDrawElements
(
GL_TRIANGLES
,
6
,
GL_UNSIGNED_INT
,
0
);
}
BlendTextures
(
m_iTexture
+
1
,
ZLAYERS
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
dprintf
(
"Gl error after zlayer: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glDeleteBuffers
(
1
,
&
testBuf
);
gl
DeleteB
uffers
(
1
,
&
indexBufferID
);
glDeleteVertexArrays
(
1
,
&
myvao
);
DeleteB
lendingBuffers
(
&
myvao
,
&
testBuf
,
&
indexBufferID
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
dprintf
(
"Gl error after zlayer: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glUseProgram
(
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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