first commit
This commit is contained in:
27
qopengltest/glwidget.cpp
Normal file
27
qopengltest/glwidget.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "glwidget.h"
|
||||
#include <GL/gl.h>
|
||||
#include <QtWidgets/qopenglwidget.h>
|
||||
|
||||
GLWidget::GLWidget(QWidget* parent): QOpenGLWidget(parent) {}
|
||||
|
||||
GLWidget::~GLWidget() {
|
||||
makeCurrent();
|
||||
|
||||
doneCurrent();
|
||||
}
|
||||
|
||||
void GLWidget::initializeGL() {
|
||||
initializeOpenGLFunctions();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// TODO: 1.编译shader 2.创建VAO VBO 3.加载texture 4.加载model
|
||||
}
|
||||
|
||||
void GLWidget::resizeGL(int w, int h) {
|
||||
glViewport(0, 0, w, h);
|
||||
}
|
||||
|
||||
void GLWidget::paintGL() {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// TODO 1.绑定shader 2.设置uniform 3.draw calls
|
||||
// 不要swapBuffers
|
||||
}
|
||||
Reference in New Issue
Block a user