Switch to QOpenGLWidget.

This commit is contained in:
Leonardo Zide
2020-12-27 13:05:55 -08:00
parent 2ccdc85f00
commit 4e6cbca31c
14 changed files with 269 additions and 72 deletions
+19 -5
View File
@@ -107,23 +107,33 @@ enum class lcPolygonOffset
Translucent
};
#ifdef LC_USE_QOPENGLWIDGET
class lcContext : protected QOpenGLFunctions
#else
class lcContext
#endif
{
public:
lcContext();
~lcContext();
lcContext(const lcContext&) = delete;
lcContext(lcContext&&) = delete;
lcContext& operator=(const lcContext&) = delete;
lcContext& operator=(lcContext&&) = delete;
static void CreateResources();
static void DestroyResources();
void CreateResources();
void DestroyResources();
void SetDefaultState();
void ClearResources();
#ifdef LC_USE_QOPENGLWIDGET
void SetGLContext(QOpenGLContext* GLContext)
{
initializeOpenGLFunctions();
mGLContext = GLContext;
}
#endif
void SetWorldMatrix(const lcMatrix44& WorldMatrix)
{
mWorldMatrix = WorldMatrix;
@@ -219,9 +229,13 @@ public:
void BindMesh(const lcMesh* Mesh);
protected:
static void CreateShaderPrograms();
void CreateShaderPrograms();
void FlushState();
#ifdef LC_USE_QOPENGLWIDGET
QOpenGLContext* mGLContext = nullptr;
#endif
GLuint mVertexBufferObject;
GLuint mIndexBufferObject;
char* mVertexBufferPointer;