Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CGoGN
CGoGN
Commits
80b5546f
Commit
80b5546f
authored
Mar 17, 2015
by
Sylvain Thery
Committed by
Pierre Kraemer
Apr 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
less static in GLSLShader & support mac retina
parent
27f058aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
41 deletions
+33
-41
CGoGN/src/Utils/Shaders/shaderColorPerVertex.cpp
CGoGN/src/Utils/Shaders/shaderColorPerVertex.cpp
+4
-4
CGoGN/src/Utils/Shaders/shaderPhong.cpp
CGoGN/src/Utils/Shaders/shaderPhong.cpp
+12
-25
CGoGN/src/Utils/Shaders/shaderSimpleColor.cpp
CGoGN/src/Utils/Shaders/shaderSimpleColor.cpp
+4
-4
CGoGN/src/Utils/Shaders/shaderSimpleFlat.cpp
CGoGN/src/Utils/Shaders/shaderSimpleFlat.cpp
+11
-7
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+2
-1
No files found.
CGoGN/src/Utils/Shaders/shaderColorPerVertex.cpp
View file @
80b5546f
...
...
@@ -44,10 +44,10 @@ ShaderColorPerVertex::ShaderColorPerVertex(bool withClipping, bool black_is_tran
m_nameFS
=
"ShaderColorPerVertexClip_fs"
;
m_nameGS
=
""
;
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxvert
(
GLSLShader
::
defines_gl
()
);
glxvert
.
append
(
vertexShaderClipText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
()
);
if
(
black_is_transparent
)
glxfrag
.
append
(
"#define BLACK_TRANSPARENCY 1
\n
"
);
glxfrag
.
append
(
fragmentShaderClipText
);
...
...
@@ -64,10 +64,10 @@ ShaderColorPerVertex::ShaderColorPerVertex(bool withClipping, bool black_is_tran
m_nameFS
=
"ShaderColorPerVertex_fs"
;
m_nameGS
=
"ShaderColorPerVertex_gs"
;
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxvert
(
GLSLShader
::
defines_gl
()
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
()
);
if
(
black_is_transparent
)
glxfrag
.
append
(
"#define BLACK_TRANSPARENCY 1
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
...
...
CGoGN/src/Utils/Shaders/shaderPhong.cpp
View file @
80b5546f
...
...
@@ -21,6 +21,7 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#define CGoGN_UTILS_DLL_EXPORT 1
#include <GL/glew.h>
#include "Utils/Shaders/shaderPhong.h"
...
...
@@ -36,7 +37,6 @@ namespace Utils
#include "shaderPhongClip.vert"
#include "shaderPhongClip.frag"
ShaderPhong
::
ShaderPhong
(
bool
withClipping
,
bool
doubleSided
,
bool
withEyePosition
)
:
m_with_color
(
false
),
m_with_eyepos
(
withEyePosition
),
...
...
@@ -54,30 +54,17 @@ ShaderPhong::ShaderPhong(bool withClipping, bool doubleSided, bool withEyePositi
std
::
string
glxvert
(
GLSLShader
::
defines_gl
());
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
());
if
(
withClipping
)
{
m_nameVS
=
"ShaderPhongClip_vs"
;
m_nameFS
=
"ShaderPhongClip_fs"
;
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderClipText
);
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderClipText
);
}
else
{
m_nameVS
=
"ShaderPhong_vs"
;
m_nameFS
=
"ShaderPhong_fs"
;
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderText
);
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
}
// get choose GL defines (2 or 3)
// ans compile shaders
std
::
string
glxvert
(
GLSLShader
::
defines_gl
());
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
());
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
CGoGN/src/Utils/Shaders/shaderSimpleColor.cpp
View file @
80b5546f
...
...
@@ -46,10 +46,10 @@ ShaderSimpleColor::ShaderSimpleColor(bool withClipping, bool black_is_transparen
// chose GL defines (2 or 3)
// and compile shaders
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxvert
(
GLSLShader
::
defines_gl
()
);
glxvert
.
append
(
vertexShaderClipText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
()
);
if
(
black_is_transparent
)
glxfrag
.
append
(
"#define BLACK_TRANSPARENCY 1
\n
"
);
glxfrag
.
append
(
fragmentShaderClipText
);
...
...
@@ -67,10 +67,10 @@ ShaderSimpleColor::ShaderSimpleColor(bool withClipping, bool black_is_transparen
// chose GL defines (2 or 3)
// and compile shaders
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxvert
(
GLSLShader
::
defines_gl
()
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
()
);
if
(
black_is_transparent
)
glxfrag
.
append
(
"#define BLACK_TRANSPARENCY 1
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
...
...
CGoGN/src/Utils/Shaders/shaderSimpleFlat.cpp
View file @
80b5546f
...
...
@@ -21,6 +21,7 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#define CGoGN_UTILS_DLL_EXPORT 1
#include <GL/glew.h>
#include "Utils/Shaders/shaderSimpleFlat.h"
...
...
@@ -36,8 +37,6 @@ namespace Utils
#include "shaderSimpleFlatClip.vert"
#include "shaderSimpleFlatClip.frag"
ShaderSimpleFlat
::
ShaderSimpleFlat
(
bool
withClipping
,
bool
doubleSided
)
:
m_with_color
(
false
),
m_ambiant
(
Geom
::
Vec4f
(
0.05
f
,
0.05
f
,
0.1
f
,
0.0
f
)),
...
...
@@ -48,8 +47,18 @@ ShaderSimpleFlat::ShaderSimpleFlat(bool withClipping, bool doubleSided):
m_vboColor
(
NULL
),
m_planeClip
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
))
{
m_nameVS
=
"ShaderSimpleFlat_vs"
;
m_nameFS
=
"ShaderSimpleFlat_fs"
;
// m_nameGS = "ShaderSimpleFlat_gs";
// get choose GL defines (2 or 3)
// ans compile shaders
std
::
string
glxvert
(
GLSLShader
::
defines_gl
());
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
());
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
if
(
withClipping
)
{
...
...
@@ -117,7 +126,6 @@ void ShaderSimpleFlat::setDiffuse(const Geom::Vec4f& diffuse)
unbind
();
}
void
ShaderSimpleFlat
::
setLightPosition
(
const
Geom
::
Vec3f
&
lightPos
)
{
bind
();
...
...
@@ -126,7 +134,6 @@ void ShaderSimpleFlat::setLightPosition(const Geom::Vec3f& lightPos)
unbind
();
}
void
ShaderSimpleFlat
::
setBackColor
(
const
Geom
::
Vec4f
&
back
)
{
bind
();
...
...
@@ -135,7 +142,6 @@ void ShaderSimpleFlat::setBackColor(const Geom::Vec4f& back)
unbind
();
}
void
ShaderSimpleFlat
::
setParams
(
const
Geom
::
Vec4f
&
ambiant
,
const
Geom
::
Vec4f
&
diffuse
,
const
Geom
::
Vec3f
&
lightPos
)
{
m_ambiant
=
ambiant
;
...
...
@@ -225,8 +231,6 @@ void ShaderSimpleFlat::setClippingPlane(const Geom::Vec4f& plane)
}
}
}
// namespace Utils
}
// namespace CGoGN
SCHNApps/src/view.cpp
View file @
80b5546f
...
...
@@ -13,7 +13,7 @@
#include <QKeyEvent>
#include <QMouseEvent>
#include <QWheelEvent>
#include <Q
MessageBox
>
#include <Q
Window
>
namespace
CGoGN
{
...
...
@@ -337,6 +337,7 @@ void View::init()
m_buttonArea
=
new
ViewButtonArea
(
this
);
m_buttonArea
->
setTopRightPosition
(
this
->
width
(),
0
);
std
::
cout
<<
this
->
width
()
<<
std
::
endl
;
m_VsplitButton
=
new
ViewButton
(
":icons/icons/Vsplit.png"
,
this
);
m_buttonArea
->
addButton
(
m_VsplitButton
);
connect
(
m_VsplitButton
,
SIGNAL
(
clicked
(
int
,
int
,
int
,
int
)),
this
,
SLOT
(
ui_verticalSplitView
(
int
,
int
,
int
,
int
)));
...
...
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