DDraceNetwork Docs
backend_opengl3.h
Go to the documentation of this file.
1// This file can be included several times.
2#if(!defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H)) || \
3 (defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H_AS_ES))
4
5#if !defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H)
6#define ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H
7#endif
8
9#if defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H_AS_ES)
10#define ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H_AS_ES
11#endif
12
13#include "backend_opengl.h"
14
19
20#define MAX_STREAM_BUFFER_COUNT 10
21
22// takes care of opengl 3.3+ related rendering
24{
25protected:
27 static const int ms_MaxQuadsPossible = 256;
28
39
41
46
48
50
53
54 void DestroyBufferContainer(int Index, bool DeleteBOs = true);
55
56 void AppendIndices(unsigned int NewIndicesCount);
57
59 {
65 };
66 std::vector<SBufferContainer> m_vBufferContainers;
67
68 std::vector<TWGLuint> m_vBufferObjectIndices;
69
71
72 void InitPrimExProgram(CGLSLPrimitiveExProgram *pProgram, class CGLSLCompiler *pCompiler, class IStorage *pStorage, bool Textured, bool Rotationless);
73
74 bool IsNewApi() override { return true; }
75
76 void UseProgram(CGLSLTWProgram *pProgram);
77 void UploadStreamBufferData(unsigned int PrimitiveType, const void *pVertices, size_t VertSize, unsigned int PrimitiveCount, bool AsTex3D = false);
78 void RenderText(const CCommandBuffer::SState &State, int DrawNum, int TextTextureIndex, int TextOutlineTextureIndex, int TextureSize, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor);
79
80 void TextureUpdate(int Slot, int X, int Y, int Width, int Height, int GLFormat, uint8_t *pTexData);
81 void TextureCreate(int Slot, int Width, int Height, int GLFormat, int GLStoreFormat, int Flags, uint8_t *pTexData);
82
83 bool Cmd_Init(const SCommand_Init *pCommand) override;
84 void Cmd_Shutdown(const SCommand_Shutdown *pCommand) override;
90 void Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand) override;
91 void Cmd_Render(const CCommandBuffer::SCommand_Render *pCommand) override;
92 void Cmd_RenderTex3D(const CCommandBuffer::SCommand_RenderTex3D *pCommand) override;
93
99
104
108 void Cmd_RenderText(const CCommandBuffer::SCommand_RenderText *pCommand) override;
112
113public:
115};
116
117#endif
#define MAX_STREAM_BUFFER_COUNT
Definition: backend_opengl3.h:20
Definition: backend_opengl3.h:24
void Cmd_RenderText(const CCommandBuffer::SCommand_RenderText *pCommand) override
Definition: backend_opengl3.cpp:1190
TWGLuint m_PrimitiveDrawBufferIdTex3D
Definition: backend_opengl3.h:45
void Cmd_Render(const CCommandBuffer::SCommand_Render *pCommand) override
Definition: backend_opengl3.cpp:723
unsigned int m_CurrentIndicesInBuffer
Definition: backend_opengl3.h:52
bool Cmd_Init(const SCommand_Init *pCommand) override
Definition: backend_opengl3.cpp:73
TWGLuint m_aPrimitiveDrawVertexId[10]
Definition: backend_opengl3.h:42
void Cmd_TextTexture_Update(const CCommandBuffer::SCommand_TextTexture_Update *pCommand) override
Definition: backend_opengl3.cpp:660
CGLSLPrimitiveExProgram * m_pPrimitiveExProgramTexturedRotationless
Definition: backend_opengl3.h:37
void Cmd_RenderQuadContainerEx(const CCommandBuffer::SCommand_RenderQuadContainerEx *pCommand) override
Definition: backend_opengl3.cpp:1243
void AppendIndices(unsigned int NewIndicesCount)
Definition: backend_opengl3.cpp:806
TWGLuint m_PrimitiveDrawVertexIdTex3D
Definition: backend_opengl3.h:43
TWGLuint m_QuadDrawIndexBufferId
Definition: backend_opengl3.h:51
void Cmd_RenderQuadContainerAsSpriteMultiple(const CCommandBuffer::SCommand_RenderQuadContainerAsSpriteMultiple *pCommand) override
Definition: backend_opengl3.cpp:1304
CGLSLPrimitiveExProgram * m_pPrimitiveExProgramTextured
Definition: backend_opengl3.h:35
void InitPrimExProgram(CGLSLPrimitiveExProgram *pProgram, class CGLSLCompiler *pCompiler, class IStorage *pStorage, bool Textured, bool Rotationless)
Definition: backend_opengl3.cpp:42
void Cmd_DeleteBufferObject(const CCommandBuffer::SCommand_DeleteBufferObject *pCommand) override
Definition: backend_opengl3.cpp:908
void UploadStreamBufferData(unsigned int PrimitiveType, const void *pVertices, size_t VertSize, unsigned int PrimitiveCount, bool AsTex3D=false)
Definition: backend_opengl3.cpp:697
TWGLuint m_aLastIndexBufferBound[10]
Definition: backend_opengl3.h:47
void Cmd_RenderTileLayer(const CCommandBuffer::SCommand_RenderTileLayer *pCommand) override
Definition: backend_opengl3.cpp:1031
void Cmd_CreateBufferContainer(const CCommandBuffer::SCommand_CreateBufferContainer *pCommand) override
Definition: backend_opengl3.cpp:915
void Cmd_TextTextures_Destroy(const CCommandBuffer::SCommand_TextTextures_Destroy *pCommand) override
Definition: backend_opengl3.cpp:665
void Cmd_IndicesRequiredNumNotify(const CCommandBuffer::SCommand_IndicesRequiredNumNotify *pCommand) override
Definition: backend_opengl3.cpp:992
std::vector< SBufferContainer > m_vBufferContainers
Definition: backend_opengl3.h:66
void Cmd_TextTextures_Create(const CCommandBuffer::SCommand_TextTextures_Create *pCommand) override
Definition: backend_opengl3.cpp:671
void Cmd_DeleteBufferContainer(const CCommandBuffer::SCommand_DeleteBufferContainer *pCommand) override
Definition: backend_opengl3.cpp:987
void Cmd_CreateBufferObject(const CCommandBuffer::SCommand_CreateBufferObject *pCommand) override
Definition: backend_opengl3.cpp:849
void Cmd_RenderQuadContainer(const CCommandBuffer::SCommand_RenderQuadContainer *pCommand) override
Definition: backend_opengl3.cpp:1211
int m_LastStreamBuffer
Definition: backend_opengl3.h:49
CGLSLPrimitiveProgram * m_pPrimitiveProgram
Definition: backend_opengl3.h:29
void Cmd_UpdateBufferContainer(const CCommandBuffer::SCommand_UpdateBufferContainer *pCommand) override
Definition: backend_opengl3.cpp:956
void Cmd_CopyBufferObject(const CCommandBuffer::SCommand_CopyBufferObject *pCommand) override
Definition: backend_opengl3.cpp:898
void Cmd_Shutdown(const SCommand_Shutdown *pCommand) override
Definition: backend_opengl3.cpp:425
void Cmd_RenderBorderTile(const CCommandBuffer::SCommand_RenderBorderTile *pCommand) override
Definition: backend_opengl3.cpp:998
CGLSLSpriteMultipleProgram * m_pSpriteProgramMultiple
Definition: backend_opengl3.h:38
void Cmd_RenderTex3D(const CCommandBuffer::SCommand_RenderTex3D *pCommand) override
Definition: backend_opengl3.cpp:759
void Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand) override
Definition: backend_opengl3.cpp:508
void Cmd_UpdateBufferObject(const CCommandBuffer::SCommand_UpdateBufferObject *pCommand) override
Definition: backend_opengl3.cpp:886
CGLSLQuadProgram * m_pQuadProgram
Definition: backend_opengl3.h:31
void Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand) override
Definition: backend_opengl3.cpp:677
void DestroyBufferContainer(int Index, bool DeleteBOs=true)
Definition: backend_opengl3.cpp:786
static const int ms_MaxQuadsPossible
Definition: backend_opengl3.h:27
void TextureCreate(int Slot, int Width, int Height, int GLFormat, int GLStoreFormat, int Flags, uint8_t *pTexData)
Definition: backend_opengl3.cpp:516
TWGLuint m_aPrimitiveDrawBufferId[10]
Definition: backend_opengl3.h:44
int m_MaxQuadsAtOnce
Definition: backend_opengl3.h:26
void Cmd_Texture_Create(const CCommandBuffer::SCommand_Texture_Create *pCommand) override
Definition: backend_opengl3.cpp:655
void Cmd_RecreateBufferObject(const CCommandBuffer::SCommand_RecreateBufferObject *pCommand) override
Definition: backend_opengl3.cpp:874
void RenderText(const CCommandBuffer::SState &State, int DrawNum, int TextTextureIndex, int TextOutlineTextureIndex, int TextureSize, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor)
Definition: backend_opengl3.cpp:1137
CCommandBuffer::SColorf m_ClearColor
Definition: backend_opengl3.h:70
CGLSLTextProgram * m_pTextProgram
Definition: backend_opengl3.h:33
CGLSLPrimitiveProgram * m_pPrimitiveProgramTextured
Definition: backend_opengl3.h:30
TWGLuint m_LastProgramId
Definition: backend_opengl3.h:40
void UseProgram(CGLSLTWProgram *pProgram)
Definition: backend_opengl3.cpp:33
std::vector< TWGLuint > m_vBufferObjectIndices
Definition: backend_opengl3.h:68
CGLSLQuadProgram * m_pQuadProgramTextured
Definition: backend_opengl3.h:32
CGLSLPrimitiveExProgram * m_pPrimitiveExProgramRotationless
Definition: backend_opengl3.h:36
void Cmd_RenderQuadLayer(const CCommandBuffer::SCommand_RenderQuadLayer *pCommand) override
Definition: backend_opengl3.cpp:1072
bool IsNewApi() override
Definition: backend_opengl3.h:74
void TextureUpdate(int Slot, int X, int Y, int Width, int Height, int GLFormat, uint8_t *pTexData)
Definition: backend_opengl3.cpp:484
CGLSLPrimitiveExProgram * m_pPrimitiveExProgram
Definition: backend_opengl3.h:34
Definition: backend_opengl.h:198
Definition: glsl_shader_compiler.h:14
Definition: opengl_sl_program.h:103
Definition: opengl_sl_program.h:98
Definition: opengl_sl_program.h:141
Definition: opengl_sl_program.h:123
Definition: opengl_sl_program.h:55
Definition: opengl_sl_program.h:73
Definition: color.h:210
Definition: storage.h:20
uint32_t TWGLuint
Definition: graphics_defines.h:7
Definition: graphics_threaded.h:212
Definition: graphics_threaded.h:295
Definition: graphics_threaded.h:316
Definition: graphics_threaded.h:254
Definition: graphics_threaded.h:344
Definition: graphics_threaded.h:308
Definition: graphics_threaded.h:353
Definition: graphics_threaded.h:268
Definition: graphics_threaded.h:376
Definition: graphics_threaded.h:431
Definition: graphics_threaded.h:419
Definition: graphics_threaded.h:390
Definition: graphics_threaded.h:244
Definition: graphics_threaded.h:402
Definition: graphics_threaded.h:361
Definition: graphics_threaded.h:234
Definition: graphics_threaded.h:570
Definition: graphics_threaded.h:544
Definition: graphics_threaded.h:560
Definition: graphics_threaded.h:520
Definition: graphics_threaded.h:535
Definition: graphics_threaded.h:330
Definition: graphics_threaded.h:282
Definition: graphics_threaded.h:196
SBufferContainer()
Definition: backend_opengl3.h:60
TWGLuint m_LastIndexBufferBound
Definition: backend_opengl3.h:63
SBufferContainerInfo m_ContainerInfo
Definition: backend_opengl3.h:64
TWGLuint m_VertArrayId
Definition: backend_opengl3.h:62
Definition: graphics.h:25