Beatmup
program.cpp
Go to the documentation of this file.
1 /*
2  Beatmup image and signal processing library
3  Copyright (C) 2019, lnstadrum
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include "program.h"
20 #include "pipeline.h"
21 #include "bgl.h"
22 
23 using namespace Beatmup;
24 using namespace GL;
25 
26 
27 const char* FragmentShader::DIALECT_SAMPLER_DECL_TYPE = "beatmupSampler";
28 const char* FragmentShader::DIALECT_TEXTURE_SAMPLING_FUNC = "beatmupTexture";
29 
31  set = static_cast<Extensions>(set & ~entry);
32  return set;
33 }
34 
36  return static_cast<Extensions>(lhs | rhs);
37 }
38 
39 
40 Shader::Shader(const GraphicPipeline& gpu, const uint32_t type) : type(type) {
41  handle = glCreateShader(type);
42 }
43 
44 
46  glDeleteShader(handle);
47 }
48 
49 
50 void Shader::compile(const GraphicPipeline& gpu, const char* source) {
51  glShaderSource(handle, 1, &source, 0);
52  glCompileShader(handle);
53 
54  GLint status;
55  glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
56  if (status == GL_TRUE)
57  return;
58  GLint logLength;
59  glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &logLength);
60  if (logLength > 0) {
61  GLchar* log = (GLchar*)malloc(logLength);
62  glGetShaderInfoLog(handle, logLength, &logLength, log);
63  std::string msg((char*)log);
64  free(log);
65 #ifdef BEATMUP_DEBUG
66  msg = msg + "\n" + source;
67 #endif
68  throw GL::GLException(msg.c_str());
69  }
70  else
71  throw GL::GLException("Shader compilation failed (no log).");
72 }
73 
74 
75 VertexShader::VertexShader(const GraphicPipeline& gpu) : Shader(gpu, GL_VERTEX_SHADER) {
76 }
77 
78 void VertexShader::compile(const GraphicPipeline& gpu, const std::string& source, Extensions extensions) {
79  std::string src(source);
80  Extensions ext = extensions;
81  if (ext & Extensions::BEATMUP_DIALECT) {
83 
84  if (gpu.isGlEsCompliant())
85  if (gpu.getGlslVersion() == 100)
86  // ES 2.0 case
87  src = "#version 100\n"
88  "#line 0\n" + source;
89  else
90  // ES 3.0+
91  src = "#version 300 es\n"
92  "#define attribute in\n"
93  "#define varying out\n"
94  "#line 0\n" + source;
95  else
96  if (gpu.getGlslVersion() < 130)
97  // GLSL < 1.20 not supported; falling back to ES 2.0
98  src = "#version 100\n"
99  "#line 0\n" + source;
100  else
101  // 1.30+: capping at 1.30
102  src = "#version 130\n"
103  "#define attribute in\n"
104  "#define varying out\n"
105  "#line 0\n" + source;
106  }
107  if (ext & Extensions::EXTERNAL_TEXTURE) {
109  // nothing to do for this extension in the vertex shader
110  }
111  if (ext)
112  throw GL::GLException("Cannot interpret extensions set " + std::to_string(extensions));
113 
114  Shader::compile(gpu, src.c_str());
115 }
116 
117 
118 FragmentShader::FragmentShader(const GraphicPipeline& gpu) : Shader(gpu, GL_FRAGMENT_SHADER) {
119 }
120 
121 void FragmentShader::compile(const GraphicPipeline& gpu, const std::string& source, Extensions extensions) {
122  std::string src(source);
123 
124  // process extensions
125  Extensions ext = extensions;
126  if (ext & Extensions::BEATMUP_DIALECT) {
128 
129  // add version and dialect mapping preprocessor directives
130  bool mapToModernGlsl = false;
131  if (gpu.isGlEsCompliant())
132  if (gpu.getGlslVersion() == 100)
133  // ES 2.0 case
134  src = "#version 100\n";
135  else {
136  // ES 3.0+
137  src = "#version 300 es\n";
138  mapToModernGlsl = true;
139  }
140  else
141  if (gpu.getGlslVersion() < 130)
142  // GLSL < 1.20 not supported; falling back to ES 2.0
143  src = "#version 100\n";
144  else {
145  // 1.30+: capping at 1.30
146  src = "#version 130\n";
147  mapToModernGlsl = true;
148  }
149 
150  // declare sampler type, add external texture extension header if needed
151  if (ext & Extensions::EXTERNAL_TEXTURE) {
153  src += "#ifdef GL_OES_EGL_image_external_essl3\n"
154  "#extension GL_OES_EGL_image_external_essl3 : require\n" // use GL_OES_EGL_image_external_essl3 is available
155  "#define " + std::string(DIALECT_TEXTURE_SAMPLING_FUNC) + "(S, C) texture(S, C)\n" // sampling function is texture()
156  "#else\n"
157  "#extension GL_OES_EGL_image_external : require\n" // fall back to GL_OES_EGL_image_external
158  "lowp vec4 " + std::string(DIALECT_TEXTURE_SAMPLING_FUNC) + "(samplerExternalOES sampler, mediump vec2 coord) { return texture2D(sampler, coord); }\n"
159  "#endif\n"
160  "#define " + std::string(DIALECT_SAMPLER_DECL_TYPE) + " samplerExternalOES\n";
161  }
162  else
163  src += "#define " + std::string(DIALECT_SAMPLER_DECL_TYPE) + " sampler2D\n"
164  "#define " + std::string(DIALECT_TEXTURE_SAMPLING_FUNC) + "(S, C) texture2D(S, C)\n";
165 
166  // add the rest after declaring extensions
167  if (mapToModernGlsl)
168  src += "#define varying in\n"
169  "#define texture2D(S, C) texture(S, C)\n"
170  "#define gl_FragColor beatmupFrgClrVar\n"
171  "out mediump vec4 beatmupFrgClrVar;\n";
172 
173  // append the source code
174  src += "#line 0\n" + source;
175  }
176 
177  // check for external texture extension (not supported without dialect)
179  throw GL::GLException("External texture extension is only supported with Beatmup dialect extension");
180 
181  // check if all extensions are processed
182  if (ext)
183  throw GL::GLException("Cannot interpret extensions set " + std::to_string(extensions));
184 
185  // compile
186  Shader::compile(gpu, src.c_str());
187 }
188 
189 
190 #ifndef BEATMUP_OPENGLVERSION_GLES20
192  glGenBuffers(1, &handle);
193  glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, handle);
194  glBufferData(GL_ATOMIC_COUNTER_BUFFER, sizeof(GLuint), nullptr, GL_STATIC_DRAW);
195  GL::GLException::check("creating atomic counter");
196 }
197 
198 
200  glDeleteBuffers(1, &handle);
201 }
202 
203 
204 void AtomicCounter::set(unsigned int value) {
205  GLuint *data;
206  glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, handle);
207  data = (GLuint*)glMapBufferRange(GL_ATOMIC_COUNTER_BUFFER, 0, sizeof(GLuint),
208  GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
209  data[0] = value;
210  glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
211  GL::GLException::check("setting atomic counter value");
212 }
213 #endif
214 
215 
217  handle = glCreateProgram();
218 }
219 
220 
222  glDeleteProgram(handle);
223 }
224 
225 
227  GLint status;
228  glGetProgramiv(handle, GL_LINK_STATUS, &status);
229  if (status == GL_TRUE)
230  return;
231  GLint logLength;
232  glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &logLength);
233  if (logLength > 0) {
234  GLchar* log = (GLchar*)malloc(logLength);
235  glGetProgramInfoLog(handle, logLength, &logLength, log);
236  throw GL::GLException((char*)log);
237  free(log);
238  }
239  else
240  throw GL::GLException("Program linking failed (no log).");
241 }
242 
243 
245  uniformsCache.clear();
246  attribsCache.clear();
247 }
248 
249 
251  glUseProgram(handle);
252  GL::GLException::check("enabling a program");
253 }
254 
255 
256 #ifndef BEATMUP_OPENGLVERSION_GLES20
258  GLsizei length;
259  glGetProgramiv(handle, GL_PROGRAM_BINARY_LENGTH, &length);
260  GL::GLException::check("querying program size");
261 
262  // setting up a chunk: first sizeof(GLenum) bytes store the binary format
263  Chunk* result = new Chunk(sizeof(GLenum) + (size_t)length);
264  glGetProgramBinary(handle, length, nullptr, result->ptr<GLenum>(0), result->ptr<GLenum>(1));
265  GL::GLException::check("getting binary");
266  return result;
267 }
268 
269 
270 void AbstractProgram::loadBinary(const Chunk& binary) {
271  // convention: first sizeof(GLenum) bytes store the binary format
272  glProgramBinary(handle, binary.at<GLenum>(0), binary.ptr<GLenum>(1), binary.size() - sizeof(GLenum));
273  GL::GLException::check("loading program binary");
274 }
275 #endif
276 
277 
279  return glGetUniformLocation(handle, name);
280 }
281 
282 
284  return glGetAttribLocation(handle, name);
285 }
286 
287 
289  auto it = uniformsCache.find(name);
290  if (it != uniformsCache.end())
291  return it->second;
292  handle_t location = glGetUniformLocation(handle, name.c_str());
293  uniformsCache[name] = location;
294  return location;
295 }
296 
297 
299  auto it = attribsCache.find(name);
300  if (it != attribsCache.end())
301  return it->second;
302  handle_t location = glGetAttribLocation(handle, name.c_str());
303  attribsCache[name] = location;
304  return location;
305 }
306 
307 
308 void AbstractProgram::setInteger(const std::string& name, const int value, bool safe) {
309  if (safe) {
310  GLint location = getUniformLocation(name);
311  if (location == -1)
312  return;
313  glUniform1i(location, (GLint)value);
314  }
315  else
316  glUniform1i(getUniformLocation(name), (GLint)value);
317 #ifdef BEATMUP_DEBUG
318  GL::GLException::check("setting integer in program");
319 #endif
320 }
321 
322 
323 void AbstractProgram::setUnsignedInteger(const std::string& name, const unsigned int value, bool safe) {
324  if (safe) {
325  GLint location = getUniformLocation(name);
326  if (location == -1)
327  return;
328 #ifdef BEATMUP_OPENGLVERSION_GLES20
329  glUniform1i(location, (GLint)value);
330 #else
331  glUniform1ui(location, (GLuint)value);
332 #endif
333  }
334  else {
335 #ifdef BEATMUP_OPENGLVERSION_GLES20
336  glUniform1i(getUniformLocation(name), (GLint)value);
337 #else
338  glUniform1ui(getUniformLocation(name), (GLuint)value);
339 #endif
340  }
341 #ifdef BEATMUP_DEBUG
342  GL::GLException::check("setting integer in program");
343 #endif
344 }
345 
346 
347 void AbstractProgram::setFloat(const std::string& name, const float value, bool safe) {
348  if (safe) {
349  GLint location = getUniformLocation(name);
350  if (location == -1)
351  return;
352  glUniform1f(location, (GLfloat)value);
353  }
354  else
355  glUniform1f(getUniformLocation(name), (GLfloat)value);
356 #ifdef BEATMUP_DEBUG
357  GL::GLException::check("setting float in program");
358 #endif
359 }
360 
361 
362 void AbstractProgram::setVector2(const std::string& name, const float x, const float y) {
363  glUniform2f(getUniformLocation(name), x, y);
364 #ifdef BEATMUP_DEBUG
365  GL::GLException::check("setting vector 2 in program");
366 #endif
367 }
368 
369 
370 void AbstractProgram::setVector3(const std::string& name, const float x, const float y, const float z) {
371  glUniform3f(getUniformLocation(name), x, y, z);
372 #ifdef BEATMUP_DEBUG
373  GL::GLException::check("setting vector 3 in program");
374 #endif
375 }
376 
377 
378 void AbstractProgram::setVector4(const std::string& name, const float x, const float y, const float z, const float w) {
379  glUniform4f(getUniformLocation(name), x, y, z, w);
380 #ifdef BEATMUP_DEBUG
381  GL::GLException::check("setting vector 4 in program");
382 #endif
383 }
384 
385 
386 void AbstractProgram::setVector4(const std::string& name, const color4i& color, const float outRange) {
387  const float scale = outRange / 255;
388  setVector4(name, scale * color.r, scale * color.g, scale * color.b, scale * color.a);
389 }
390 
391 
392 void AbstractProgram::setMatrix2(const std::string& name, const Matrix2& mat) {
393  GLfloat m[4] = { 1, 0, 0, 1 };
394  mat.getElements(m[0], m[2], m[1], m[3]);
395  glUniformMatrix2fv(getUniformLocation(name), 1, false, m);
396 #ifdef BEATMUP_DEBUG
397  GL::GLException::check("setting matrix 2x2 in program");
398 #endif
399 }
400 
401 
402 void AbstractProgram::setMatrix3(const std::string& name, const Matrix2& mat, const Point& pos) {
403  GLfloat m[9] = { 1, 0, 0, 0, 1, 0, pos.x, pos.y, 1 };
404  mat.getElements(m[0], m[3], m[1], m[4]);
405  glUniformMatrix3fv(getUniformLocation(name), 1, false, m);
406 #ifdef BEATMUP_DEBUG
407  GL::GLException::check("setting matrix 3x3 in program");
408 #endif
409 }
410 
411 
412 void AbstractProgram::setMatrix3(const std::string& name, const AffineMapping& mapping) {
414 }
415 
416 
417 void AbstractProgram::setIntegerArray(const std::string& name, const int* values, const int length) {
418  if (sizeof(GLint) != sizeof(int)) {
419  GLint* convValues = new GLint[length];
420  for (int i = 0; i < length; ++i)
421  convValues[i] = values[i];
422  glUniform1iv(getUniformLocation(name), length, convValues);
423  delete[] convValues;
424  }
425  else {
426  glUniform1iv(getUniformLocation(name), length, values);
427  }
428 #ifdef BEATMUP_DEBUG
429  GL::GLException::check("setting integer array in program");
430 #endif
431 }
432 
433 
434 void AbstractProgram::setIntegerArray(const std::string& name, const int firstValue, const int length) {
435  static const int STORAGE_LEN = 8;
436  GLint storage[STORAGE_LEN];
437  const bool alloc = length > STORAGE_LEN;
438  GLint* values = alloc ? new GLint[length] : storage;
439  for (int i = 0; i < length; ++i)
440  values[i] = firstValue + i;
441  glUniform1iv(getUniformLocation(name), length, values);
442  if (alloc)
443  delete[] values;
444 #ifdef BEATMUP_DEBUG
445  GL::GLException::check("setting integer array in program");
446 #endif
447 }
448 
449 
450 void AbstractProgram::setFloatArray(const std::string& name, const float* values, const int length) {
451  glUniform1fv(getUniformLocation(name), length, values);
452 #ifdef BEATMUP_DEBUG
453  GL::GLException::check("setting float array in program");
454 #endif
455 }
456 
457 
458 void AbstractProgram::setVec2Array(const std::string& name, const float* xy, const int length) {
459  glUniform2fv(getUniformLocation(name), length, xy);
460 #ifdef BEATMUP_DEBUG
461  GL::GLException::check("setting vec2 array in program");
462 #endif
463 }
464 
465 
466 void AbstractProgram::setVec4Array(const std::string& name, const float* xyzw, const int length) {
467  glUniform4fv(getUniformLocation(name), length, xyzw);
468 #ifdef BEATMUP_DEBUG
469  GL::GLException::check("setting vec4 array in program");
470 #endif
471 }
472 
473 
474 void AbstractProgram::bindSampler(GraphicPipeline& gpu, GL::TextureHandler& image, const char* uniformId, TextureParam param) {
475  handle_t uniform = getUniformLocation(uniformId);
476  GLint unit;
477  glGetUniformiv(getHandle(), uniform, &unit);
478  GL::GLException::check("binding sampler in program");
479  gpu.bind(image, unit, param);
480 }
481 
482 
483 void AbstractProgram::bindImage(GraphicPipeline& gpu, GL::TextureHandler& image, const char* uniformId, bool read, bool write) {
484  handle_t uniform = getUniformLocation(uniformId);
485  GLint unit;
486  glGetUniformiv(getHandle(), uniform, &unit);
487  GL::GLException::check("binding image in program");
488  gpu.bind(image, unit, read, write);
489 }
490 
491 
492 #ifndef BEATMUP_OPENGLVERSION_GLES20
494  glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, unit, counter.handle);
495  GL::GLException::check("binding atomic counter");
496 }
497 #endif
498 
499 
501 
502 
504  AbstractProgram(gpu)
505 {
506  link(vertex, fragment);
507 }
508 
509 
510 void Program::link(const VertexShader& vertexShader, const FragmentShader& fragmentShader) {
511  glAttachShader(getHandle(), vertexShader.handle);
512  glAttachShader(getHandle(), fragmentShader.handle);
513  glLinkProgram(getHandle());
514  glDetachShader(getHandle(), vertexShader.handle);
515  glDetachShader(getHandle(), fragmentShader.handle);
516  assertLinked();
517  GL::GLException::check("program linking");
518  clearCaches();
519 }
520 
521 
523  RenderingProgram(gpu, gpu.getDefaultVertexShader(), fragmentShader)
524 {}
525 
526 
527 RenderingProgram::RenderingProgram(const GraphicPipeline& gpu, const VertexShader& vertexShader, const FragmentShader& fragmentShader):
528  Program(gpu)
529 {
532 
533  // link
534  Program::link(vertexShader, fragmentShader);
535 
536  // setting common stuff
537  enable(gpu);
540 }
541 
542 
543 void RenderingProgram::link(const GraphicPipeline& gpu, const FragmentShader& fragmentShader) {
544  Program::link(gpu.getDefaultVertexShader(), fragmentShader);
545 }
546 
547 
548 void RenderingProgram::blend(bool onScreen) {
550  blend();
551 }
552 
553 
555  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
556 }
2x3 affine mapping containing a 2x2 matrix and a 2D point
Definition: geometry.h:639
static const AffineMapping IDENTITY
Definition: geometry.h:717
Simply a piece of binary data of a specific size.
Definition: chunkfile.h:210
datatype * ptr(size_t offset=0)
Definition: chunkfile.h:264
datatype at(size_t offset) const
Definition: chunkfile.h:271
size_t size() const
Definition: chunkfile.h:257
Basic GLSL program.
Definition: program.h:135
std::map< std::string, handle_t > uniformsCache
Definition: program.h:137
void setUnsignedInteger(const std::string &name, const unsigned int value, bool safe=false)
Definition: program.cpp:323
void setMatrix2(const std::string &name, const Matrix2 &mat)
Definition: program.cpp:392
handle_t getAttribLocation(const std::string &name)
Retrieves attribute location by its name.
Definition: program.cpp:298
void setVec2Array(const std::string &name, const float *xy, const int length)
Definition: program.cpp:458
handle_t getHandle() const
Definition: program.h:142
handle_t findUniformLocation(const char *name)
Retrieves uniform variable location by its name.
Definition: program.cpp:278
void bindSampler(GraphicPipeline &gpu, GL::TextureHandler &image, const char *uniformId, TextureParam param)
Definition: program.cpp:474
void bindAtomicCounter(GraphicPipeline &gpu, AtomicCounter &counter, int unit)
Definition: program.cpp:493
void setInteger(const std::string &name, const int value, bool safe=false)
Assigns a value to a specific integer variable in the program.
Definition: program.cpp:308
Chunk * getBinary() const
Definition: program.cpp:257
void enable(const GraphicPipeline &gpu)
Definition: program.cpp:250
void loadBinary(const Chunk &binary)
Definition: program.cpp:270
void setIntegerArray(const std::string &name, const int *values, const int length)
Definition: program.cpp:417
void setFloatArray(const std::string &name, const float *values, const int length)
Definition: program.cpp:450
void setVec4Array(const std::string &name, const float *xyzw, const int length)
Definition: program.cpp:466
handle_t getUniformLocation(const std::string &name)
Retrieves uniform variable location by its name.
Definition: program.cpp:288
void setVector3(const std::string &name, const float x, const float y, const float z)
Definition: program.cpp:370
void setFloat(const std::string &name, const float value, bool safe=false)
Assigns a value to a specific floating point variable in the program.
Definition: program.cpp:347
void setVector4(const std::string &name, const float x, const float y, const float z, const float w)
Definition: program.cpp:378
std::map< std::string, handle_t > attribsCache
Definition: program.h:137
handle_t findAttribLocation(const char *name)
Retrieves attribute location by its name.
Definition: program.cpp:283
void bindImage(GraphicPipeline &gpu, GL::TextureHandler &image, const char *uniformId, bool read, bool write)
Definition: program.cpp:483
AbstractProgram(const AbstractProgram &)=delete
disabling copying constructor
void setMatrix3(const std::string &name, const Matrix2 &mat, const Point &pos)
Definition: program.cpp:402
void setVector2(const std::string &name, const float x, const float y)
Definition: program.cpp:362
void set(unsigned int value)
Definition: program.cpp:204
AtomicCounter(const GraphicPipeline &gpu)
Definition: program.cpp:191
GLSL fragment shader.
Definition: program.h:107
static const char * DIALECT_SAMPLER_DECL_TYPE
glsl type name to declare a texture in Beatmup dialect
Definition: program.h:109
FragmentShader(const GraphicPipeline &gpu)
Definition: program.cpp:118
static const char * DIALECT_TEXTURE_SAMPLING_FUNC
glsl function name to sample a texture in Beatmup dialect
Definition: program.h:110
void compile(const GraphicPipeline &gpu, const std::string &source, Extensions extensions=Extensions::NONE)
Definition: program.cpp:121
GPU exception.
Definition: bgl.h:56
static void check(const std::string &info)
Definition: bgl.h:62
Regular OpenGL program.
Definition: program.h:229
Program(const GraphicPipeline &gpu)
Definition: program.cpp:500
void link(const VertexShader &, const FragmentShader &)
Definition: program.cpp:510
GLSL program to render images Makes use of default vertex attributes to pass the texture coordinates ...
Definition: program.h:240
void link(const GraphicPipeline &gpu, const FragmentShader &)
Definition: program.cpp:543
RenderingProgram(const GraphicPipeline &gpu, const FragmentShader &)
Definition: program.cpp:522
static const char * TEXTURE_COORD_ATTRIB_NAME
texture coordinate attribute name in vertex shaders
static const char * VERTEX_COORD_ATTRIB_NAME
vertex coordinate attribute name in vertex shaders
static const char * VERTICAL_FLIP_ID
Vertical flipping variable name in vertex shader.
static const char * MODELVIEW_MATRIX_ID
Modelview matrix (mapping input geometry to output) shader variable name in vertex shader.
GLSL shader base class.
Definition: program.h:75
uint32_t type
Definition: program.h:80
Shader(const Shader &)=delete
disabling copying constructor
handle_t handle
Definition: program.h:79
void compile(const GraphicPipeline &gpu, const char *source)
Definition: program.cpp:50
GLSL vertex shader.
Definition: program.h:93
VertexShader(const GraphicPipeline &gpu)
Definition: program.cpp:75
void compile(const GraphicPipeline &gpu, const std::string &source, Extensions extensions=Extensions::NONE)
Definition: program.cpp:78
Internal low-level GPU control API.
Definition: pipeline.h:33
const GL::VertexShader & getDefaultVertexShader() const
Definition: pipeline.h:126
int getGlslVersion() const
Returns GLSL language version supported by the GPU context being used.
Definition: pipeline.cpp:956
static const int ATTRIB_TEXTURE_COORD
texture coordinate attribute index in the VBO
Definition: pipeline.h:67
void bind(GL::TextureHandler &texture, size_t texUnit, const TextureParam param)
Definition: pipeline.cpp:881
static const int ATTRIB_VERTEX_COORD
vertex coordinate attribute index in the VBO
Definition: pipeline.h:66
bool isGlEsCompliant() const
Returns true if the GPU context is OpenGL ES-compliant.
Definition: pipeline.cpp:961
void write(Bitmap &bitmap, Args &&... args)
Calls a Func< WriterClass >::process(access, params) that writes to a bitmap of any kind,...
Definition: processing.h:90
void read(Bitmap &bitmap, Args &&... args)
Calls a Func< ReaderClass >::process(access, params), where.
Definition: processing.h:49
Extensions operator-=(Extensions &set, Extensions entry)
Definition: program.cpp:30
unsigned int handle_t
A reference to a GPU resource.
Definition: basic_types.h:61
Extensions
Supported OpenGL estensions.
Definition: program.h:63
@ BEATMUP_DIALECT
pseudo-extension enabling Beatmup GLSL dialect
Definition: program.h:65
@ EXTERNAL_TEXTURE
GL_OES_EGL_image_external_essl3 if available or GL_OES_EGL_image_external.
Definition: program.h:66
Extensions operator+(Extensions lhs, Extensions rhs)
Definition: program.cpp:35
TextureParam
Parameters of binding a texture to a texture unit on GPU.
std::string to_string(Beatmup::NNets::ActivationFunction function)
JNIEnv jlong jint jint jint jint jfloat scale
JNIEnv jobject jint jint jint jfloat fragment
return(jlong) new Beatmup jlong jstring name
jlong jstring jint jint jint z
jobject jlong jint jint y
jlong jstring jint jint jint jint w
Beatmup::IntPoint result
jobject jlong jint x
jlong jintArray xy
* mat
return(jlong) new Beatmup jlong jstring src
Beatmup::AffineMapping & mapping