JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
Shader Class Reference

Fragment or vertex GLSL shader. More...

#include <jngl/Shader.hpp>

Public Types

enum class  Type { VERTEX , FRAGMENT }
 Type of a Shader. To link a ShaderProgram, one shader of each type is needed. More...
 

Public Member Functions

 Shader (const char *source, Type, const char *gles20Source=nullptr)
 Creates a vertex or fragment shader by compiling it. More...
 
 Shader (const std::istream &source, Type)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
 Shader (const std::istream &source, Type, const std::istream &gles20Source)
 
 Shader (const Shader &)=delete
 
 Shader (Shader &&)=delete
 
Shaderoperator= (const Shader &)=delete
 
Shaderoperator= (Shader &&)=delete
 

Friends

class ShaderProgram
 

Detailed Description

Fragment or vertex GLSL shader.

Definition at line 12 of file Shader.hpp.

Member Enumeration Documentation

◆ Type

enum class Type
strong

Type of a Shader. To link a ShaderProgram, one shader of each type is needed.

Definition at line 15 of file Shader.hpp.

Constructor & Destructor Documentation

◆ Shader() [1/2]

Shader ( const char *  source,
Type  ,
const char *  gles20Source = nullptr 
)

Creates a vertex or fragment shader by compiling it.

Parameters
sourceSource code using either GLSL v3.30 or GLSL ES v3.00.
gles20SourceSource code using GLSL v1.00 for OpenGL ES 2.0

◆ Shader() [2/2]

Shader ( const std::istream source,
Type   
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

jngl::Shader foo(jngl::readAsset("foo.frag"), jngl::Shader::Type::FRAGMENT);
Fragment or vertex GLSL shader.
Definition: Shader.hpp:12
std::stringstream readAsset(const std::string &filename)
Returns a stringstream containing the whole file. This will read from the .apk on Android.

Friends And Related Function Documentation

◆ ShaderProgram

friend class ShaderProgram
friend

Definition at line 43 of file Shader.hpp.


The documentation for this class was generated from the following file: