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
V
VR-demos
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
nomad-lab
VR-demos
Commits
efd3eb3b
Commit
efd3eb3b
authored
Apr 20, 2017
by
Ruben Jesus Garcia Hernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Blending of zlayers functionality copied to NOMADVRLib
parent
f6f85797
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
3 deletions
+62
-3
NOMADVRLib/IsoShaders.cpp
NOMADVRLib/IsoShaders.cpp
+3
-3
NOMADVRLib/IsosurfacesGL.cpp
NOMADVRLib/IsosurfacesGL.cpp
+59
-0
No files found.
NOMADVRLib/IsoShaders.cpp
View file @
efd3eb3b
...
...
@@ -102,7 +102,7 @@ const char *const IsoTransparentShaders [] = {"Iso Transparent Renderer",
nullptr
};
const
char
*
const
IsoBlendShaders
[]
=
{
const
char
*
const
IsoBlendShaders
[]
=
{
"Iso Transparent Blend"
,
// vertex shader
#if defined(WIN32) || defined(CAVE)
"#version 410 core
\n
"
...
...
@@ -110,13 +110,13 @@ const char *const IsoBlendShaders [] = {
"#version 300 es
\n
"
#endif
"uniform mat4 matrix;
\n
"
"layout(location = 0) in vec
4
position;
\n
"
"layout(location = 0) in vec
3
position;
\n
"
"layout(location = 1) in vec2 v2TexCoordsIn;
\n
"
"out vec2 v2TexCoord;
\n
"
"void main()
\n
"
"{
\n
"
" v2TexCoord = v2TexCoordsIn;
\n
"
" gl_Position = matrix * vec4(position
.xyz
, 1);
\n
"
" gl_Position = matrix * vec4(position, 1);
\n
"
"}
\n
"
,
//fragment shader
"#version 410 core
\n
"
...
...
NOMADVRLib/IsosurfacesGL.cpp
View file @
efd3eb3b
...
...
@@ -346,4 +346,63 @@ glDepthMask(GL_TRUE);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
return
glGetError
();
}
GLenum
SetupBlending
(
GLuint
*
vao
,
GLuint
*
vertex
,
GLuint
*
indices
)
{
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
);
glGenBuffers
(
1
,
vertex
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
vertex
);
glBufferData
(
GL_ARRAY_BUFFER
,
4
*
5
*
sizeof
(
GLfloat
),
points
,
GL_STATIC_DRAW
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after glBufferData: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glEnableVertexAttribArray
(
0
);
glEnableVertexAttribArray
(
1
);
glDisableVertexAttribArray
(
2
);
glDisableVertexAttribArray
(
3
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glVertexAttribPointer
(
0
,
3
,
GL_FLOAT
,
GL_FALSE
,
5
*
sizeof
(
float
),
(
void
*
)
0
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glVertexAttribPointer
(
1
,
2
,
GL_FLOAT
,
GL_FALSE
,
5
*
sizeof
(
float
),
(
void
*
)(
3
*
sizeof
(
float
)));
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glGenBuffers
(
1
,
index
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
*
index
);
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
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error: %d, %s, l %d
\n
"
,
e
,
gluErrorString
(
e
),
__LINE__
);
return
e
;
}
void
DeleteBlendingBuffers
(
GLuint
*
vao
,
GLuint
*
vertex
,
GLuint
*
indices
)
{
glDeleteBuffers
(
1
,
vertex
);
glDeleteBuffers
(
1
,
indices
);
glDeleteVertexArrays
(
1
,
vao
);
}
void
BlendTextures
(
GLuint
textures
)
{
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
for
(
int
zl
=
ZLAYERS
-
1
;
zl
>=
0
;
zl
--
)
{
glBindTexture
(
GL_TEXTURE_2D
,
textures
[
2
+
zl
]);
glDrawElements
(
GL_TRIANGLES
,
6
,
GL_UNSIGNED_INT
,
0
);
}
}
#endif
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