Topaz 4.2.0.0
C++20 Graphics Engine
Loading...
Searching...
No Matches
Home

Introduction

Welcome to the Topaz documentation.

  • To read documentation for a specific API function or type, you should try searching for it using the searchbox above.
  • To read documentation for a subsystem/module, you can navigate to the C++ API Reference or TZSL API Reference sections.
  • If you're still learning the basics, or need a general overview of the engine, you'd prefer the wiki.

Links

These might come in useful, or you might find some of these interesting.

Worked Example

The code snippet you're about to see is the source code of the simplest demo, which simply draws a triangle to the screen. This is known as tz_triangle_demo.

#include "tz/tz.hpp"
#include "tz/gl/device.hpp"
#include "tz/gl/renderer.hpp"
#include "tz/gl/imported_shaders.hpp"
#include "tz/dbgui/dbgui.hpp"
#include ImportedShaderHeader(tz_triangle_demo, vertex)
#include ImportedShaderHeader(tz_triangle_demo, fragment)
int main()
{
tz::initialise
({
.name = "tz_triangle_demo",
});
{
rinfo.state().graphics.tri_count = 1;
rinfo.shader().set_shader(tz::gl::shader_stage::vertex, ImportedShaderSource(tz_triangle_demo, vertex));
rinfo.shader().set_shader(tz::gl::shader_stage::fragment, ImportedShaderSource(tz_triangle_demo, fragment));
rinfo.set_options({tz::gl::renderer_option::no_depth_testing});
tz::gl::get_device().render_graph().timeline = {renh};
while(!tz::window().is_close_requested())
{
}
}
}
const tz::gl::renderer & get_renderer(tz::gl::renderer_handle rh) const
Retrieve a reference to the renderer associated with the given handle.
tz::gl::renderer_handle create_renderer(tz::gl::renderer_info &rinfo)
Create a new tz::gl::renderer.
Helper struct which the user can use to specify which inputs, resources they want and where they want...
Definition renderer.hpp:139
void set_options(renderer_options options)
Set the currently specified options which will be used by the renderer.
Definition renderer.cpp:139
render_state & state()
Read/write information about the state of the renderer when it is created.
Definition renderer.cpp:155
shader_info & shader()
Read/write information about the shader that will be built for the renderer.
Definition renderer.cpp:165
void render()
Submit the renderer's work to the GPU.
void terminate()
Terminate Topaz.
Definition tz.cpp:82
void end_frame()
End the current frame.
Definition tz.cpp:116
void begin_frame()
Begin a new frame.
Definition tz.cpp:104
tz::handle< detail::renderer_tag > renderer_handle
Represents a handle for a renderer owned by an existing device.
Definition renderer.hpp:27
device & get_device()
Retrieve the global device.
Definition device.cpp:10
std::size_t tri_count
Number of triangles to be rendered in the next draw call. note@ if a draw_buffer has been specified,...
Definition renderer.hpp:105
Graphics graphics
Graphics state.
Definition renderer.hpp:121