Geogram Version 1.8.5
A programming library of geometric algorithms
Loading...
Searching...
No Matches
GLUP_context_ES.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2000-2022 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the ALICE Project-Team nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Contact: Bruno Levy
30 *
31 * https://www.inria.fr/fr/bruno-levy
32 *
33 * Inria,
34 * Domaine de Voluceau,
35 * 78150 Le Chesnay - Rocquencourt
36 * FRANCE
37 *
38 */
39
40#ifndef GEOGRAM_GFX_GLUP_GLUP_CONTEXT_ES
41#define GEOGRAM_GFX_GLUP_GLUP_CONTEXT_ES
42
45
52#ifdef GEO_GL_ES2
53
54namespace GLUP {
55 using namespace GEO;
56
57 /*********************************************************************/
58
69 class Context_ES2 : public Context {
70 public:
71
75 Context_ES2();
76
80 ~Context_ES2() override;
81
85 const char* profile_name() const override;
86
90 void setup() override;
91
95 bool primitive_supports_array_mode(GLUPprimitive prim) const override;
96
97
101 void get_primitive_pseudo_file(
102 std::vector<GLSL::Source>& sources
103 ) override;
104
108 void get_vertex_shader_preamble_pseudo_file(
109 std::vector<GLSL::Source>& sources
110 ) override;
111
115 void get_fragment_shader_preamble_pseudo_file(
116 std::vector<GLSL::Source>& sources
117 ) override;
118
122 void get_toggles_pseudo_file(
123 std::vector<GLSL::Source>& sources
124 ) override;
125
126 protected:
127
131 void prepare_to_draw(GLUPprimitive primitive) override;
132
136 void done_draw(GLUPprimitive primitive) override;
137
141 Memory::pointer get_state_variable_address(const char* name) override;
142
146 void do_update_uniform_buffer() override;
147
151 void copy_uniform_state_to_current_program() override;
152
156 void update_base_picking_id(GLint new_value) override;
157
161 void setup_GLUP_POINTS() override;
162
166 void setup_GLUP_LINES() override;
167
168
184 void setup_primitive_generic(
185 index_t nb_elements_per_glup_primitive,
186 index_t* element_indices
187 );
188
192 void setup_GLUP_TRIANGLES() override;
193
197 void setup_GLUP_QUADS() override;
198
202 void setup_GLUP_TETRAHEDRA() override;
203
207 void setup_GLUP_PRISMS() override;
208
212 void setup_GLUP_HEXAHEDRA() override;
213
217 void setup_GLUP_PYRAMIDS() override;
218
222 void setup_GLUP_CONNECTORS() override;
223
227 void setup_GLUP_SPHERES() override;
228
232 void flush_immediate_buffers() override;
233
234
243 bool cell_by_cell_clipping() const;
244
253 bool sliced_cells_clipping() const;
254
261 void flush_immediate_buffers_with_cell_by_cell_clipping();
262
268 void flush_immediate_buffers_with_sliced_cells_clipping();
269
270
271 private:
272 index_t nb_clip_cells_elements_;
273 Numeric::uint16* clip_cells_elements_;
274
275 GLuint clip_cells_elements_VBO_;
276 GLuint clip_cells_VAO_;
277
278 GLuint sliced_cells_elements_VBO_;
279 GLuint sliced_cells_vertex_attrib_VBO_[4];
280 GLuint sliced_cells_VAO_;
281
282 double GLSL_version_;
283
284 bool vertex_id_VBO_bound_;
285 };
286
287 /*********************************************************************/
288
289}
290
291#endif
292
293#endif
294
GLUPprimitive
Symbolic values corresponding to GLUP primitive types.
Definition GLUP.h:504
Internal implementation of GLUP context.
Common include file, providing basic definitions. Should be included before anything else by all head...
byte * pointer
Pointer to unsigned byte(s)
Definition memory.h:92
uint16_t uint16
Definition numeric.h:93
Global Vorpaline namespace.
Definition algorithm.h:64
geo_index_t index_t
The type for storing and manipulating indices.
Definition numeric.h:287