emilib
Namespaces | Classes | Typedefs | Enumerations | Functions
gl Namespace Reference

OpenGL wrapper classes. More...

Namespaces

 FF
 Functionality for mimicking fixed function with shaders easily.
 

Classes

class  FBO
 An off-screen buffer you can draw onto. More...
 
class  MeshPainter
 
class  PaintGrouper
 
class  Program
 
struct  ProgramSource
 
struct  Rectangle
 
struct  Size
 
class  TempViewPort
 Will set a viewport and restore the old viewport on death. More...
 
struct  TexParams
 
class  Texture
 
class  TriangleStrip
 
class  VAO
 
class  VBO
 
struct  VertComp
 
class  VertexFormat
 

Typedefs

using GLenum = unsigned int
 
using GLuint = unsigned int
 
using Program_UP = std::unique_ptr< Program >
 
using Program_SP = std::shared_ptr< Program >
 
using Texture_UP = std::unique_ptr< Texture >
 
using Texture_SP = std::shared_ptr< Texture >
 
using VBO_UP = std::unique_ptr< VBO >
 
using VBO_SP = std::shared_ptr< VBO >
 
using VAO_UP = std::unique_ptr< VAO >
 
using VAO_SP = std::shared_ptr< VAO >
 
using MeshPainter_UP = std::unique_ptr< MeshPainter >
 
using MeshPainter_SP = std::shared_ptr< MeshPainter >
 
using FBO_UP = std::unique_ptr< FBO >
 
using FBO_SP = std::shared_ptr< FBO >
 

Enumerations

enum  Normalize { DONT_NORMALIZE, NORMALIZE }
 
enum  Usage { WRITE_ONCE_READ_MANY, WRITE_MANY_READ_MANY, WRITE_ONCE_READ_ONCE }
 For VBO:s and the like.
 
enum  ImageFormat {
  INVALID, ImageFormat::Alpha8, ImageFormat::Red8, ImageFormat::RGB24,
  ImageFormat::RGBA32, ImageFormat::BGRA32, ImageFormat::AlphaHF, ImageFormat::RGBAHF,
  ImageFormat::RGBAf
}
 
enum  TexFilter { Nearest, Linear, Mipmapped, TexFilter::DontCare }
 
enum  WrapMode { Repeat, Mirror, Clamp, DontCare }
 

Functions

void init_glew ()
 
bool supports_mipmaps_for (Size size)
 
Texture load_uncompressed_pvr2_from_memory (const void *data, size_t num_bytes, TexParams params, std::string debug_name)
 
Program compile_program (const std::string &vs, const std::string &fs, const std::string &debug_name)
 
Program compile_program (const ProgramSource &program_source)
 
ProgramSource create_ff (int flags)
 flags should be a combo if FF::FF_Flags
 
Program compile_ff_program (int flags)
 flags should be a combo if FF::FF_Flags
 
void bind_prog_and_attributes (const VertexFormat &vf, const Program &program)
 
constexpr int format_size (ImageFormat format)
 byte size per pixel
 
constexpr bool is_half (ImageFormat f)
 
void check_for_gl_error (const char *file, int line)
 
void bind_imgui_painting ()
 
void unbind_imgui_painting ()
 Call this to stop using gl_lib to paint Dear ImGui.
 
gl::Texture load_pvr (const char *path, gl::TexParams params)
 iOS only!
 

Detailed Description

OpenGL wrapper classes.

Enumeration Type Documentation

◆ ImageFormat

enum gl::ImageFormat
strong
Enumerator
Alpha8 

One byte.

Red8 

One byte.

RGB24 

Three bytes.

RGBA32 

Four bytes.

BGRA32 

GL_BGRA - Four bytes.

AlphaHF 

16-bit half-float, alpha channel only.

RGBAHF 

RGBA Half-float.

RGBAf 

32bit float RGBA

◆ TexFilter

enum gl::TexFilter
strong
Enumerator
DontCare 

Best based on size.

Function Documentation

◆ bind_imgui_painting()

void gl::bind_imgui_painting ( )

Call this to use gl_lib to paint Dear ImGui. Call once at the start of your program. Will modify OmGui::GetIO().RenderDrawListsFn and OmGui::GetIO().Fonts->TexID Tested on MacOS and iOS

◆ compile_program()

Program gl::compile_program ( const std::string &  vs,
const std::string &  fs,
const std::string &  debug_name 
)

Uses the same syntax for all OpenGL versions, including GL ES. VertexShader: vs_in/vs_out instead of attribute/varying. PixelShader: fs_in instead of varying, write to out_FragColor.

◆ load_uncompressed_pvr2_from_memory()

Texture gl::load_uncompressed_pvr2_from_memory ( const void *  data,
size_t  num_bytes,
TexParams  params,
std::string  debug_name 
)

Assumes legacy PVR (version 2). Returns a default texture (has_data() == false) if the given memory does not contain an uncompressed PVR.