Nicolas Winkler 5 anos atrás
pai
commit
df06fa32fc
1 arquivos alterados com 20 adições e 0 exclusões
  1. 20 0
      MandelWidget.cpp

+ 20 - 0
MandelWidget.cpp

@@ -4,6 +4,8 @@
 
 #include <QStyle>
 #include <QStyleOption>
+#include <QOpenGLShader>
+#include <QOpenGLShaderProgram>
 
 using namespace mnd;
 
@@ -661,6 +663,24 @@ void MandelWidget::initializeGL(void)
 
     //glShadeModel(GL_SMOOTH);
 
+
+    QOpenGLShaderProgram program(this->context());
+    program.addShaderFromSourceCode(QOpenGLShader::Vertex,
+    "attribute highp vec4 vertex;\n"
+    "uniform highp mat4 matrix;\n"
+    "void main(void)\n"
+    "{\n"
+    "   gl_Position = matrix * vertex;\n"
+    "}");
+    program.addShaderFromSourceCode(QOpenGLShader::Fragment,
+    "uniform mediump vec4 color;\n"
+    "void main(void)\n"
+    "{\n"
+    "   gl_FragColor = asd afd  asfd vec4(1, 1, 1, 2) - color;\n"
+    "}");
+    program.link();
+    program.bind();
+
     mandelView = nullptr;
     requestRecalc();
 }