FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
fiberGL.hpp
1#include <eagle/GL/EagleGL.hpp>
2#include <vector/MultiArray.hpp>
3#include <field/Cell.hpp>
4#include <memcore/Chunk.hpp>
5
6#ifndef __FIBER_GL_HPP
7#define __FIBER_GL_HPP
8
9
10template <>
11 class glType<Fiber::TriangleCell>
12{
13public:
16 enum c { components = 3 };
17};
18
19
20namespace GL
21{
22using namespace Eagle;
23using namespace Fiber;
24
25template <class T, int N>
26inline void VertexPointer(const ElementIterator<FixedArray<T,N> >&P)
27{
28 ::glVertexPointer(N, glType<T>::type, 0, P.ptr() );
29}
30
31template <class T, int N>
32inline void ColorPointer(const ElementIterator<FixedArray<T,N> >&P)
33{
34 ::glColorPointer(N, glType<T>::type, 0, P.ptr() );
35}
36
37/*
38template <class T, int N>
39inline void NormalPointer(const ElementIterator<FixedArray<T,N> >&P)
40{
41 ::glNormalPointer(N, glType<T>::type, 0, P.ptr() );
42}
43*/
44
45inline void VertexPointer(const ElementIterator<point3>&P)
46{
47 ::glVertexPointer(3, glType<point3::value_type>::type, 0, P.ptr() );
48}
49
50inline void NormalPointer(const ElementIterator<bivector3>&P)
51{
52 ::glNormalPointer(glType<bivector3::value_type>::type, 0, P.ptr() );
53}
54
55inline void ColorPointer(const ElementIterator<bivector3>&P)
56{
57 ::glColorPointer(3, glType<bivector3::value_type>::type, 0, P.ptr() );
58}
59
60template <typename T>
61inline void IndexPointer(const ElementIterator<T>&P)
62{
63 ::glIndexPointer(glType<T>::type, 0, P.ptr() );
64}
65
66template <class T>
67inline void DrawElements(GLenum mode, const ElementIterator<T>&P)
68{
69 ::glDrawElements( mode, P.count(), glType<T>::type, P.ptr() );
70}
71
72template <class T>
73inline void DrawPoints(const ElementIterator<T>&P)
74{
75 ::glDrawElements( GL_POINTS, P.count(), glType<T>::type, P.ptr() );
76}
77
78template <class T>
79inline void DrawLine(const ElementIterator<T>&P)
80{
81 ::glDrawElements( GL_LINE_STRIP, P.count(), glType<T>::type, P.ptr() );
82}
83
84
85template <class T>
86inline void DrawElements(const ElementIterator<FixedArray<T,2> >&P)
87{
88 ::glDrawElements( GL_LINES, 2*P.count(), glType<T>::type, P.ptr() );
89}
90
91template <class T>
92inline void DrawElements(const ElementIterator<FixedArray<T,3> >&P)
93{
94 ::glDrawElements( GL_TRIANGLES, 3*P.count(), glType<T>::type, P.ptr() );
95}
96
97template <class T>
98inline void DrawElements(const ElementIterator<FixedArray<T,4> >&P)
99{
100 ::glDrawElements( GL_QUADS, 4*P.count(), glType<T>::type, P.ptr() );
101}
102
103inline void DrawElements(const ElementIterator<TriangleCell>&P)
104{
105size_t A = TriangleCell::SIZE, B = P.count(),
106 C = A*B;
107
108 ::glDrawElements( GL_TRIANGLES, C,
110}
111
112inline void DrawElements(const std::vector<TriangleCell>&P)
113{
114size_t A = TriangleCell::SIZE, B = P.size(),
115 C = A*B;
116
117 ::glDrawElements( GL_TRIANGLES, C,
119}
120
121inline void DrawElements(const MemCore::Chunk<TriangleCell>&P)
122{
123 DrawElements(P.std_vector() );
124}
125
126// glDrawRangeElements
127
142template <class Type>
143inline bool TexImage(const MultiArray<2, Type>&TextureArray,
146 GLint level = 0, GLint border = 0 )
147{
149 return false;
150
151//nst Type*Data =
152 if (!TextureArray.ptr())
153 return false;
154
156 TextureArray.Size()[0],
157 TextureArray.Size()[1],
158 format,
160 level, border );
161
162 return true;
163}
164
165
166
167template <class Type>
168inline bool TexImage(const MultiArray<1, Type>&TextureArray,
171 GLint level = 0, GLint border = 0 )
172{
174 return false;
175
176const Type*Data = TextureArray.ptr();
177 if (!Data)
178 return false;
179
181 TextureArray.Size()[0],
182 format,
184 level, border );
185
186 return true;
187}
188
189
190
191} // GL
192
193#endif // __FIBER_GL_HPP
194
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
An iterator which allows to access each component element type of an array of vectors,...
Definition vector/Iterator.hpp:149
T * ptr(int c=0) const
Return pointer to data, which is good for C interface, but otherwise, avoid that.
Definition vector/Iterator.hpp:266
index_t multiplicity() const
Return number of elements which form an entity.
Definition HyperslabParameters.hpp:116
bool isSeparatedCompound() const
Tell if the iterator refers to a data set which is built from arrays of structure members,...
Definition HyperslabParameters.hpp:108
index_t count() const
Return the number of steps which can be traversed through this ElementIterator.
Definition HyperslabParameters.hpp:147
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2