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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
c4c86f8d
Commit
c4c86f8d
authored
Jan 05, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update of toporendering (and picking) for gmap (onw OK)
a define in tuto*.h allow testing with gmap
parent
94bef722
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
99 additions
and
329 deletions
+99
-329
Apps/Tuto/tuto1.h
Apps/Tuto/tuto1.h
+1
-1
Apps/Tuto/tuto2.h
Apps/Tuto/tuto2.h
+1
-1
Apps/Tuto/tuto3.cpp
Apps/Tuto/tuto3.cpp
+1
-1
Apps/Tuto/tuto3.h
Apps/Tuto/tuto3.h
+11
-1
Apps/Tuto/tuto4.cpp
Apps/Tuto/tuto4.cpp
+1
-1
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+11
-34
Apps/Tuto/tuto5.h
Apps/Tuto/tuto5.h
+39
-9
include/Algo/Render/GL2/topo3Render.h
include/Algo/Render/GL2/topo3Render.h
+1
-1
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+23
-270
include/Algo/Render/GL2/topoRender.h
include/Algo/Render/GL2/topoRender.h
+1
-1
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+6
-8
src/Algo/Render/topo3Render.cpp
src/Algo/Render/topo3Render.cpp
+3
-1
No files found.
Apps/Tuto/tuto1.h
View file @
c4c86f8d
...
...
@@ -25,7 +25,7 @@
#ifndef _TUTO1_
#define _TUTO1_
#define USE_GMAP
//
#define USE_GMAP
#include "Utils/Qt/qtSimple.h"
#include "Utils/cgognStream.h"
...
...
Apps/Tuto/tuto2.h
View file @
c4c86f8d
...
...
@@ -25,7 +25,7 @@
#ifndef _TUTO2_
#define _TUTO2_
#define USE_GMAP
//
#define USE_GMAP
#include "Utils/Qt/qtSimple.h"
...
...
Apps/Tuto/tuto3.cpp
View file @
c4c86f8d
...
...
@@ -174,7 +174,7 @@ void MyQT::cb_mouseClick(int button, int x, int y)
{
if
(
button
==
Qt
::
LeftButton
)
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
allDarts
,
x
,
y
);
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
if
(
d
!=
NIL
)
CGoGNout
<<
"Dart "
<<
d
<<
CGoGNendl
;
...
...
Apps/Tuto/tuto3.h
View file @
c4c86f8d
...
...
@@ -28,8 +28,14 @@
#include "Utils/Qt/qtSimple.h"
#include "Utils/cgognStream.h"
//#define USE_GMAP
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#ifdef USE_GMAP
#include "Topology/gmap/embeddedGMap2.h"
#else
#include "Topology/map/embeddedMap2.h"
#endif
#include "Algo/Render/GL2/topoRender.h"
...
...
@@ -43,7 +49,11 @@ using namespace CGoGN ;
struct
PFP
:
public
PFP_STANDARD
{
// definition of the type of the map
#ifdef USE_GMAP
typedef
EmbeddedGMap2
MAP
;
#else
typedef
EmbeddedMap2
MAP
;
#endif
};
...
...
Apps/Tuto/tuto4.cpp
View file @
c4c86f8d
...
...
@@ -61,7 +61,7 @@ void MyQT::cb_mouseClick(int button, int x, int y)
if
(
button
==
Qt
::
LeftButton
)
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
allDarts
,
x
,
y
);
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
if
(
d
!=
NIL
)
{
dart_selected
.
clear
();
...
...
Apps/Tuto/tuto5.cpp
View file @
c4c86f8d
...
...
@@ -22,50 +22,18 @@
* *
*******************************************************************************/
#define WITH_GMAP 1
#include "tuto5.h"
#include <iostream>
#include "Topology/generic/parameters.h"
#ifdef WITH_GMAP
#include "Topology/gmap/embeddedGMap3.h"
#else
#include "Topology/map/embeddedMap3.h"
#endif
#include "Geometry/vector_gen.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"
#include "Algo/Render/GL2/topo3Render.h"
#include "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/cgognStream.h"
#include "Algo/Render/SVG/mapSVGRender.h"
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
#ifdef WITH_GMAP
typedef
EmbeddedGMap3
MAP
;
#else
typedef
EmbeddedMap3
MAP
;
#endif
};
PFP
::
MAP
myMap
;
PFP
::
TVEC3
position
;
...
...
@@ -224,10 +192,13 @@ void MyQT::cb_redraw()
if
(
render_topo
)
m_render_topo
->
drawTopo
();
Dart
d
=
myMap
.
phi2
(
myMap
.
begin
());
/*
Dart d = myMap.phi2(myMap.begin());
m_render_topo->overdrawDart(d, 5, 1.0f, 0.0f, 1.0f);
d = myMap.phi1(myMap.begin());
m_render_topo->overdrawDart(d, 5, 1.0f, 0.0f, 1.0f);
*/
m_render_topo
->
overdrawDart
(
m_selected
,
5
,
1.0
f
,
0.0
f
,
1.0
f
);
glDisable
(
GL_POLYGON_OFFSET_FILL
);
...
...
@@ -252,15 +223,18 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if
(
Shift
())
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
allDarts
,
x
,
y
);
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
,
nb
);
if
(
d
!=
Dart
::
nil
())
{
CGoGNout
<<
"Dart "
<<
d
<<
" clicked"
<<
CGoGNendl
;
m_selected
=
d
;
}
else
{
statusMsg
(
""
);
}
updateGL
();
}
}
...
...
@@ -339,6 +313,9 @@ int main(int argc, char **argv)
sqt
.
setCallBack
(
dock
.
slider_vectors
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slider_vectors
(
int
))
);
sqt
.
setCallBack
(
dock
.
slider_text
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slider_text
(
int
))
);
sqt
.
m_selected
=
myMap
.
begin
();
sqt
.
show
();
sqt
.
slider_balls
(
50
);
...
...
Apps/Tuto/tuto5.h
View file @
c4c86f8d
...
...
@@ -27,6 +27,30 @@
#include <iostream>
#define WITH_GMAP 1
#include "Topology/generic/parameters.h"
#ifdef WITH_GMAP
#include "Topology/gmap/embeddedGMap3.h"
#else
#include "Topology/map/embeddedMap3.h"
#endif
#include "Geometry/vector_gen.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Algo/Render/GL2/topo3Render.h"
#include "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
...
...
@@ -34,14 +58,19 @@
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/Qt/qtui.h"
// forward definitions (minimize includes)
namespace
CGoGN
{
namespace
Algo
{
namespace
Render
{
namespace
GL2
{
class
MapRender
;
}
}
}
}
namespace
CGoGN
{
namespace
Algo
{
namespace
Render
{
namespace
GL2
{
class
Topo3Render
;
}
}
}
}
namespace
CGoGN
{
namespace
Utils
{
class
VBO
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderSimpleColor
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
Strings3D
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
PointSprite
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderVectorPerVertex
;
}
}
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
#ifdef WITH_GMAP
typedef
EmbeddedGMap3
MAP
;
#else
typedef
EmbeddedMap3
MAP
;
#endif
};
using
namespace
CGoGN
;
...
...
@@ -74,7 +103,7 @@ class MyQT: public Utils::QT::SimpleQT
Utils
::
PointSprite
*
m_sprite
;
QTimer
*
m_timer
;
public:
MyQT
()
:
render_text
(
true
),
...
...
@@ -92,6 +121,7 @@ public:
m_timer
(
NULL
)
{}
Dart
m_selected
;
protected:
void
storeVerticesInfo
();
...
...
include/Algo/Render/GL2/topo3Render.h
View file @
c4c86f8d
...
...
@@ -256,7 +256,7 @@ public:
* @return the dart or NIL
*/
template
<
typename
PFP
>
Dart
picking
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
int
x
,
int
y
);
Dart
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
,
const
FunctorSelect
&
good
=
allDarts
);
/**
* update all drawing buffers to render a dual map
...
...
include/Algo/Render/GL2/topo3Render.hpp
View file @
c4c86f8d
...
...
@@ -86,11 +86,16 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
unsigned
int
posDBI
=
0
;
DartMarker
mark
(
map
);
// marker for darts
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
good
(
d
))
{
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
CellMarkerStore
markVert
(
map
,
VERTEX
);
//marker for vertices
VEC3
center
(
0
,
0
,
0
);
unsigned
int
nbv
=
0
;
...
...
@@ -148,7 +153,6 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
glBufferData
(
GL_ARRAY_BUFFER
,
2
*
m_nbDarts
*
sizeof
(
VEC3
),
0
,
GL_STREAM_DRAW
);
GLvoid
*
PositionDartsBuffer
=
glMapBuffer
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
);
VEC3
*
positionDartBuf
=
reinterpret_cast
<
VEC3
*>
(
PositionDartsBuffer
);
unsigned
int
posDBI
=
0
;
...
...
@@ -169,8 +173,6 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
{
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
P
);
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
center
+=
P
;
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
...
...
@@ -196,8 +198,8 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
0
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
0
);
fv1
[
d
]
=
P
*
0.1
f
+
Q
*
0.9
f
;
fv11
[
d
]
=
P
*
0.9
f
+
Q
*
0.1
f
;
...
...
@@ -289,12 +291,13 @@ void Topo3Render::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& g
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
nb
<
m_nbDarts
)
if
(
good
(
d
)
)
{
if
(
good
(
d
)
)
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
...
...
@@ -305,18 +308,20 @@ void Topo3Render::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& g
nb
++
;
}
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the good parameter ?)"
<<
CGoGNendl
;
d
=
map
.
end
();
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the good parameter ?)"
<<
CGoGNendl
;
d
=
map
.
end
()
;
}
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
std
::
cout
<<
"NB DARTS="
<<
m_nbDarts
<<
std
::
endl
;
}
template
<
typename
PFP
>
Dart
Topo3Render
::
picking
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
int
x
,
int
y
)
Dart
Topo3Render
::
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
,
const
FunctorSelect
&
good
)
{
pushColors
();
setDartsIdColor
<
PFP
>
(
map
,
good
);
...
...
@@ -353,11 +358,15 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
unsigned
int
posDBI
=
0
;
DartMarker
mark
(
map
);
// marker for darts
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
good
(
d
))
{
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
CellMarkerStore
markVert
(
map
,
VERTEX
);
//marker for vertices
VEC3
center
(
0
,
0
,
0
);
unsigned
int
nbv
=
0
;
...
...
@@ -383,6 +392,7 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
nbv
++
;
}
mark
.
mark
(
dNext
);
// Mark
mark
.
mark
(
map
.
beta0
(
dNext
));
m_nbDarts
++
;
Dart
adj
=
map
.
phi2
(
dNext
);
// Get adjacent face
if
(
adj
!=
dNext
&&
!
mark
.
isMarked
(
adj
))
...
...
@@ -414,7 +424,6 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
glBufferData
(
GL_ARRAY_BUFFER
,
2
*
m_nbDarts
*
sizeof
(
VEC3
),
0
,
GL_STREAM_DRAW
);
GLvoid
*
PositionDartsBuffer
=
glMapBuffer
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
);
VEC3
*
positionDartBuf
=
reinterpret_cast
<
VEC3
*>
(
PositionDartsBuffer
);
unsigned
int
posDBI
=
0
;
std
::
vector
<
Dart
>::
iterator
face
=
vecDartFaces
.
begin
();
for
(
unsigned
int
iVol
=
0
;
iVol
<
vecNbFaces
.
size
();
++
iVol
)
...
...
@@ -433,8 +442,6 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
{
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
P
);
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
center
+=
P
;
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
...
...
@@ -568,260 +575,6 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
m_vbo4
->
bind
();
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
}
/*{
GMap3& map = reinterpret_cast<GMap3&>(mapx);
float kd=0.95f;
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
AutoAttributeHandler<Geom::Vec3f> posBeta1(map, DART);
AutoAttributeHandler<Geom::Vec3f> posBeta2(map, DART); //beta 3 link is represented at the same location as beta2
AutoAttributeHandler<Geom::Vec3f> posBeta2x(map, DART); //beta 3 link is represented at the same location as beta2
AutoAttributeHandler<Geom::Vec3f> vert(map, DART);
if (m_attIndex.map() != &map)
{
m_attIndex = map.template getAttribute<unsigned int>(DART, "dart_index");
if (!m_attIndex.isValid())
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
}
m_nbDarts = 0;
// table of face (one dart of each)
std::vector<Dart> vecDartFaces;
vecDartFaces.reserve(map.getNbDarts()/6); //6 = nb of darts for tri mesh
// table of nbfaces per volume
std::vector<unsigned int> vecNbFaces;
vecNbFaces.reserve(vecDartFaces.size());
// table of center of volume
std::vector<VEC3> vecVolCenters;
vecVolCenters.reserve(vecDartFaces.size()/4); // = nb of volumes for a tetra mesh
DartMarker mark(map); // marker for darts
CellMarker mVol(map, VOLUME);
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
if (good(d))
{
if(!mVol.isMarked(d))
{
mVol.mark(d);
CellMarkerStore markVert(map, VERTEX); //marker for vertices
VEC3 center(0);
unsigned int nbVertices = 0;
unsigned int nbFace = 0;
std::list<Dart> visitedFaces; // Faces that are traversed
visitedFaces.push_back(d); // Start with the face of d
// For every face added to the list
for (std::list<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
{
if (!mark.isMarked(*face)) // Face has not been visited yet
{
// store a dart of face
vecDartFaces.push_back(*face);
nbFace++;
Dart dNext = *face ;
do
{
mark.mark(dNext); // Mark
m_nbDarts++;
if (!markVert.isMarked(dNext))
{
markVert.mark(dNext);
center += positions[dNext];
nbVertices++;
}
Dart adj = map.phi2(dNext); // add adjacent face if not done already
if (adj != dNext && !mark.isMarked(adj))
visitedFaces.push_back(adj);
dNext = map.phi1(dNext);
} while(dNext != *face);
}
}
center /= typename PFP::REAL(nbVertices);
vecVolCenters.push_back(center);
vecNbFaces.push_back(nbFace);
}
}
}
m_nbDarts *= 2; // x2 : only one orientation is used for the previous computation, multiply by 2 to get the number of darts
//colors
m_vbo4->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
VEC3* colorDartBuf = reinterpret_cast<VEC3*>(ColorDartsBuffer);
//darts
m_vbo0->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
VEC3* positionDartBuf = reinterpret_cast<VEC3*>(PositionDartsBuffer);
unsigned int posDBI=0;
std::vector<Dart>::iterator face = vecDartFaces.begin();
for (unsigned int iVol=0; iVol<vecNbFaces.size(); ++iVol)
{
for (unsigned int iFace = 0; iFace < vecNbFaces[iVol]; ++iFace)
{
Dart d = *face++;
std::vector<VEC3> vecPos;
vecPos.reserve(16);
// store the face & center
VEC3 center(0);
Dart dd = d;
do
{
const VEC3& P = positions[dd];
vecPos.push_back(P);
m_attIndex[dd] = posDBI;
posDBI+=2;
m_attIndex[map.beta0(dd)] = posDBI; //for gmap : also affect a number to the other orientation for picking
posDBI+=2;
center += P;
dd = map.phi1(dd);
} while (dd != d);
center /= REAL(vecPos.size());
//shrink the face
unsigned int nb = vecPos.size();
float okf = 1.0f - kf;
float okv = 1.0f - kv;
for (unsigned int i = 0; i < nb; ++i)
{
vecPos[i] = vecVolCenters[iVol]*okv + vecPos[i]*kv;
vecPos[i] = center*okf + vecPos[i]*kf;
}
vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop
// compute position of points to use for drawing topo
float oke = 1.0f - ke;
for (unsigned int i = 0; i < nb; ++i)
{
VEC3 P = vecPos[i]*ke + vecPos[i+1]*oke;
VEC3 Q = vecPos[i+1]*ke + vecPos[i]*oke;
VEC3 P_mid = P+(Q-P)*kd*0.5f;
VEC3 Q_mid = Q+(P-Q)*kd*0.5f;
vert[d] = P;
*positionDartBuf++ = P;
*positionDartBuf++ = P_mid;
*colorDartBuf++ = VEC3(1.,1.,1.);
*colorDartBuf++ = VEC3(1.,1.,1.);
// glColor3f(0.0f,0.0f,1.0f);
// glVertex3fv(P_mid.data());
// glVertex3fv(Q_mid.data());
// glColor3f(1.0f,1.0f,1.0f);
*positionDartBuf++ = Q;
*positionDartBuf++ = Q_mid;
*colorDartBuf++ = VEC3(1.,1.,1.);
*colorDartBuf++ = VEC3(1.,1.,1.);
posBeta1[d] = P*0.9f + P_mid*0.1f;
posBeta1[map.beta0(d)] = Q*0.9f + Q_mid*0.1f;
posBeta2[d] = P*0.52f + P_mid*0.48f;
posBeta2x[d] = P*0.48f + P_mid*0.52f;
posBeta2[map.beta0(d)] = Q*0.52f + Q_mid*0.48f;
posBeta2x[map.beta0(d)] = Q*0.48f + Q_mid*0.52f;
d = map.phi1(d);
}
}
}
//beta1
m_vbo1->bind();
glBufferData(GL_ARRAY_BUFFER, m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionBuffer1 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE);
//beta2
m_vbo2->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionBuffer2 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE);
//beta3
m_vbo3->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionBuffer3 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE);
VEC3* positionF1 = reinterpret_cast<VEC3*>(PositionBuffer1);
VEC3* positionF2 = reinterpret_cast<VEC3*>(PositionBuffer2);
VEC3* positionF3 = reinterpret_cast<VEC3*>(PositionBuffer3);
m_nbRel2=0;
m_nbRel3=0;
//draw beta1, beta2, beta3 if required
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
Dart e = map.beta2(d);
if ((d<e))
{
glColor3f(1.0,0.0,0.0);
*positionF2++ = posBeta2[d];
*positionF2++ = posBeta2x[d];
*positionF2++ = posBeta2x[e];
*positionF2++ = posBeta2[e];
m_nbRel2++;
}
e = map.beta3(d);
if ((d<e))
{
glColor3f(1.0,1.0,0.0);
*positionF3++ = posBeta2[d];
*positionF3++ = posBeta2x[d];
*positionF3++ = posBeta2x[e];
*positionF3++ = posBeta2[e];
m_nbRel3++;
}
e = map.beta1(d);
if ((d<e))
{
e = map.beta1(d);
*positionF1++ = posBeta1[d];
*positionF1++ = posBeta1[e];
}
}
m_vbo3->bind();
glUnmapBufferARB(GL_ARRAY_BUFFER);
m_vbo2->bind();
glUnmapBufferARB(GL_ARRAY_BUFFER);
m_vbo1->bind();
glUnmapBuffer(GL_ARRAY_BUFFER);
m_vbo0->bind();
glUnmapBuffer(GL_ARRAY_BUFFER);
m_vbo4->bind();
glUnmapBuffer(GL_ARRAY_BUFFER);
}
*/