1 // Copyright (C) 2012-2019 The VPaint Developers.
2 // See the COPYRIGHT file at the top-level directory of this distribution
3 // and at https://github.com/dalboris/vpaint/blob/master/COPYRIGHT
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 // Include this file if you need to call OpenGL functions. Assuming that
18 // a valid OpenGL context is current, here is how to call OpenGL functions.
19 //
20 // OpenGL 1.x functions can be directly called as global functions.
21 //
22 // OpenGL 2.x functions can be called via the following:
23 //
24 //   auto* f = context()->versionFunctions<OpenGLFunctions>();
25 //   f->glBlendFuncSeparate(...)
26 //
27 // OpenGL 3.x or 4.x are not direcly available, but may be available
28 // as extensions to OpenGL 2.1, for example:
29 //
30 //   // Query extensions
31 //   QList extensions = context()->extensions().toList();
32 //   std::sort(extensions);
33 //   qDebug() << "Supported extensions (" << extensions.count() << ")";
34 //   foreach (const QByteArray &extension, extensions)
35 //       qDebug() << "    " << extension;
36 //
37 //   // Check if extension is supported
38 //   if (!context()->hasExtension(QByteArrayLiteral(
39 //            "GL_ARB_instanced_arrays"))
40 //       qFatal("GL_ARB_instanced_arrays is not supported");
41 //
42 //   // Create instance of helper class and resolve functions
43 //   QOpenGLExtension_ARB_instanced_arrays* m_instanceFuncs =
44 //       new QOpenGLExtension_ARB_instanced_arrays();
45 //   m_instanceFuncs->initializeOpenGLFunctions();
46 //
47 //   // Call an extension function
48 //   m_instanceFuncs->glVertexAttribDivisorARB(pointLocation, 1);
49 //
50 // For more details, see: https://www.kdab.com/opengl-in-qt-5-1-part-1/
51 //
52 
53 #ifndef OPENGL_H
54 #define OPENGL_H
55 
56 #include <QOpenGLFunctions_2_1>
57 #include <QOpenGLExtensions>
58 
59 using OpenGLFunctions = QOpenGLFunctions_2_1;
60 
61 #define VPAINT_OPENGL_VERSION_MAJOR 2
62 #define VPAINT_OPENGL_VERSION_MINOR 1
63 #define VPAINT_OPENGL_VERSION "2.1"
64 
65 #endif
66