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
Etienne Schmitt
CGoGN
Commits
8cb0d143
Commit
8cb0d143
authored
Nov 17, 2014
by
sylvain thery
Browse files
GLbug on intel HD4400
parent
329e575f
Changes
2
Hide whitespace changes
Inline
Side-by-side
SCHNApps/Plugins/surface_render/src/surface_render.cpp
View file @
8cb0d143
...
...
@@ -73,7 +73,32 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
const
MapParameters
&
p
=
h_viewParameterSet
[
view
][
map
];
if
(
p
.
positionVBO
)
{
if
(
p
.
renderVertices
)
if
(
p
.
renderFaces
)
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
switch
(
p
.
faceStyle
)
{
case
MapParameters
::
FLAT
:
m_flatShader
->
setAttributePosition
(
p
.
positionVBO
);
m_flatShader
->
setDiffuse
(
p
.
diffuseColor
);
map
->
draw
(
m_flatShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
break
;
case
MapParameters
::
PHONG
:
if
(
p
.
normalVBO
!=
NULL
)
{
m_phongShader
->
setAttributePosition
(
p
.
positionVBO
);
m_phongShader
->
setAttributeNormal
(
p
.
normalVBO
);
m_phongShader
->
setDiffuse
(
p
.
diffuseColor
);
map
->
draw
(
m_phongShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
break
;
}
glDisable
(
GL_POLYGON_OFFSET_FILL
);
}
if
(
p
.
renderVertices
)
{
m_pointSprite
->
setSize
(
map
->
getBBdiagSize
()
/
200.0
f
*
p
.
verticesScaleFactor
);
m_pointSprite
->
setAttributePosition
(
p
.
positionVBO
);
...
...
@@ -89,31 +114,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
m_simpleColorShader
->
setColor
(
p
.
simpleColor
);
map
->
draw
(
m_simpleColorShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
LINES
);
}
if
(
p
.
renderFaces
)
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
switch
(
p
.
faceStyle
)
{
case
MapParameters
::
FLAT
:
m_flatShader
->
setAttributePosition
(
p
.
positionVBO
);
m_flatShader
->
setDiffuse
(
p
.
diffuseColor
);
map
->
draw
(
m_flatShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
break
;
case
MapParameters
::
PHONG
:
if
(
p
.
normalVBO
!=
NULL
)
{
m_phongShader
->
setAttributePosition
(
p
.
positionVBO
);
m_phongShader
->
setAttributeNormal
(
p
.
normalVBO
);
m_phongShader
->
setDiffuse
(
p
.
diffuseColor
);
map
->
draw
(
m_phongShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
break
;
}
glDisable
(
GL_POLYGON_OFFSET_FILL
);
}
if
(
p
.
renderBoundary
)
{
glLineWidth
(
5.0
f
);
...
...
src/Utils/GLSLShader.cpp
View file @
8cb0d143
...
...
@@ -65,8 +65,8 @@ std::string GLSLShader::DEFINES_GL3=\
"#version 150
\n
"
"#define PRECISON precision highp float
\n
"
"#define ATTRIBUTE in
\n
"
"#define VARYING_VERT
smooth
out
\n
"
"#define VARYING_FRAG
smooth
in
\n
"
"#define VARYING_VERT out
\n
"
"#define VARYING_FRAG in
\n
"
"#define FRAG_OUT_DEF out vec4 outFragColor
\n
"
"#define FRAG_OUT outFragColor
\n
"
"#define INVARIANT_POS invariant gl_Position
\n
"
;
...
...
@@ -134,8 +134,8 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std:
ss
<<
maxVert
;
str
.
append
(
ss
.
str
());
str
.
append
(
") out;
\n
"
);
str
.
append
(
"#define VARYING_IN
smooth
in
\n
"
);
str
.
append
(
"#define VARYING_OUT
smooth
out
\n
"
);
str
.
append
(
"#define VARYING_IN in
\n
"
);
str
.
append
(
"#define VARYING_OUT out
\n
"
);
str
.
append
(
"#define POSITION_IN(X) gl_in[X].gl_Position
\n
"
);
str
.
append
(
"#define NBVERTS_IN gl_in.length()
\n
"
);
return
str
;
...
...
@@ -1177,9 +1177,9 @@ void GLSLShader::enableVertexAttribs(unsigned int stride, unsigned int begin)
if
(
CURRENT_OGL_VERSION
>=
3
)
{
if
(
m_vao
!=
0
)
glDeleteVertexArrays
(
1
,
&
m_vao
);
glGenVertexArrays
(
1
,
&
m_vao
);
if
(
m_vao
!=
0
)
glDeleteVertexArrays
(
1
,
&
m_vao
);
glGenVertexArrays
(
1
,
&
m_vao
);
glBindVertexArray
(
m_vao
);
for
(
std
::
vector
<
Utils
::
GLSLShader
::
VAStr
>::
const_iterator
it
=
m_va_vbo_binding
.
begin
();
it
!=
m_va_vbo_binding
.
end
();
++
it
)
...
...
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