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
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
db2b293a
Commit
db2b293a
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
d5d75bd3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
79 deletions
+70
-79
CGoGN/src/Utils/GLSLShader.cpp
CGoGN/src/Utils/GLSLShader.cpp
+37
-38
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/GLSLShader.cpp
View file @
db2b293a
...
...
@@ -39,44 +39,43 @@ namespace CGoGN
namespace
Utils
{
#ifdef CGOGN_USE_OGL_CORE_PROFILE
unsigned
int
GLSLShader
::
CURRENT_OGL_VERSION
=
3
;
unsigned
int
GLSLShader
::
MAJOR_OGL_CORE
=
3
;
unsigned
int
GLSLShader
::
MINOR_OGL_CORE
=
3
;
#else
unsigned
int
GLSLShader
::
CURRENT_OGL_VERSION
=
2
;
unsigned
int
GLSLShader
::
MAJOR_OGL_CORE
=
2
;
unsigned
int
GLSLShader
::
MINOR_OGL_CORE
=
1
;
#endif
std
::
string
GLSLShader
::
DEFINES_GL2
=
\
"#version 110
\n
"
"#define PRECISION float pipo_PRECISION
\n
"
"#define ATTRIBUTE attribute
\n
"
"#define VARYING_VERT varying
\n
"
"#define VARYING_FRAG varying
\n
"
"#define FRAG_OUT_DEF float pipo_FRAGDEF
\n
"
"#define FRAG_OUT gl_FragColor
\n
"
"#define INVARIANT_POS float pipo_INVARIANT
\n
"
"#define TEXTURE2D texture2D
\n
"
;
std
::
string
GLSLShader
::
DEFINES_GL3
=
\
"#version 330
\n
"
"#define PRECISION precision highp float
\n
"
"#define ATTRIBUTE 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
"
"#define TEXTURE2D texture
\n
"
;
std
::
string
*
GLSLShader
::
DEFINES_GL
=
NULL
;
//#ifdef CGOGN_USE_OGL_CORE_PROFILE
//unsigned int GLSLShader::CURRENT_OGL_VERSION = 3;
//unsigned int GLSLShader::MAJOR_OGL_CORE = 3;
//unsigned int GLSLShader::MINOR_OGL_CORE = 3;
//#else
//unsigned int GLSLShader::CURRENT_OGL_VERSION = 2;
//unsigned int GLSLShader::MAJOR_OGL_CORE = 2;
//unsigned int GLSLShader::MINOR_OGL_CORE = 1;
//#endif
//std::string GLSLShader::DEFINES_GL2=\
//"#version 110\n"
//"#define PRECISION float pipo_PRECISION\n"
//"#define ATTRIBUTE attribute\n"
//"#define VARYING_VERT varying\n"
//"#define VARYING_FRAG varying\n"
//"#define FRAG_OUT_DEF float pipo_FRAGDEF\n"
//"#define FRAG_OUT gl_FragColor\n"
//"#define INVARIANT_POS float pipo_INVARIANT\n"
//"#define TEXTURE2D texture2D\n";
//std::string GLSLShader::DEFINES_GL3=\
//"#version 150\n"
//"#define PRECISION precision highp float\n"
//"#define ATTRIBUTE 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"
//"#define TEXTURE2D texture\n";
//std::string* GLSLShader::DEFINES_GL = NULL;
std
::
vector
<
std
::
string
>
GLSLShader
::
m_pathes
;
...
...
CGoGN/src/Utils/Shaders/shaderColorPerVertex.cpp
View file @
db2b293a
...
...
@@ -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 @
db2b293a
...
...
@@ -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 @
db2b293a
...
...
@@ -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 @
db2b293a
...
...
@@ -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 @
db2b293a
...
...
@@ -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