diff dmglrender.h @ 62:baccf2044289

Move the OpenGL rendering, setup etc. into a separate module/class, perhaps facilitating other types of renderers in future .. maybe.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 14 Dec 2019 16:39:20 +0200
parents
children d6ffc59bb84d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmglrender.h	Sat Dec 14 16:39:20 2019 +0200
@@ -0,0 +1,40 @@
+//
+// GLDragon - OpenGL PLY model viewer / simple benchmark
+// -- OpenGL rendering of DMSimpleScene
+// Programmed and designed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
+// (C) Copyright 2019 Tecnic Software productions (TNSP)
+//
+// See file "COPYING" for license information.
+//
+#ifndef DMGLRENDER_H
+#define DMGLRENDER_H 1
+
+#include "dmrender.h"
+#include <SDL_opengl.h>
+
+
+struct DMGLSimpleRenderer : DMSimpleRenderer
+{
+    SDL_GLContext glContext;
+
+    DMGLSimpleRenderer()
+    {
+        glContext = NULL;
+    }
+
+    bool checkErrors(void);
+    bool initRender1(void);
+    bool initRender2(SDL_Window *window);
+    bool initRender3(const int width, const int height);
+    void shutdownRenderer(void);
+
+    void drawModel(const DMSimpleScene &scene, const DMModel &model, const float time);
+    void drawScene(const DMSimpleScene &scene, const float time);
+
+    bool compileModelShaders(DMModel &model);
+    bool setupLight(const int n, DMLight &light);
+    bool setupCamera(DMCamera &camera);
+    bool animate(DMSimpleScene &scene, const float time);
+};
+
+#endif