GLSL fragment shader.
More...
#include <program.h>
GLSL fragment shader.
Definition at line 107 of file program.h.
◆ FragmentShader() [1/2]
Definition at line 118 of file program.cpp.
118 :
Shader(gpu, GL_FRAGMENT_SHADER) {
Shader(const Shader &)=delete
disabling copying constructor
◆ FragmentShader() [2/2]
Beatmup::GL::FragmentShader::FragmentShader |
( |
const GraphicPipeline & |
gpu, |
|
|
const std::string & |
source, |
|
|
Extensions |
extensions = Extensions::NONE |
|
) |
| |
|
inline |
Definition at line 113 of file program.h.
115 compile(gpu, source.c_str(), extensions);
FragmentShader(const GraphicPipeline &gpu)
void compile(const GraphicPipeline &gpu, const std::string &source, Extensions extensions=Extensions::NONE)
◆ compile()
void FragmentShader::compile |
( |
const GraphicPipeline & |
gpu, |
|
|
const std::string & |
source, |
|
|
Extensions |
extensions = Extensions::NONE |
|
) |
| |
Definition at line 121 of file program.cpp.
122 std::string
src(source);
130 bool mapToModernGlsl =
false;
134 src =
"#version 100\n";
137 src =
"#version 300 es\n";
138 mapToModernGlsl =
true;
143 src =
"#version 100\n";
146 src =
"#version 130\n";
147 mapToModernGlsl =
true;
153 src +=
"#ifdef GL_OES_EGL_image_external_essl3\n"
154 "#extension GL_OES_EGL_image_external_essl3 : require\n"
157 "#extension GL_OES_EGL_image_external : require\n"
158 "lowp vec4 " + std::string(
DIALECT_TEXTURE_SAMPLING_FUNC) +
"(samplerExternalOES sampler, mediump vec2 coord) { return texture2D(sampler, coord); }\n"
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";
174 src +=
"#line 0\n" + source;
179 throw GL::GLException(
"External texture extension is only supported with Beatmup dialect extension");
static const char * DIALECT_SAMPLER_DECL_TYPE
glsl type name to declare a texture in Beatmup dialect
static const char * DIALECT_TEXTURE_SAMPLING_FUNC
glsl function name to sample a texture in Beatmup dialect
void compile(const GraphicPipeline &gpu, const char *source)
int getGlslVersion() const
Returns GLSL language version supported by the GPU context being used.
bool isGlEsCompliant() const
Returns true if the GPU context is OpenGL ES-compliant.
Extensions
Supported OpenGL estensions.
@ BEATMUP_DIALECT
pseudo-extension enabling Beatmup GLSL dialect
@ EXTERNAL_TEXTURE
GL_OES_EGL_image_external_essl3 if available or GL_OES_EGL_image_external.
std::string to_string(Beatmup::NNets::ActivationFunction function)
return(jlong) new Beatmup jlong jstring src
◆ DIALECT_SAMPLER_DECL_TYPE
const char * FragmentShader::DIALECT_SAMPLER_DECL_TYPE = "beatmupSampler" |
|
static |
glsl type name to declare a texture in Beatmup dialect
Definition at line 109 of file program.h.
◆ DIALECT_TEXTURE_SAMPLING_FUNC
const char * FragmentShader::DIALECT_TEXTURE_SAMPLING_FUNC = "beatmupTexture" |
|
static |
glsl function name to sample a texture in Beatmup dialect
Definition at line 110 of file program.h.
The documentation for this class was generated from the following files: