#include "MyCustomGlObject.h"
#include <ImFusion/Core/GL/FixedFunctionPipeline.h>
#include <ImFusion/Core/GL/VertexBuffer.h>
#include <ImFusion/Core/Mat.h>
void MyCustomGlObject::draw(
const GlView& view)
{
std::vector<vec3f> lineVertices{vec3f(-10.f, 10.f, 0.f), vec3f(10.f, 10.f, 0.f), vec3f(10.f, -10.f, 0.f)};
std::vector<vec3f> triangleVertices{vec3f(-10.f, 8.f, 0.f), vec3f(-10.f, -10.f, 0.f), vec3f(8.f, -10.f, 0.f)};
std::vector<vec3f> triangleColors{vec3f(1.f, 0.f, 0.f), vec3f(0.f, 1.f, 0.f), vec3f(0.f, 0.f, 1.f)};
}
Convenience class for a shader implementing a basic fixed function rendering pipeline.
Definition FixedFunctionPipeline.h:99
void setDefaultColor(const vec3 &color)
Sets the default color with full opacity to use in case no per-vertex colors are specified.
void enable(const ViewState &state, ShaderSelection shaderSelection=ShaderSelection::Default, const OrderIndependentTransparency *oit=nullptr)
Enables the rendering shader and resets all state to the default settings.
void disable()
Disables the rendering shader.
static VertexData< T > makeVertexData(const std::vector< T > &vertexPositions)
Factory function to create a VertexData object without the need to explicitly specify the template ty...
@ Default
Default general purpose shader mimicking the fixed function pipeline.
Definition FixedFunctionPipeline.h:153
@ LineRendering
Special shader that supports wide and stippled lines, do not use with other geometry than lines.
Definition FixedFunctionPipeline.h:157
void setLineWidth(double lineWidth)
Sets the width of the rendered lines in px, will incorporate the GL::dpiScale().
static FixedFunctionPipeline & cachedInstance()
Definition InstanceManager.h:80
Base class for implementing OpenGL views.
Definition GlView.h:36
const GL::ViewState & state() const
Return the view state that was set during the last render() call.
Definition GlView.h:115
@ Triangles
Vertices 0, 1, and 2 form a triangle. Vertices 3, 4, and 5 form a triangle. And so on.
Definition Types.h:71
@ LineStrip
The adjacent vertices are considered lines. Thus, if you pass n vertices, you will get n-1 lines.
Definition Types.h:70
Namespace of the ImFusion SDK.
Definition Assert.h:7