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
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
Etienne Schmitt
CGoGN
Commits
bab67f6f
Commit
bab67f6f
authored
Sep 26, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rendering modification for support of VRJuggler (use multi context option)
parent
44a7a94f
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
492 additions
and
436 deletions
+492
-436
CMakeLists.txt
CMakeLists.txt
+15
-0
Release/CMakeLists.txt
Release/CMakeLists.txt
+1
-1
include/Utils/GLSLShader.h
include/Utils/GLSLShader.h
+17
-12
include/Utils/Shaders/shaderExplodeVolumes.h
include/Utils/Shaders/shaderExplodeVolumes.h
+6
-6
include/Utils/Shaders/shaderExplodeVolumesLines.h
include/Utils/Shaders/shaderExplodeVolumesLines.h
+3
-3
include/Utils/Shaders/shaderFlat.h
include/Utils/Shaders/shaderFlat.h
+4
-4
include/Utils/Shaders/shaderFlatColor.h
include/Utils/Shaders/shaderFlatColor.h
+3
-3
include/Utils/Shaders/shaderPhong.h
include/Utils/Shaders/shaderPhong.h
+5
-5
include/Utils/Shaders/shaderSimpleColor.h
include/Utils/Shaders/shaderSimpleColor.h
+1
-1
include/Utils/Shaders/shaderSimpleTexture.h
include/Utils/Shaders/shaderSimpleTexture.h
+1
-1
include/Utils/Shaders/shaderTextureMask.h
include/Utils/Shaders/shaderTextureMask.h
+2
-2
include/Utils/Shaders/shaderVectorPerVertex.h
include/Utils/Shaders/shaderVectorPerVertex.h
+2
-2
include/Utils/gl_def.h
include/Utils/gl_def.h
+68
-0
include/Utils/pickables.h
include/Utils/pickables.h
+1
-1
include/Utils/pointSprite.h
include/Utils/pointSprite.h
+8
-6
include/Utils/text3d.h
include/Utils/text3d.h
+7
-5
include/Utils/textures.h
include/Utils/textures.h
+2
-1
include/Utils/textures.hpp
include/Utils/textures.hpp
+7
-7
include/Utils/vbo.h
include/Utils/vbo.h
+5
-4
include/Utils/vbo.hpp
include/Utils/vbo.hpp
+3
-3
src/Algo/Render/mapRender.cpp
src/Algo/Render/mapRender.cpp
+4
-4
src/Utils/GLSLShader.cpp
src/Utils/GLSLShader.cpp
+157
-123
src/Utils/Shaders/shaderExplodeVolumes.cpp
src/Utils/Shaders/shaderExplodeVolumes.cpp
+30
-30
src/Utils/Shaders/shaderExplodeVolumesLines.cpp
src/Utils/Shaders/shaderExplodeVolumesLines.cpp
+15
-15
src/Utils/Shaders/shaderFlat.cpp
src/Utils/Shaders/shaderFlat.cpp
+20
-68
src/Utils/Shaders/shaderFlatColor.cpp
src/Utils/Shaders/shaderFlatColor.cpp
+15
-15
src/Utils/Shaders/shaderPhong.cpp
src/Utils/Shaders/shaderPhong.cpp
+15
-15
src/Utils/Shaders/shaderSimpleColor.cpp
src/Utils/Shaders/shaderSimpleColor.cpp
+4
-4
src/Utils/Shaders/shaderSimpleTexture.cpp
src/Utils/Shaders/shaderSimpleTexture.cpp
+2
-2
src/Utils/Shaders/shaderTextureMask.cpp
src/Utils/Shaders/shaderTextureMask.cpp
+4
-4
src/Utils/Shaders/shaderVectorPerVertex.cpp
src/Utils/Shaders/shaderVectorPerVertex.cpp
+6
-41
src/Utils/pickables.cpp
src/Utils/pickables.cpp
+9
-9
src/Utils/pointSprite.cpp
src/Utils/pointSprite.cpp
+22
-15
src/Utils/text3d.cpp
src/Utils/text3d.cpp
+20
-16
src/Utils/vbo.cpp
src/Utils/vbo.cpp
+8
-8
No files found.
CMakeLists.txt
View file @
bab67f6f
...
...
@@ -19,6 +19,8 @@ SET ( WITH_NUMERICAL ON CACHE BOOL "build CGoGN with Numerical libs support ")
SET
(
FORCE_MR
"0"
CACHE STRING
"0: normal mode / 1 multires mode"
)
#create one big lib
SET
(
ONELIB OFF CACHE BOOL
"build CGoGN in one lib"
)
SET
(
WITH_GLEWMX OFF CACHE BOOL
"use multi-contex GLEW"
)
IF
(
WIN32
)
set
(
CMAKE_PREFIX_PATH
${
CGoGN_ROOT_DIR
}
/windows_dependencies CACHE STRING
"path to dependencies"
)
...
...
@@ -54,6 +56,15 @@ ELSE (ONELIB)
file
(
WRITE
${
CGoGN_ROOT_DIR
}
/include/cgogn_onelib.h
"0"
)
ENDIF
(
ONELIB
)
IF
(
WITH_GLEWMX
)
file
(
WRITE
${
CGoGN_ROOT_DIR
}
/include/cgogn_gmx.h
"1"
)
ELSE
(
WITH_GLEWMX
)
file
(
WRITE
${
CGoGN_ROOT_DIR
}
/include/cgogn_gmx.h
"0"
)
ENDIF
(
WITH_GLEWMX
)
add_definitions
(
-DSHADERPATH=
"
${
CGoGN_ROOT_DIR
}
/lib/Shaders/"
)
# define includes of external libs
...
...
@@ -100,6 +111,10 @@ IF (WITH_QT)
SET
(
CGoGN_EXT_LIBS
${
CGoGN_EXT_LIBS
}
${
QT_LIBRARIES
}
)
ENDIF
(
WITH_QT
)
IF
(
WITH_GLEWMX
)
ADD_DEFINITIONS
(
-DGLEW_MX
)
ENDIF
(
WITH_GLEWMX
)
#IF (WITH_NUMERICAL)
# add_definitions(-DWITH_NUMERICAL)
# SET (CGoGN_NUMERICAL_INCLUDES ${CGoGN_ROOT_DIR}/ThirdParty/Numerical ${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig)
...
...
Release/CMakeLists.txt
View file @
bab67f6f
...
...
@@ -8,7 +8,7 @@ IF(WIN32)
SET
(
LIBRARY_OUTPUT_PATH
${
CGoGN_ROOT_DIR
}
/lib
)
ELSE
(
WIN32
)
SET
(
LIBRARY_OUTPUT_PATH
${
CGoGN_ROOT_DIR
}
/lib/Release
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNOTOPOWARNING"
)
ADD_DEFINITIONS
(
-DNOTOPOWARNING
)
ENDIF
(
WIN32
)
include_directories
(
...
...
include/Utils/GLSLShader.h
View file @
bab67f6f
...
...
@@ -29,6 +29,7 @@
#ifndef __CGoGN_GLSL_SHADER__
#define __CGoGN_GLSL_SHADER__
#include "Utils/gl_def.h"
#include "Utils/os_spec.h"
#include "Utils/vbo.h"
#include "Utils/gl_matrices.h"
...
...
@@ -41,6 +42,7 @@
#include <vector>
#include <set>
namespace
CGoGN
{
...
...
@@ -80,17 +82,17 @@ protected:
/**
* handle of vertex shader
*/
GLhandleARB
m_vertex_shader_object
;
CGoGN
GLhandleARB
m_vertex_shader_object
;
/**
* handle of fragment shader
*/
GLhandleARB
m_fragment_shader_object
;
CGoGN
GLhandleARB
m_fragment_shader_object
;
/**
* handle of geometry shader
*/
GLhandleARB
m_geom_shader_object
;
CGoGN
GLhandleARB
m_geom_shader_object
;
std
::
string
m_nameVS
;
std
::
string
m_nameFS
;
...
...
@@ -99,12 +101,12 @@ protected:
/**
* handle of program
*/
GLhandleARB
m_program_object
;
CGoGN
GLhandleARB
m_program_object
;
GLint
m_uniMat_Proj
;
GLint
m_uniMat_Model
;
GLint
m_uniMat_ModelProj
;
GLint
m_uniMat_Normal
;
CGoGN
GLint
m_uniMat_Proj
;
CGoGN
GLint
m_uniMat_Model
;
CGoGN
GLint
m_uniMat_ModelProj
;
CGoGN
GLint
m_uniMat_Normal
;
char
*
m_vertex_shader_source
;
char
*
m_fragment_shader_source
;
...
...
@@ -296,7 +298,7 @@ public:
/**
* get handler of program for external use og gl functions
*/
GL
uint
program_handler
()
{
return
m_program_object
;}
GL
handleARB
program_handler
()
{
return
*
m_program_object
;}
/**
* check shader validity width official GLSL syntax
...
...
@@ -379,6 +381,9 @@ public:
*/
void
disableVertexAttribs
()
const
;
/// get back OpenGL standard matrices & send to all shaders
static
void
updateAllFromGLMatrices
();
/// sent current matrices to all shaders
static
void
updateCurrentMatrices
();
/// get current transformation matrix
...
...
@@ -400,13 +405,13 @@ public:
inline
bool
GLSLShader
::
isCreated
()
{
return
(
m_program_object
!=
0
);
return
(
*
m_program_object
!=
0
);
}
template
<
unsigned
int
NB
>
void
GLSLShader
::
setuniformf
(
const
char
*
name
,
const
float
*
val
)
{
GLint
uni
=
glGetUniformLocationARB
(
m_program_object
,
name
);
GLint
uni
=
glGetUniformLocationARB
(
*
m_program_object
,
name
);
if
(
uni
>=
0
)
{
switch
(
NB
)
...
...
@@ -433,7 +438,7 @@ void GLSLShader::setuniformf( const char* name, const float* val)
template
<
unsigned
int
NB
>
void
GLSLShader
::
setuniformi
(
const
char
*
name
,
const
int
*
val
)
{
GLint
uni
=
glGetUniformLocationARB
(
m_program_object
,
name
);
GLint
uni
=
glGetUniformLocationARB
(
*
m_program_object
,
name
);
if
(
uni
>=
0
)
{
switch
(
NB
)
...
...
include/Utils/Shaders/shaderExplodeVolumes.h
View file @
bab67f6f
...
...
@@ -43,12 +43,12 @@ protected:
static
std
::
string
geometryShaderText
;
// uniform locations
GLuint
m_unif_ambiant
;
GLuint
m_unif_backColor
;
GLuint
m_unif_lightPos
;
GLuint
m_unif_explodeV
;
GLuint
m_unif_explodeF
;
GLuint
m_unif_plane
;
CGoGN
GLuint
m_unif_ambiant
;
CGoGN
GLuint
m_unif_backColor
;
CGoGN
GLuint
m_unif_lightPos
;
CGoGN
GLuint
m_unif_explodeV
;
CGoGN
GLuint
m_unif_explodeF
;
CGoGN
GLuint
m_unif_plane
;
// local storage for uniforms
float
m_explodeV
;
...
...
include/Utils/Shaders/shaderExplodeVolumesLines.h
View file @
bab67f6f
...
...
@@ -43,9 +43,9 @@ protected:
static
std
::
string
geometryShaderText
;
// uniform locations
GLuint
m_unif_color
;
GLuint
m_unif_explodeV
;
GLuint
m_unif_plane
;
CGoGN
GLuint
m_unif_color
;
CGoGN
GLuint
m_unif_explodeV
;
CGoGN
GLuint
m_unif_plane
;
float
m_explodeV
;
Geom
::
Vec4f
m_color
;
...
...
include/Utils/Shaders/shaderFlat.h
View file @
bab67f6f
...
...
@@ -43,10 +43,10 @@ protected:
static
std
::
string
geometryShaderText
;
// uniform locations
GLuint
m_unif_ambiant
;
GLuint
m_unif_diffuse
;
GLuint
m_unif_lightPos
;
GLuint
m_unif_explode
;
CGoGN
GLuint
m_unif_ambiant
;
CGoGN
GLuint
m_unif_diffuse
;
CGoGN
GLuint
m_unif_lightPos
;
CGoGN
GLuint
m_unif_explode
;
float
m_explode
;
Geom
::
Vec4f
m_ambiant
;
...
...
include/Utils/Shaders/shaderFlatColor.h
View file @
bab67f6f
...
...
@@ -43,9 +43,9 @@ protected:
static
std
::
string
geometryShaderText
;
// uniform locations
GLuint
m_unif_ambiant
;
GLuint
m_unif_lightPos
;
GLuint
m_unif_explode
;
CGoGN
GLuint
m_unif_ambiant
;
CGoGN
GLuint
m_unif_lightPos
;
CGoGN
GLuint
m_unif_explode
;
float
m_explode
;
Geom
::
Vec4f
m_ambiant
;
...
...
include/Utils/Shaders/shaderPhong.h
View file @
bab67f6f
...
...
@@ -48,11 +48,11 @@ protected:
static
std
::
string
fragmentShaderText
;
// uniform locations
GLuint
m_unif_ambiant
;
GLuint
m_unif_diffuse
;
GLuint
m_unif_specular
;
GLuint
m_unif_shininess
;
GLuint
m_unif_lightPos
;
CGoGN
GLuint
m_unif_ambiant
;
CGoGN
GLuint
m_unif_diffuse
;
CGoGN
GLuint
m_unif_specular
;
CGoGN
GLuint
m_unif_shininess
;
CGoGN
GLuint
m_unif_lightPos
;
//values
Geom
::
Vec4f
m_ambiant
;
...
...
include/Utils/Shaders/shaderSimpleColor.h
View file @
bab67f6f
...
...
@@ -43,7 +43,7 @@ protected:
static
std
::
string
fragmentShaderText
;
// uniform locations
GLuint
m_unif_color
;
CGoGN
GLuint
m_unif_color
;
Geom
::
Vec4f
m_color
;
...
...
include/Utils/Shaders/shaderSimpleTexture.h
View file @
bab67f6f
...
...
@@ -44,7 +44,7 @@ protected:
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
GLuint
m_unif_unit
;
CGoGN
GLuint
m_unif_unit
;
int
m_unit
;
...
...
include/Utils/Shaders/shaderTextureMask.h
View file @
bab67f6f
...
...
@@ -44,9 +44,9 @@ protected:
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
GLuint
m_unif_unit
;
CGoGN
GLuint
m_unif_unit
;
int
m_unit
;
GLuint
m_unif_unitMask
;
CGoGN
GLuint
m_unif_unitMask
;
int
m_unitMask
;
Utils
::
GTexture
*
m_tex_ptr
;
...
...
include/Utils/Shaders/shaderVectorPerVertex.h
View file @
bab67f6f
...
...
@@ -42,8 +42,8 @@ protected:
static
std
::
string
geometryShaderText
;
static
std
::
string
fragmentShaderText
;
GLuint
m_uniform_scale
;
GLuint
m_uniform_color
;
CGoGN
GLuint
m_uniform_scale
;
CGoGN
GLuint
m_uniform_color
;
float
m_scale
;
Geom
::
Vec4f
m_color
;
...
...
include/Utils/gl_def.h
0 → 100644
View file @
bab67f6f
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __CGOGN_GL_DEF_H_
#define __CGOGN_GL_DEF_H_
#ifdef USE_VRJUGGLER
#include <vrj/Draw/OGL/GlApp.h>
#include <vrj/Draw/OGL/GlContextData.h>
#endif
#include <GL/glew.h>
namespace
CGoGN
{
#ifdef USE_VRJUGGLER
#include <vrj/Draw/OGL/GlApp.h>
#include <vrj/Draw/OGL/GlContextData.h>
typedef
vrj
::
opengl
::
ContextData
<
GLint
>
CGoGNGLint
;
typedef
vrj
::
opengl
::
ContextData
<
GLuint
>
CGoGNGLuint
;
typedef
vrj
::
opengl
::
ContextData
<
GLhandleARB
>
CGoGNGLhandleARB
;
#else
template
<
typename
T
>
class
FalsePtr
{
T
m_v
;
public:
FalsePtr
()
:
m_v
(
T
(
0
))
{}
FalsePtr
(
const
T
&
v
)
:
m_v
(
v
)
{}
T
&
operator
*
()
{
return
m_v
;
}
const
T
&
operator
*
()
const
{
return
m_v
;
}
};
typedef
FalsePtr
<
GLint
>
CGoGNGLint
;
typedef
FalsePtr
<
GLuint
>
CGoGNGLuint
;
typedef
FalsePtr
<
GLhandleARB
>
CGoGNGLhandleARB
;
#endif
}
#endif
/* GL_DEF_H_ */
include/Utils/pickables.h
View file @
bab67f6f
...
...
@@ -44,7 +44,7 @@ protected:
/**
* id of indices VBO
*/
GLuint
m_ind
;
CGoGN
GLuint
m_ind
;
/**
* VBO for position
...
...
include/Utils/pointSprite.h
View file @
bab67f6f
...
...
@@ -47,18 +47,20 @@ protected:
static
std
::
string
fragmentShaderText
;
static
GLuint
m_idTexture
;
static
GLuint
m_uniform_texture
;
static
unsigned
char
*
m_ptrSphere
;
static
PointSprite
*
m_instance0
;
// compute the sphere instead of storing it in image file.
static
void
computeSphere
();
GLuint
m_uniform_size
;
CGoGNGLuint
m_uniform_size
;
CGoGNGLuint
m_uniform_color
;
CGoGNGLuint
m_idTexture
;
GLuint
m_uniform_color
;
CGoGNGLuint
m_uniform_texture
;
public:
/**
...
...
include/Utils/text3d.h
View file @
bab67f6f
...
...
@@ -55,7 +55,7 @@ protected:
static
std
::
string
fragmentShaderText1
;
static
std
::
string
fragmentShaderText2
;
static
GLuint
m_idTexture
;
static
Strings3D
*
m_instance0
;
std
::
vector
<
std
::
string
>
m_strings
;
...
...
@@ -71,13 +71,15 @@ protected:
unsigned
int
sendOneStringToVBO
(
const
std
::
string
&
str
,
float
**
buffer
);
GLuint
m_uniform_t
exture
;
CGoGNGLuint
m_idT
exture
;
GLuint
m_uniform_scal
e
;
CGoGNGLuint
m_uniform_textur
e
;
GLuint
m_uniform_position
;
CGoGNGLuint
m_uniform_scale
;
GLuint
m_uniform_color
;
CGoGNGLuint
m_uniform_position
;
CGoGNGLuint
m_uniform_color
;
public:
Strings3D
(
bool
withBackground
=
true
,
const
Geom
::
Vec3f
&
bgc
=
Geom
::
Vec3f
(
0
));
...
...
include/Utils/textures.h
View file @
bab67f6f
...
...
@@ -25,6 +25,7 @@
#ifndef CGOGN_TEXTURES_H_
#define CGOGN_TEXTURES_H_
#include "Utils/gl_def.h"
#include "Geometry/vector_gen.h"
#include <GL/glew.h>
#include <string>
...
...
@@ -309,7 +310,7 @@ protected:
/**
* texture id
*/
GLuint
m_id
;
CGoGN
GLuint
m_id
;
/**
* dimension of texture
...
...
include/Utils/textures.hpp
View file @
bab67f6f
...
...
@@ -915,9 +915,9 @@ m_type(type)
break
;
}
glGenTextures
(
1
,
&
m_id
);
glGenTextures
(
1
,
&
(
*
m_id
)
);
glBindTexture
(
m_target
,
m_id
);
glBindTexture
(
m_target
,
*
m_id
);
glTexParameteri
(
m_target
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
m_target
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
...
...
@@ -963,7 +963,7 @@ GLenum Texture<DIM,TYPE>::internalFormat()
template
<
unsigned
int
DIM
,
typename
TYPE
>
void
Texture
<
DIM
,
TYPE
>::
bind
()
{
glBindTexture
(
m_target
,
m_id
);
glBindTexture
(
m_target
,
*
m_id
);
}
...
...
@@ -983,7 +983,7 @@ void Texture<DIM,TYPE>::checkAlignment()
template
<
unsigned
int
DIM
,
typename
TYPE
>
void
Texture
<
DIM
,
TYPE
>::
update
()
{
glBindTexture
(
m_target
,
m_id
);
glBindTexture
(
m_target
,
*
m_id
);
checkAlignment
();
switch
(
DIM
)
{
...
...
@@ -1005,7 +1005,7 @@ void Texture<DIM,TYPE>::update()
template
<
unsigned
int
DIM
,
typename
TYPE
>
void
Texture
<
DIM
,
TYPE
>::
update
(
const
COORD
&
origin
,
const
COORD
&
sz
)
{
glBindTexture
(
m_target
,
m_id
);
glBindTexture
(
m_target
,
*
m_id
);
checkAlignment
();
switch
(
DIM
)
{
...
...
@@ -1028,7 +1028,7 @@ void Texture<DIM,TYPE>::update(const COORD& origin, const COORD& sz)
template
<
unsigned
int
DIM
,
typename
TYPE
>
void
Texture
<
DIM
,
TYPE
>::
setFiltering
(
GLint
param
)
{
glBindTexture
(
m_target
,
m_id
);
glBindTexture
(
m_target
,
*
m_id
);
glTexParameteri
(
m_target
,
GL_TEXTURE_MIN_FILTER
,
param
);
glTexParameteri
(
m_target
,
GL_TEXTURE_MAG_FILTER
,
param
);
}
...
...
@@ -1038,7 +1038,7 @@ void Texture<DIM,TYPE>::setFiltering(GLint param)
template
<
unsigned
int
DIM
,
typename
TYPE
>
void
Texture
<
DIM
,
TYPE
>::
setWrapping
(
GLint
param
)
{
glBindTexture
(
m_target
,
m_id
);
glBindTexture
(
m_target
,
*
m_id
);
glTexParameteri
(
m_target
,
GL_TEXTURE_WRAP_S
,
param
);
glTexParameteri
(
m_target
,
GL_TEXTURE_WRAP_T
,
param
);
glTexParameteri
(
m_target
,
GL_TEXTURE_WRAP_R
,
param
);
...
...
include/Utils/vbo.h
View file @
bab67f6f
...
...
@@ -25,9 +25,10 @@
#ifndef __CGoGN_GLSL_VBO__
#define __CGoGN_GLSL_VBO__
#include <vector>
#include <GL/glew.h>
#include "Utils/gl_def.h"
#include "Topology/generic/attributeHandler.h"
#include "Container/convert.h"
...
...
@@ -50,7 +51,7 @@ class VBO
{
protected:
// VBO id
GLuint
m_id
;
CGoGN
GLuint
m_id
;
// size of data (in floats)
unsigned
int
m_data_size
;
// shaders that ref this vbo
...
...
@@ -77,7 +78,7 @@ public:
/**
* get id of vbo
*/
unsigned
int
id
()
const
{
return
m_id
;
}
GLuint
id
()
const
{
return
*
m_id
;
}
/**
* get dataSize
...
...
@@ -97,7 +98,7 @@ public:
/**
* bind array vbo
*/
void
bind
()
const
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
}
void
bind
()
const
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
m_id
);
}
/**
* alloc buffer of same size than parameter
...
...
include/Utils/vbo.hpp
View file @
bab67f6f
...
...
@@ -43,7 +43,7 @@ void VBO::updateData(const ATTR_HANDLER& attrib)
unsigned
int
byteTableSize
;
unsigned
int
nbb
=
mv
->
getBlocksPointers
(
addr
,
byteTableSize
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
m_id
);
glBufferData
(
GL_ARRAY_BUFFER
,
nbb
*
byteTableSize
,
0
,
GL_STREAM_DRAW
);
m_nbElts
=
nbb
*
byteTableSize
/
sizeof
(
typename
ATTR_HANDLER
::
DATA_TYPE
);
...
...
@@ -76,7 +76,7 @@ void VBO::updateData(const ATTR_HANDLER& attrib, ConvertAttrib* conv)
conv
->
reserve
(
mv
->
getBlockSize
());
// bind buffer to update
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
m_id
);
glBufferData
(
GL_ARRAY_BUFFER
,
nbb
*
conv
->
sizeBuffer
(),
0
,
GL_STREAM_DRAW
);
m_nbElts
=
nbb
*
conv
->
nbElt
();
...
...
@@ -108,7 +108,7 @@ void VBO::updateData(std::vector<T>& data)
m_data_size
=
sizeof
(
T
)
/
sizeof
(
float
);
m_nbElts
=
data
.
size
();
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_id
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
m_id
);
glBufferData
(
GL_ARRAY_BUFFER
,
m_nbElts
*
sizeof
(
T
),
&
(
data
[
0
]),
GL_STREAM_DRAW
);
}
...
...
src/Algo/Render/mapRender.cpp
View file @
bab67f6f
...
...
@@ -39,14 +39,14 @@ namespace GL2
MapRender
::
MapRender
()
{
glGenBuffers
ARB
(
SIZE_BUFFER
,
m_indexBuffers
)
;
glGenBuffers
(
SIZE_BUFFER
,
m_indexBuffers
)
;
for
(
unsigned
int
i
=
0
;
i
<
SIZE_BUFFER
;
++
i
)
m_nbIndices
[
i
]
=
0
;
}
MapRender
::~
MapRender
()
{
glDeleteBuffers
ARB
(
4
,
m_indexBuffers
);
glDeleteBuffers
(
4
,
m_indexBuffers
);
}
void
MapRender
::
initPrimitives
(
int
prim
,
std
::
vector
<
GLuint
>&
tableIndices
)
...
...
@@ -83,8 +83,8 @@ void MapRender::initPrimitives(int prim, std::vector<GLuint>& tableIndices)
}
// setup du buffer d'indices
glBindBuffer
ARB
(
GL_ELEMENT_ARRAY_BUFFER
,
vbo_ind
);
glBufferData
ARB
(
GL_ELEMENT_ARRAY_BUFFER
,
size
*
sizeof
(
GLuint
),
&
(
tableIndices
[
0
]),
GL_STREAM_DRAW
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
vbo_ind
);
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
size
*
sizeof
(
GLuint
),
&
(
tableIndices
[
0
]),
GL_STREAM_DRAW
);
}
void
MapRender
::
draw
(
Utils
::
GLSLShader
*
sh
,
int
prim
)
...
...
src/Utils/GLSLShader.cpp
View file @
bab67f6f
...
...
@@ -71,18 +71,19 @@ std::set< std::pair<void*, GLSLShader*> > GLSLShader::m_registeredShaders;
Utils
::
GL_Matrices
*
GLSLShader
::
s_current_matrices
=
NULL
;
GLSLShader
::
GLSLShader
()
:
m_vertex_shader_object
(
0
),
m_fragment_shader_object
(
0
),
m_geom_shader_object
(
0
),
m_program_object
(
0
),
m_uniMat_Proj
(
-
1
),
m_uniMat_Model
(
-
1
),
m_uniMat_ModelProj
(
-
1
),
m_uniMat_Normal
(
-
1
),
m_vertex_shader_source
(
NULL
),
m_fragment_shader_source
(
NULL
),
m_geom_shader_source
(
NULL
)
{
*
m_vertex_shader_object
=
0
;
*
m_fragment_shader_object
=
0
;
*
m_geom_shader_object
=
0
;
*
m_program_object
=
0
;
*
m_uniMat_Proj
=
-
1
;
*
m_uniMat_Model
=
-
1
;
*
m_uniMat_ModelProj
=
-
1
;
*
m_uniMat_Normal
=
-
1
;
if
(
DEFINES_GL
==
NULL
)
DEFINES_GL
=
&
DEFINES_GL2
;
}
...
...
@@ -275,16 +276,16 @@ bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source
int
status
;
char
*
info_log
;
if
(
m_vertex_shader_object
==
0
)
if
(
*
m_vertex_shader_object
==
0
)
{
glDeleteShader
(
m_vertex_shader_object
);
m_vertex_shader_object
=
0
;
glDeleteShader
(
*
m_vertex_shader_object
);
*
m_vertex_shader_object
=
0
;
}
/*** create shader object ***/
m_vertex_shader_object
=
glCreateShader
(
GL_VERTEX_SHADER
);
*
m_vertex_shader_object
=
glCreateShader
(
GL_VERTEX_SHADER
);
if
(
!
m_vertex_shader_object
)
if
(
!
*
m_vertex_shader_object
)
{
CGoGNerr
<<
"ERROR - GLSLShader::loadVertexShader() - unable to create shader object."
<<
CGoGNendl
;
return
false
;
...
...
@@ -295,27 +296,27 @@ bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source
{
CGoGNerr
<<
"ERROR - GLSLShader::loadVertexShader() - source string is empty."
<<
CGoGNendl
;
<