Skip to content

Commit 4917241

Browse files
committed
rename examples
1 parent d3977b7 commit 4917241

File tree

10 files changed

+164
-164
lines changed

10 files changed

+164
-164
lines changed

source/examples/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ add_subdirectory("commandlineoutput")
5555
add_subdirectory("computeshader")
5656
add_subdirectory("programpipelines")
5757
add_subdirectory("shaderincludes")
58-
add_subdirectory("sparse-texture")
58+
add_subdirectory("sparsetexture")
5959
add_subdirectory("ssbo")
6060
add_subdirectory("states")
6161
add_subdirectory("texture")
6262
add_subdirectory("tessellation")
6363
add_subdirectory("transformfeedback")
6464
add_subdirectory("wikiexample")
6565

66-
add_subdirectory("qt-example")
66+
add_subdirectory("qtexample")

source/examples/commandlineoutput/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int /*argc*/, char * /*argv*/[])
4141
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true);
4242

4343
// Create a context and, if valid, make it current
44-
GLFWwindow * offscreen_context = glfwCreateWindow(640, 480, "globjects Command Line Output", NULL, NULL);
44+
GLFWwindow * offscreen_context = glfwCreateWindow(320, 240, "globjects Command Line Output", NULL, NULL);
4545
if (offscreen_context == nullptr)
4646
{
4747
critical() << "Context creation failed. Terminate execution.";

source/examples/qt-example/CMakeLists.txt renamed to source/examples/qtexample/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cmake_policy(SET CMP0020 NEW)
2323
#
2424

2525
# Target name
26-
set(target qt-example)
26+
set(target qtexample)
2727

2828
# Exit here if required dependencies are not met
2929
if (NOT Qt5Core_FOUND)
File renamed without changes.
File renamed without changes.
Lines changed: 159 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,159 @@
1-
2-
#ifdef __GNUC__
3-
#pragma GCC diagnostic push
4-
#pragma GCC diagnostic ignored "-Wfloat-equal"
5-
#pragma GCC diagnostic ignored "-Wconversion"
6-
#pragma GCC diagnostic ignored "-Wswitch"
7-
#endif
8-
9-
#include <iostream>
10-
#include <algorithm>
11-
12-
#pragma warning(push)
13-
#pragma warning(disable: 4127)
14-
#include <QApplication>
15-
#include <QMainWindow>
16-
#include <QResizeEvent>
17-
#include <QSurfaceFormat>
18-
#pragma warning(pop)
19-
20-
#ifdef __GNUC__
21-
#pragma GCC diagnostic pop
22-
#endif
23-
24-
#include <glm/glm.hpp>
25-
#include <glm/gtc/matrix_transform.hpp>
26-
#include <glm/gtx/transform.hpp>
27-
28-
#include <glbinding/gl/gl.h>
29-
#include <glbinding/ContextInfo.h>
30-
#include <glbinding/Version.h>
31-
32-
#include <globjects/globjects.h>
33-
#include <globjects/base/File.h>
34-
#include <globjects/logging.h>
35-
36-
#include <globjects/Buffer.h>
37-
#include <globjects/Program.h>
38-
#include <globjects/Shader.h>
39-
#include <globjects/VertexArray.h>
40-
#include <globjects/VertexAttributeBinding.h>
41-
#include <globjects/base/StaticStringSource.h>
42-
43-
#include "WindowQt.h"
44-
45-
// example commons
46-
#include "common/contextinfo.inl"
47-
#include "common/dataPath.inl"
48-
49-
50-
using namespace gl;
51-
52-
53-
class Window : public WindowQt
54-
{
55-
public:
56-
Window(QSurfaceFormat & format)
57-
: WindowQt(format)
58-
{
59-
}
60-
61-
virtual ~Window()
62-
{
63-
}
64-
65-
virtual void initializeGL() override
66-
{
67-
globjects::init();
68-
common::printContextInfo();
69-
70-
globjects::DebugMessage::enable();
71-
72-
#ifdef __APPLE__
73-
Shader::clearGlobalReplacements();
74-
Shader::globalReplace("#version 140", "#version 150");
75-
76-
debug() << "Using global OS X shader replacement '#version 140' -> '#version 150'" << std::endl;
77-
#endif
78-
79-
glClearColor(0.2f, 0.3f, 0.4f, 1.f);
80-
81-
m_cornerBuffer = new globjects::Buffer();
82-
m_program = new globjects::Program();
83-
m_vao = new globjects::VertexArray();
84-
85-
const auto dataPath = common::retrieveDataPath("globjects", "dataPath");
86-
m_program->attach(
87-
globjects::Shader::fromFile(GL_VERTEX_SHADER, dataPath + "qt-example/shader.vert"),
88-
globjects::Shader::fromFile(GL_FRAGMENT_SHADER, dataPath + "qt-example/shader.frag"));
89-
90-
m_cornerBuffer->setData(std::array<glm::vec2, 4>{ {
91-
glm::vec2(0, 0), glm::vec2(1, 0), glm::vec2(0, 1), glm::vec2(1, 1) } }, GL_STATIC_DRAW);
92-
93-
m_vao->binding(0)->setAttribute(0);
94-
m_vao->binding(0)->setBuffer(m_cornerBuffer, 0, sizeof(glm::vec2));
95-
m_vao->binding(0)->setFormat(2, GL_FLOAT);
96-
m_vao->enable(0);
97-
}
98-
99-
virtual void resizeGL(QResizeEvent * event) override
100-
{
101-
glViewport(0, 0, event->size().width(), event->size().height());
102-
}
103-
104-
virtual void paintGL() override
105-
{
106-
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
107-
108-
m_program->use();
109-
m_vao->drawArrays(GL_TRIANGLE_STRIP, 0, 4);
110-
}
111-
112-
113-
virtual void keyPressEvent(QKeyEvent * event) override
114-
{
115-
makeCurrent();
116-
117-
switch (event->key())
118-
{
119-
case Qt::Key_F5:
120-
globjects::File::reloadAll();
121-
break;
122-
default:
123-
break;
124-
}
125-
doneCurrent();
126-
}
127-
128-
129-
protected:
130-
globjects::ref_ptr<globjects::Buffer> m_cornerBuffer;
131-
globjects::ref_ptr<globjects::Program> m_program;
132-
globjects::ref_ptr<globjects::VertexArray> m_vao;
133-
};
134-
135-
136-
int main(int argc, char * argv[])
137-
{
138-
QApplication app(argc, argv);
139-
140-
QSurfaceFormat format;
141-
#ifdef __APPLE__
142-
format.setVersion(3, 2);
143-
format.setProfile(QSurfaceFormat::CoreProfile);
144-
#else
145-
format.setVersion(3, 1);
146-
#endif
147-
format.setDepthBufferSize(16);
148-
149-
Window * glwindow = new Window(format);
150-
151-
QMainWindow window;
152-
window.setMinimumSize(640, 480);
153-
window.setWindowTitle("globjects and Qt");
154-
window.setCentralWidget(QWidget::createWindowContainer(glwindow));
155-
156-
window.show();
157-
158-
return app.exec();
159-
}
1+
2+
#ifdef __GNUC__
3+
#pragma GCC diagnostic push
4+
#pragma GCC diagnostic ignored "-Wfloat-equal"
5+
#pragma GCC diagnostic ignored "-Wconversion"
6+
#pragma GCC diagnostic ignored "-Wswitch"
7+
#endif
8+
9+
#include <iostream>
10+
#include <algorithm>
11+
12+
#pragma warning(push)
13+
#pragma warning(disable: 4127)
14+
#include <QApplication>
15+
#include <QMainWindow>
16+
#include <QResizeEvent>
17+
#include <QSurfaceFormat>
18+
#pragma warning(pop)
19+
20+
#ifdef __GNUC__
21+
#pragma GCC diagnostic pop
22+
#endif
23+
24+
#include <glm/glm.hpp>
25+
#include <glm/gtc/matrix_transform.hpp>
26+
#include <glm/gtx/transform.hpp>
27+
28+
#include <glbinding/gl/gl.h>
29+
#include <glbinding/ContextInfo.h>
30+
#include <glbinding/Version.h>
31+
32+
#include <globjects/globjects.h>
33+
#include <globjects/base/File.h>
34+
#include <globjects/logging.h>
35+
36+
#include <globjects/Buffer.h>
37+
#include <globjects/Program.h>
38+
#include <globjects/Shader.h>
39+
#include <globjects/VertexArray.h>
40+
#include <globjects/VertexAttributeBinding.h>
41+
#include <globjects/base/StaticStringSource.h>
42+
43+
#include "WindowQt.h"
44+
45+
// example commons
46+
#include "common/contextinfo.inl"
47+
#include "common/dataPath.inl"
48+
49+
50+
using namespace gl;
51+
52+
53+
class Window : public WindowQt
54+
{
55+
public:
56+
Window(QSurfaceFormat & format)
57+
: WindowQt(format)
58+
{
59+
}
60+
61+
virtual ~Window()
62+
{
63+
}
64+
65+
virtual void initializeGL() override
66+
{
67+
globjects::init();
68+
common::printContextInfo();
69+
70+
globjects::DebugMessage::enable();
71+
72+
#ifdef __APPLE__
73+
Shader::clearGlobalReplacements();
74+
Shader::globalReplace("#version 140", "#version 150");
75+
76+
debug() << "Using global OS X shader replacement '#version 140' -> '#version 150'" << std::endl;
77+
#endif
78+
79+
glClearColor(0.2f, 0.3f, 0.4f, 1.f);
80+
81+
m_cornerBuffer = new globjects::Buffer();
82+
m_program = new globjects::Program();
83+
m_vao = new globjects::VertexArray();
84+
85+
const auto dataPath = common::retrieveDataPath("globjects", "dataPath");
86+
m_program->attach(
87+
globjects::Shader::fromFile(GL_VERTEX_SHADER, dataPath + "qt-example/shader.vert"),
88+
globjects::Shader::fromFile(GL_FRAGMENT_SHADER, dataPath + "qt-example/shader.frag"));
89+
90+
m_cornerBuffer->setData(std::array<glm::vec2, 4>{ {
91+
glm::vec2(0, 0), glm::vec2(1, 0), glm::vec2(0, 1), glm::vec2(1, 1) } }, GL_STATIC_DRAW);
92+
93+
m_vao->binding(0)->setAttribute(0);
94+
m_vao->binding(0)->setBuffer(m_cornerBuffer, 0, sizeof(glm::vec2));
95+
m_vao->binding(0)->setFormat(2, GL_FLOAT);
96+
m_vao->enable(0);
97+
}
98+
99+
virtual void resizeGL(QResizeEvent * event) override
100+
{
101+
glViewport(0, 0, event->size().width(), event->size().height());
102+
}
103+
104+
virtual void paintGL() override
105+
{
106+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
107+
108+
m_program->use();
109+
m_vao->drawArrays(GL_TRIANGLE_STRIP, 0, 4);
110+
}
111+
112+
113+
virtual void keyPressEvent(QKeyEvent * event) override
114+
{
115+
makeCurrent();
116+
117+
switch (event->key())
118+
{
119+
case Qt::Key_F5:
120+
globjects::File::reloadAll();
121+
break;
122+
default:
123+
break;
124+
}
125+
doneCurrent();
126+
}
127+
128+
129+
protected:
130+
globjects::ref_ptr<globjects::Buffer> m_cornerBuffer;
131+
globjects::ref_ptr<globjects::Program> m_program;
132+
globjects::ref_ptr<globjects::VertexArray> m_vao;
133+
};
134+
135+
136+
int main(int argc, char * argv[])
137+
{
138+
QApplication app(argc, argv);
139+
140+
QSurfaceFormat format;
141+
#ifdef __APPLE__
142+
format.setVersion(3, 2);
143+
format.setProfile(QSurfaceFormat::CoreProfile);
144+
#else
145+
format.setVersion(3, 1);
146+
#endif
147+
format.setDepthBufferSize(16);
148+
149+
Window * glwindow = new Window(format);
150+
151+
QMainWindow window;
152+
window.setMinimumSize(320, 240);
153+
window.setWindowTitle("globjects and Qt");
154+
window.setCentralWidget(QWidget::createWindowContainer(glwindow));
155+
156+
window.show();
157+
158+
return app.exec();
159+
}

source/examples/sparse-texture/CMakeLists.txt renamed to source/examples/sparsetexture/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ find_package(glbinding REQUIRED)
1212
#
1313

1414
# Target name
15-
set(target sparse-texture)
15+
set(target sparsetexture)
1616

1717
# Exit here if required dependencies are not met
1818
if (NOT GLFW_FOUND)
File renamed without changes.

0 commit comments

Comments
 (0)