-
Notifications
You must be signed in to change notification settings - Fork 29
Engine Core
-
- Initializes GLFW&GLEW on first Context creation
- Stores hardware GPU limitations (extension list, shader limits)
- Terminates GLFW if there are no contexts anymore
Writes supported extensions to extensions.txt file.
Checks if name extension is supported.
-
Holds every created context and its state to reduce number of state changes.
Allows to get ContextState* dependent on current thread by using with glfwGetCurrentContext().
Set the viewport.
Specify clear values for the color buffers.
Clear buffers to preset values.
Enable or disable server-side GL capabilities.
Specify the value used for depth buffer comparisons.
Enable or disable writing into the depth buffer.
Specify whether front- or back-facing facets can be culled.
Define front- and back-facing polygons.
Select a polygon rasterization mode.
-
Creates a window and its associated context.
- Resizable - specifies whether the windowed mode window will be resizable by the user.
- Visible - specifies whether the windowed mode window will be initially visible.
- Decorated - specifies whether the windowed mode window will have window decorations.
- Focused - specifies whether the windowed mode window will be given input focus when created.
- AutoIconify - specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss.
- Maximized - specifies whether the windowed mode window will be maximized when created.
- Samples - specifies the desired number of samples to use for multisampling.
Constructs window with specified window title, window size and hints described above.
Context(std::string_view title, glm::uvec2 size, const Context& shared, const WindowHints& hints = WindowHints{});
Constructs window with shared context resources. Used by threaded asset loader.
Makes the context current for the current thread.
Swaps the front and back buffers.
Processes event queue events.
Sets the swap interval.
Sets the close flag of the specified window.
Sets the icon for the specified window.
Sets the cursor mode.
Sets the cursor icon.
Resizes the window.
Sets the aspect ratio.
Sets fullscreen.
Sets window position.
Returns close flag of the window.
Iconifies/Restores the window.
Hides/Shows the window.
Makes window focused.
Returns specified window parameters.
-
Creates a context with window event observers.
- FramebufferObserver
- MouseClickObserver
- MouseMoveObserver
- KeyObserver
- ScrollObserver
Registers the observer to window.
Removes the observer from window observers.
Allows to get InputState for specified key.
- Left
- Right
- Middle
- Released
- Pressed
- Repeat
- Shift
- Control
- Alt
- Super
- CapsLock
- NumLock
-
Class that manages GLSL code of specified shader type.
Supports include directive in GLSL file. Usage: #include "filename" - includes text of filename file in shaders directory.
Loads GLSL code at specified path and manipulates this. Throws shader_file_not_found exception if no such file exists. Replaces:
- GraphicsEngine::GLSL_VERSION to version specified in ContextInitializer class.
- GraphicsEngine::Extensions to supported and used extensions for rendering.
- All include directives
Returns its shader id.
Replaces all entries of key with value in shader code.
Compiles shader. If there are any errors occured, throws shader_compilation_error exception and outputs log&sourcecode to _shader_compilation_error _file.
-
Compiles and links shader program from specified shaders.
Specifies shader that should be linked to program. Takes ownership of the shader.
Attaches shaders and links program. Returns shared pointer to ShaderProgram. Throws shader_linking_error on linking errors.
std::shared_ptr<ShaderProgram> compile(const fs::path& path, const ShaderAction& actions = ShaderAction{});
Tries to build a whole shader program from specified path. Searches each shader type using file extensions described below:
- ".vs" vertex shader
- ".tcs" tesselation control shader
- ".tes" tesselation evaluation shader
- ".gs" geometry shader
- ".fs" fragment shader
- ".cs" compute shader
In addition may execute required ShaderActions on each found shader. ShaderAction is
std::function<void(Shader&)>
. -
OpenGL object that stores an array of unformatted memory allocated by context.
- Array The buffer will be used as a source for vertex data.
- Element The buffer will be used as a source for indexed rendering commands.
- Uniform Indexed buffer. The Buffer Object will be used to store uniform data. Can be used to share uniforms between different programs, as well as quickly change between sets of uniforms for the same program object.
- ShaderStorage Indexed buffer. A lot like Uniform buffer. Can be used to store and retrieve data. Requires GL_ARB_shader_storage_buffer_object extension.
- AtomicCounter Indexed buffer. Storage for atomic counters. Requires ARB_shader_atomic_counters extension.
- IndirectDraw The buffer will be used as the source for the indirect data when performing indirect rendering.
- IndirectDispatch The buffer will be used as the source for indirect compute dispatch operations. Requires GL_ARB_compute_shader extension.
Usage: Buffer::Usage for mutable buffer. Actually, this is just hints for server side used as coombination.
Based on action:
- Read
- Draw
- Copy
Based on frequency:
- Static
- Dynamic
- Stream
Storage: Buffer::Storage for immutable buffer. Requires GL_ARB_buffer_storage extension. Specifies the intended usage of the buffer's data store.
- Static No further data updates.
- Dynamic The contents of the data store may be updated after creation.
- Client A hint that the buffer object's data should be stored in client memory.
- DynamicWrite The data store may be mapped for write access.
- DynamicPersistenceWrite The pointer to the data store remains valid so long as the data store is mapped.
- DynamicCoherentWrite Data written to the store by either the client or server will be immediately visible to the other one.
- None Access to data is not required.
- Write Buffer will be possible to write to.
- WriteOrphaning Buffer will be possible to write to by using orphaning method.
- WriteUnsync Unsychronized access to write.
- None Access to data is not required.
- WritePersistence Buffer may be used for persistence writes.
- WriteCoherent Buffer may be used for coherent writes.
- StateBuffer Simple buffer that uses context state while performing buffer-commands. Requires no extensions.
- NamedBuffer The Buffer uses DSA(Direct State Access) to perform buffer-commands, requires no state changes but GL_ARB_direct_state_access is needed.
- TripleBuffer The buffer used for round-robin data store updates that allows to avoid sync object stalls.
StateBuffer(Type target, size_t size, const void* data, Usage usage, MutableAccess access) noexcept;
NamedBuffer(Type target, size_t size, const void* data, Usage usage, MutableAccess access) noexcept;
Creates mutable buffer that stores data specified by _size _and data.
Creates immutable buffer that stores data specified by _size _and data.
Binds the buffer to current thread context.
Binds the buffer to current thread context using specified target as bind point.
Binds the buffer to current thread context indexed binding point. Widly used by Indexed buffers.
Binds the buffer to current thread context indexed binding point using specified target.
As functions above, just binds only part of the buffer.
void clearSubData(GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void* data) const noexcept;
void clearData(GLenum internalformat, GLenum format, GLenum type, const void* data) const noexcept override;
Clears the buffer data with fixed value.
Updates the buffer subset.
Updates the buffer using mapping pointer, avoids one copying.
Creates fence sync object if access is either WriteUnsync or Persistence/Coherent mapping. Indicates that previous commands are finished. Should be used with Unsync/Persistent/Coherent mapping to prevent unpredictable results.
Waits for sync object if it exists.
Gets specified buffer parameters.
-
Object that stores all of the state needed to supply vertex data.
Describes where an attribute gets its array data from and defines how to interpret that data.
struct VertexAttribute { GLint size; GLenum type; GLboolean normalized; GLsizei stride; const GLvoid* pointer; Buffer& buffer; };
- size; Specifies the number of components per vertex attribute. Must be 1, 2, 3, 4.
- type; Specifies the data type of each component in the array.
- normalized; Specifies whether fixed-point data values should be normalized or directly accessed.
- stride; Specifies the byte offset between consecutive generic vertex attributes.
- pointer; Specifies a offset of the first component of the first generic vertex attribute.
- buffer; Specified the buffer where an attribute gets its data from.
Specifies attribute that should be at current index. Increases index by one. Default value is zero.
Specifies Element Buffer that will be used as source for indexed drawing.
Binds vertex array to current thread context.
Enables or disables attribute at specified index.
Gets vertex array id.
-
Object that contains one or more images that all have the same image format.
There are a number of different types:
- Tex2D
- Tex3D
- CubeMap
- Tex2DArray
- TexCubeMapArray
- Tex2DMS
- Depth
- Depth16/32/32F
- R/G/B
- RGB8/16/16F/32/32F
- DepthComponent
- StencilIndex
- DepthStencil
- Red/Green/Blue
- RG/RGB/RGBA
- Unsigned Byte
- Byte
- Unsigned short
- Short
- Unsigned int
- Int
- Float
- StateTexture
StateTexture uses context state for functionality.
- NamedTexture
NamedTexture uses DSA(Direct State Access) for functionality. Requires GL_ARB_direct_state_access.
- BindlessTexture
BindlessTexture does not use context state for functionality. Requires GL_ARB_bindless_texture.
StateTexture(Type target, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const void* data);
NamedTexture(Type target, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const void* data);
Creates 2D texture with specified parameters.
StateTexture(Type target, InternalFormat internal, glm::uvec3 size, Format format, DataType data_type, const void* data);
NamedTexture(Type target, InternalFormat internal, glm::uvec3 size, Format format, DataType data_type, const void* data);
Creates 3D texture / 2D texture array / empty cubemap array
StateTexture(Type target, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const std::array<void*, 6>& data);
NamedTexture(Type target, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const std::array<void*, 6>& data);
Creates cubemap texture.
StateTexture(Type target, GLsizei levels, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const void* data);
NamedTexture(Type target, GLsizei levels, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const void* data);
Creates immutable 2D texture with specified number of mipmap levels.
StateTexture(Type target, GLsizei levels, InternalFormat internal, glm::uvec3 size, Format format, DataType data_type, const void* data);
NamedTexture(Type target, GLsizei levels, InternalFormat internal, glm::uvec3 size, Format format, DataType data_type, const void* data);
Creates immutable 3D texture / 2D texture array / empty cubemap array with specified number of mipmap levels.
StateTexture(Type target, GLsizei levels, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const std::array<void*, 6>& data);
NamedTexture(Type target, GLsizei levels, InternalFormat internal, glm::uvec2 size, Format format, DataType data_type, const std::array<void*, 6>& data);
Creates immutable cubemap texture with specified number of mipmap levels.
NamedTexture(Type target, uint8_t samples, InternalFormat internal, glm::uvec2 size, bool immutable = false);
Creates multisampled 2D texture.
Binds the texture to index texture unit.
Resizes the texture.
Generates mipmap levels for mutable texture.
Sets the specified texture parameters.
Gets texture parameters.`
-
Framebuffer is a render target that contains images for render operations.
- Depth
- Stencil
- DepthStencil
- Color0-7
Specifies location that texture can be attached to.
Contains FramebufferAttachment, texture itself and optional layer-level.
Creates empty framebuffer.
Creates empty framebuffer that automatically resizes contained texture attachments on resize callback.
Adds texture attachment to the framebuffer.
Checks status of the framebuffer. If there are any errors, throws incomplete_framebuffer exception.
Clears the framebuffer.
Binds/Unbinds the framebuffer.
Specifies buffers where the framebuffer draws to.
Gets specified texture attachment.
Specifies texture attachment layer where the framebuffer draws to.
Binds default framebuffer.
-
Uniforms is a shader variables contained in shader program.
Gets UniformType. Can be Value or Sampler.
Gets UniformValueType contained by uniform.
UniformValue is a template class that contains value.
Creates UniformValue with shader name and value.
Getter/Setter for contained value.
UniformSampler is a shader uniform that containes texture as well as its bound texture unit.
Creates uniform sampler with name and texture.
Getter/Setter for sampler.