refactor(rendering): removed glfw dependency of render functions
This commit is contained in:
parent
19f048b52a
commit
1e5e60bbcf
4 changed files with 8 additions and 10 deletions
|
@ -34,7 +34,7 @@ int main() {
|
|||
glewInit();
|
||||
|
||||
gDataModel->Init();
|
||||
renderInit(window, 1200, 900);
|
||||
renderInit(1200, 900);
|
||||
|
||||
// Baseplate
|
||||
gWorkspace()->AddChild(Part::New({
|
||||
|
@ -66,7 +66,7 @@ int main() {
|
|||
|
||||
processInput(window);
|
||||
gWorkspace()->PhysicsStep(deltaTime);
|
||||
render(window);
|
||||
render();
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <GL/gl.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
@ -65,7 +64,7 @@ int viewportWidth, viewportHeight;
|
|||
void renderDebugInfo();
|
||||
void drawRect(int x, int y, int width, int height, glm::vec3 color);
|
||||
|
||||
void renderInit(GLFWwindow* window, int width, int height) {
|
||||
void renderInit(int width, int height) {
|
||||
viewportWidth = width, viewportHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
|
@ -650,7 +649,7 @@ void addDebugRenderCFrame(CFrame frame, Color3 color) {
|
|||
}
|
||||
|
||||
tu_time_t renderTime;
|
||||
void render(GLFWwindow* window) {
|
||||
void render() {
|
||||
tu_time_t startTime = tu_clock_micros();
|
||||
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#pragma once
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
extern bool wireframeRendering;
|
||||
|
||||
class CFrame;
|
||||
class Color3;
|
||||
|
||||
void renderInit(GLFWwindow* window, int width, int height);
|
||||
void render(GLFWwindow* window);
|
||||
void renderInit(int width, int height);
|
||||
void render();
|
||||
void setViewport(int width, int height);
|
||||
void addDebugRenderCFrame(CFrame);
|
||||
void addDebugRenderCFrame(CFrame, Color3);
|
||||
|
|
|
@ -35,7 +35,7 @@ MainGLWidget::MainGLWidget(QWidget* parent): QOpenGLWidget(parent), contextMenu(
|
|||
|
||||
void MainGLWidget::initializeGL() {
|
||||
glewInit();
|
||||
renderInit(NULL, width(), height());
|
||||
renderInit(width(), height());
|
||||
}
|
||||
|
||||
inline void playSound(QString path) {
|
||||
|
@ -63,7 +63,7 @@ extern std::weak_ptr<Part> draggingObject;
|
|||
extern std::optional<HandleFace> draggingHandle;
|
||||
extern Shader* shader;
|
||||
void MainGLWidget::paintGL() {
|
||||
::render(NULL);
|
||||
::render();
|
||||
}
|
||||
|
||||
bool isMouseRightDragging = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue