OpenGLRenderer: Implement primitive mode
This commit is contained in:
parent
ac3db8a8bf
commit
8f9f943e2c
|
|
@ -31,6 +31,7 @@ namespace Nz
|
|||
|
||||
inline GLenum ToOpenGL(BlendFunc blendFunc);
|
||||
inline GLenum ToOpenGL(FaceSide filter);
|
||||
inline GLenum ToOpenGL(PrimitiveMode primitiveMode);
|
||||
inline GLenum ToOpenGL(SamplerFilter filter);
|
||||
inline GLenum ToOpenGL(SamplerFilter minFilter, SamplerMipmapMode mipmapFilter);
|
||||
inline GLenum ToOpenGL(SamplerWrap wrapMode);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,22 @@ namespace Nz
|
|||
return {};
|
||||
}
|
||||
|
||||
GLenum ToOpenGL(PrimitiveMode primitiveMode)
|
||||
{
|
||||
switch (primitiveMode)
|
||||
{
|
||||
case PrimitiveMode_LineList: return GL_LINES;
|
||||
case PrimitiveMode_LineStrip: return GL_LINE_STRIP;
|
||||
case PrimitiveMode_PointList: return GL_POINTS;
|
||||
case PrimitiveMode_TriangleList: return GL_TRIANGLES;
|
||||
case PrimitiveMode_TriangleStrip: return GL_TRIANGLE_STRIP;
|
||||
case PrimitiveMode_TriangleFan: return GL_TRIANGLE_FAN;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled PrimitiveMode 0x" + NumberToString(UnderlyingCast(primitiveMode), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
inline GLenum ToOpenGL(RendererComparison comparison)
|
||||
{
|
||||
switch (comparison)
|
||||
|
|
|
|||
|
|
@ -81,12 +81,12 @@ namespace Nz
|
|||
else if constexpr (std::is_same_v<T, DrawData>)
|
||||
{
|
||||
ApplyStates(*context, command.states);
|
||||
context->glDrawArraysInstanced(GL_TRIANGLES, command.firstVertex, command.vertexCount, command.instanceCount);
|
||||
context->glDrawArraysInstanced(ToOpenGL(command.states.pipeline->GetPipelineInfo().primitiveMode), command.firstVertex, command.vertexCount, command.instanceCount);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, DrawIndexedData>)
|
||||
{
|
||||
ApplyStates(*context, command.states);
|
||||
context->glDrawElementsInstanced(GL_TRIANGLES, command.indexCount, GL_UNSIGNED_SHORT, nullptr, command.instanceCount);
|
||||
context->glDrawElementsInstanced(ToOpenGL(command.states.pipeline->GetPipelineInfo().primitiveMode), command.indexCount, GL_UNSIGNED_SHORT, nullptr, command.instanceCount);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, SetFrameBufferData>)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue