Преглед изворни кода

Finally fixed the dumb nvidia segfault on preload, also re-added GLEW as a dependency, pthreads is now required. Fixes #83, #81.

naelstrof пре 7 година
родитељ
комит
14b0909113
14 измењених фајлова са 209 додато и 4926 уклоњено
  1. 8
    3
      CMakeLists.txt
  2. 1
    1
      README.md
  3. 43
    43
      src/framebuffer.cpp
  4. 2
    2
      src/framebuffer.hpp
  5. 0
    2773
      src/gl_core_3_0.cpp
  6. 0
    1949
      src/gl_core_3_0.hpp
  7. 24
    24
      src/glrectangle.cpp
  8. 2
    2
      src/glrectangle.hpp
  9. 54
    54
      src/main.cpp
  10. 40
    40
      src/shader.cpp
  11. 1
    1
      src/shader.hpp
  12. 25
    25
      src/slop.cpp
  13. 8
    8
      src/window.cpp
  14. 1
    1
      src/window.hpp

+ 8
- 3
CMakeLists.txt Прегледај датотеку

@@ -21,14 +21,13 @@ endif()
21 21
 
22 22
 include_directories("${PROJECT_BINARY_DIR}")
23 23
 
24
-add_definitions(-DSLOP_VERSION="v6.3.46")
24
+add_definitions(-DSLOP_VERSION="v6.3.47")
25 25
 
26 26
 # The names have to be unique unfortunately.
27 27
 set(EXECUTABLE_NAME "slop")
28 28
 set(LIBRARY_NAME "slopy")
29 29
 
30 30
 add_library(${LIBRARY_NAME} SHARED  src/mouse.cpp
31
-                                    src/gl_core_3_0.cpp
32 31
                                     src/keyboard.cpp
33 32
                                     src/x.cpp
34 33
                                     src/slopstates.cpp
@@ -51,14 +50,18 @@ set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
51 50
 
52 51
 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
53 52
 
53
+find_package(GLEW REQUIRED)
54 54
 find_package(GLM REQUIRED)
55 55
 find_package(X11 REQUIRED)
56 56
 find_package(XExt REQUIRED)
57 57
 find_package(GLX REQUIRED)
58 58
 find_package(OpenGL REQUIRED)
59 59
 find_package(XRender REQUIRED)
60
+# Ahhhh, finally this eliminates the segfault on preload.
61
+find_package(Threads REQUIRED)
60 62
 
61 63
 include_directories(${X11_INCLUDE_DIR}
64
+                    ${GLEW_INCLUDE_DIR}
62 65
                     ${GLM_INCLUDE_DIR}
63 66
                     ${XEXT_INCLUDE_DIR}
64 67
                     ${GLX_INCLUDE_DIR}
@@ -66,11 +69,13 @@ include_directories(${X11_INCLUDE_DIR}
66 69
                     ${OPENGL_INCLUDE_DIR})
67 70
 
68 71
 target_link_libraries(${LIBRARY_NAME} ${X11_LIBRARIES}
72
+				      ${CMAKE_THREAD_LIBS_INIT} 
69 73
                                       ${GLM_LIBRARIES}
70 74
                                       ${OPENGL_LIBRARIES}
71 75
                                       ${GLX_LIBRARY}
72 76
                                       ${XRENDER_LIBRARY}
73
-                                      ${XEXT_LIBRARIES})
77
+                                      ${XEXT_LIBRARIES}
78
+                                      ${GLEW_LIBRARIES})
74 79
 
75 80
 target_link_libraries(${EXECUTABLE_NAME} ${LIBRARY_NAME} )
76 81
 

+ 1
- 1
README.md Прегледај датотеку

@@ -55,7 +55,7 @@ While slop not only looks nicer, it's impossible for it to end up in screenshots
55 55
 
56 56
 ### Install using CMake (Requires CMake)
57 57
 
58
-*Note: Dependencies should be installed first: libxext, OpenGL, and glm.*
58
+*Note: Dependencies should be installed first: libxext, glew, and glm.*
59 59
 
60 60
 ```bash
61 61
 git clone https://github.com/naelstrof/slop.git

+ 43
- 43
src/framebuffer.cpp Прегледај датотеку

@@ -1,17 +1,17 @@
1 1
 #include "framebuffer.hpp"
2 2
 
3 3
 slop::Framebuffer::Framebuffer( int w, int h ) {
4
-    gl::GenFramebuffers( 1, &fbuffer );
5
-    gl::BindFramebuffer( gl::FRAMEBUFFER, fbuffer );
6
-    gl::GenTextures( 1, &image );
7
-    gl::BindTexture( gl::TEXTURE_2D, image );
8
-    gl::TexImage2D( gl::TEXTURE_2D, 0, gl::RGBA, w, h, 0, gl::RGBA, gl::UNSIGNED_BYTE, NULL );
9
-    gl::TexParameteri( gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST );
10
-    gl::TexParameteri( gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST );
11
-    gl::TexParameteri( gl::TEXTURE_2D, gl::TEXTURE_WRAP_S, gl::CLAMP_TO_EDGE );
12
-    gl::TexParameteri( gl::TEXTURE_2D, gl::TEXTURE_WRAP_T, gl::CLAMP_TO_EDGE );
13
-    gl::FramebufferTexture2D( gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, image, 0 );
14
-    gl::BindFramebuffer( gl::FRAMEBUFFER, 0 );
4
+    glGenFramebuffers( 1, &fbuffer );
5
+    glBindFramebuffer( GL_FRAMEBUFFER, fbuffer );
6
+    glGenTextures( 1, &image );
7
+    glBindTexture( GL_TEXTURE_2D, image );
8
+    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
9
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
10
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
11
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
12
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
13
+    glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, image, 0 );
14
+    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
15 15
     // generate our vertex and uv buffers
16 16
     std::vector<glm::vec2> verts;
17 17
     std::vector<glm::vec2> uvs;
@@ -29,11 +29,11 @@ slop::Framebuffer::Framebuffer( int w, int h ) {
29 29
     verts.push_back( glm::vec2(1,-1) );
30 30
     uvs.push_back( glm::vec2( 1, 0 ) );
31 31
 
32
-    gl::GenBuffers( 2, buffers );
33
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffers[0] );
34
-    gl::BufferData( gl::ARRAY_BUFFER, verts.size() * sizeof( glm::vec2 ), &verts[0], gl::STATIC_DRAW );
35
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffers[1] );
36
-    gl::BufferData( gl::ARRAY_BUFFER, uvs.size() * sizeof( glm::vec2 ), &uvs[0], gl::STATIC_DRAW );
32
+    glGenBuffers( 2, buffers );
33
+    glBindBuffer( GL_ARRAY_BUFFER, buffers[0] );
34
+    glBufferData( GL_ARRAY_BUFFER, verts.size() * sizeof( glm::vec2 ), &verts[0], GL_STATIC_DRAW );
35
+    glBindBuffer( GL_ARRAY_BUFFER, buffers[1] );
36
+    glBufferData( GL_ARRAY_BUFFER, uvs.size() * sizeof( glm::vec2 ), &uvs[0], GL_STATIC_DRAW );
37 37
     vertCount = verts.size();
38 38
     generatedDesktopImage = false;
39 39
 }
@@ -45,44 +45,44 @@ void slop::Framebuffer::setShader( slop::Shader* shader ) {
45 45
         XGrabServer(x11->display);
46 46
         XImage* image = XGetImage( x11->display, x11->root, 0, 0, WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ), 0xffffffff, ZPixmap );
47 47
         XUngrabServer(x11->display);
48
-        gl::Enable(gl::TEXTURE_2D);
49
-        gl::GenTextures(1, &desktopImage);
50
-        gl::BindTexture(gl::TEXTURE_2D, desktopImage);
51
-        gl::TexParameterf(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST);
52
-        gl::TexParameterf(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST);
53
-        //gl::TexEnvf(gl::TEXTURE_ENV, gl::TEXTURE_ENV_MODE, gl::MODULATE);
54
-        gl::TexImage2D( gl::TEXTURE_2D, 0, gl::RGB, WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ), 0, gl::BGRA, gl::UNSIGNED_BYTE, (void*)(&(image->data[0])));
48
+        glEnable(GL_TEXTURE_2D);
49
+        glGenTextures(1, &desktopImage);
50
+        glBindTexture(GL_TEXTURE_2D, desktopImage);
51
+        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
52
+        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
53
+        //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
54
+        glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ), 0, GL_BGRA, GL_UNSIGNED_BYTE, (void*)(&(image->data[0])));
55 55
         XDestroyImage( image );
56 56
         generatedDesktopImage = true;
57 57
     }
58 58
 }
59 59
 
60 60
 slop::Framebuffer::~Framebuffer() {
61
-    gl::DeleteTextures(1, &image);
62
-    gl::DeleteFramebuffers(1,&fbuffer);
63
-    gl::DeleteBuffers(2,buffers);
61
+    glDeleteTextures(1, &image);
62
+    glDeleteFramebuffers(1,&fbuffer);
63
+    glDeleteBuffers(2,buffers);
64 64
 }
65 65
 
66 66
 void slop::Framebuffer::resize( int w, int h ) {
67 67
     // Regenerate the image
68
-    gl::DeleteTextures(1, &image);
69
-    gl::BindTexture(gl::TEXTURE_2D, image);
70
-    gl::TexImage2D( gl::TEXTURE_2D, 0, gl::RGBA, w, h, 0, gl::RGBA, gl::UNSIGNED_BYTE, NULL);
71
-    gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR);
72
-    gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::LINEAR);
68
+    glDeleteTextures(1, &image);
69
+    glBindTexture(GL_TEXTURE_2D, image);
70
+    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
71
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
72
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
73 73
 
74 74
     // Re-bind it to the framebuffer
75
-    gl::BindFramebuffer( gl::FRAMEBUFFER, fbuffer );
76
-    gl::FramebufferTexture2D( gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, image, 0);
77
-    gl::BindFramebuffer(gl::FRAMEBUFFER, 0);
75
+    glBindFramebuffer( GL_FRAMEBUFFER, fbuffer );
76
+    glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, image, 0);
77
+    glBindFramebuffer(GL_FRAMEBUFFER, 0);
78 78
 }
79 79
 
80 80
 void slop::Framebuffer::bind() {
81
-    gl::BindFramebuffer( gl::FRAMEBUFFER, fbuffer );
81
+    glBindFramebuffer( GL_FRAMEBUFFER, fbuffer );
82 82
 }
83 83
 
84 84
 void slop::Framebuffer::unbind() {
85
-    gl::BindFramebuffer( gl::FRAMEBUFFER, 0 );
85
+    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
86 86
 }
87 87
 
88 88
 void slop::Framebuffer::draw(glm::vec2 mouse, float time, glm::vec4 color){
@@ -102,15 +102,15 @@ void slop::Framebuffer::draw(glm::vec2 mouse, float time, glm::vec4 color){
102 102
     if ( shader->hasParameter( "time" ) ) {
103 103
         shader->setParameter( "time", time );
104 104
     }
105
-    gl::ActiveTexture(gl::TEXTURE0);
106
-    gl::BindTexture( gl::TEXTURE_2D, image );
105
+    glActiveTexture(GL_TEXTURE0);
106
+    glBindTexture( GL_TEXTURE_2D, image );
107 107
     if ( shader->hasParameter( "desktop" ) ) {
108 108
 		shader->setParameter( "desktop", 1 );
109
-        gl::ActiveTexture(gl::TEXTURE0 + 1);
110
-        gl::BindTexture( gl::TEXTURE_2D, desktopImage );
109
+        glActiveTexture(GL_TEXTURE0 + 1);
110
+        glBindTexture( GL_TEXTURE_2D, desktopImage );
111 111
     }
112
-    gl::Enable( gl::TEXTURE_2D );
113
-    gl::DrawArrays( gl::TRIANGLES, 0, vertCount );
114
-    gl::Disable( gl::TEXTURE_2D );
112
+    glEnable( GL_TEXTURE_2D );
113
+    glDrawArrays( GL_TRIANGLES, 0, vertCount );
114
+    glDisable( GL_TEXTURE_2D );
115 115
     shader->unbind();
116 116
 }

+ 2
- 2
src/framebuffer.hpp Прегледај датотеку

@@ -21,10 +21,10 @@
21 21
 #ifndef N_FRAMEBUFFER_H_
22 22
 #define N_FRAMEBUFFER_H_
23 23
 
24
-#include "gl_core_3_0.hpp"
25
-#include <glm/glm.hpp>
24
+#include <GL/glew.h>
26 25
 #include <GL/gl.h>
27 26
 #include <vector>
27
+#include <glm/glm.hpp>
28 28
 
29 29
 #include "shader.hpp"
30 30
 

+ 0
- 2773
src/gl_core_3_0.cpp
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 0
- 1949
src/gl_core_3_0.hpp
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 24
- 24
src/glrectangle.cpp Прегледај датотеку

@@ -188,21 +188,21 @@ void slop::GLRectangle::generateBuffers() {
188 188
     center_verts.push_back( br );
189 189
     center_uvs.push_back( glm::vec2(1, 0) );
190 190
 
191
-    gl::GenBuffers( 6, (GLuint*)&buffer );
192
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer.corner_verts );
193
-    gl::BufferData( gl::ARRAY_BUFFER, corner_verts.size() * sizeof( glm::vec2 ), &corner_verts[0], gl::STATIC_DRAW );
194
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer.corner_uvs );
195
-    gl::BufferData( gl::ARRAY_BUFFER, corner_uvs.size() * sizeof( glm::vec2 ), &corner_uvs[0], gl::STATIC_DRAW );
196
-
197
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer.rectangle_verts );
198
-    gl::BufferData( gl::ARRAY_BUFFER, rectangle_verts.size() * sizeof( glm::vec2 ), &rectangle_verts[0], gl::STATIC_DRAW );
199
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer.rectangle_uvs );
200
-    gl::BufferData( gl::ARRAY_BUFFER, rectangle_uvs.size() * sizeof( glm::vec2 ), &rectangle_uvs[0], gl::STATIC_DRAW );
201
-
202
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer.center_verts );
203
-    gl::BufferData( gl::ARRAY_BUFFER, center_verts.size() * sizeof( glm::vec2 ), &center_verts[0], gl::STATIC_DRAW );
204
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer.rectangle_uvs );
205
-    gl::BufferData( gl::ARRAY_BUFFER, center_uvs.size() * sizeof( glm::vec2 ), &center_uvs[0], gl::STATIC_DRAW );
191
+    glGenBuffers( 6, (GLuint*)&buffer );
192
+    glBindBuffer( GL_ARRAY_BUFFER, buffer.corner_verts );
193
+    glBufferData( GL_ARRAY_BUFFER, corner_verts.size() * sizeof( glm::vec2 ), &corner_verts[0], GL_STATIC_DRAW );
194
+    glBindBuffer( GL_ARRAY_BUFFER, buffer.corner_uvs );
195
+    glBufferData( GL_ARRAY_BUFFER, corner_uvs.size() * sizeof( glm::vec2 ), &corner_uvs[0], GL_STATIC_DRAW );
196
+
197
+    glBindBuffer( GL_ARRAY_BUFFER, buffer.rectangle_verts );
198
+    glBufferData( GL_ARRAY_BUFFER, rectangle_verts.size() * sizeof( glm::vec2 ), &rectangle_verts[0], GL_STATIC_DRAW );
199
+    glBindBuffer( GL_ARRAY_BUFFER, buffer.rectangle_uvs );
200
+    glBufferData( GL_ARRAY_BUFFER, rectangle_uvs.size() * sizeof( glm::vec2 ), &rectangle_uvs[0], GL_STATIC_DRAW );
201
+
202
+    glBindBuffer( GL_ARRAY_BUFFER, buffer.center_verts );
203
+    glBufferData( GL_ARRAY_BUFFER, center_verts.size() * sizeof( glm::vec2 ), &center_verts[0], GL_STATIC_DRAW );
204
+    glBindBuffer( GL_ARRAY_BUFFER, buffer.rectangle_uvs );
205
+    glBufferData( GL_ARRAY_BUFFER, center_uvs.size() * sizeof( glm::vec2 ), &center_uvs[0], GL_STATIC_DRAW );
206 206
     corner_vertCount = corner_verts.size();
207 207
     rectangle_vertCount = rectangle_verts.size();
208 208
     center_vertCount = center_verts.size();
@@ -210,35 +210,35 @@ void slop::GLRectangle::generateBuffers() {
210 210
 
211 211
 slop::GLRectangle::~GLRectangle() {
212 212
     delete shader;
213
-    gl::DeleteBuffers( 6, (GLuint*)&buffer );
213
+    glDeleteBuffers( 6, (GLuint*)&buffer );
214 214
 }
215 215
 
216 216
 void slop::GLRectangle::draw( glm::mat4& matrix ) {
217
-    gl::Enable( gl::BLEND );
218
-    gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
217
+    glEnable( GL_BLEND );
218
+    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
219 219
     shader->bind();
220 220
     shader->setParameter( "projection", matrix );
221 221
     if ( highlight ) {
222 222
         // Draw the center of the highlight
223 223
         shader->setParameter( "color", color );
224 224
         shader->setAttribute( "position", buffer.center_verts, 2 );
225
-        gl::DrawArrays(gl::TRIANGLES, 0, center_vertCount );
225
+        glDrawArrays(GL_TRIANGLES, 0, center_vertCount );
226 226
         // Set the color to have no alpha, then draw the borders.
227 227
         glm::vec4 fullAlpha = glm::vec4(color.r,color.g,color.b,1);
228 228
         shader->setParameter( "color", fullAlpha );
229 229
         shader->setAttribute( "position", buffer.corner_verts, 2 );
230
-        gl::DrawArrays(gl::TRIANGLES, 0, corner_vertCount );
230
+        glDrawArrays(GL_TRIANGLES, 0, corner_vertCount );
231 231
         shader->setAttribute( "position", buffer.rectangle_verts, 2 );
232
-        gl::DrawArrays(gl::TRIANGLES, 0, rectangle_vertCount );
232
+        glDrawArrays(GL_TRIANGLES, 0, rectangle_vertCount );
233 233
     } else {
234 234
         shader->setParameter( "color", color );
235 235
         shader->setAttribute( "position", buffer.corner_verts, 2 );
236
-        gl::DrawArrays(gl::TRIANGLES, 0, corner_vertCount );
236
+        glDrawArrays(GL_TRIANGLES, 0, corner_vertCount );
237 237
         shader->setAttribute( "position", buffer.rectangle_verts, 2 );
238
-        gl::DrawArrays(gl::TRIANGLES, 0, rectangle_vertCount );
238
+        glDrawArrays(GL_TRIANGLES, 0, rectangle_vertCount );
239 239
     }
240 240
     shader->unbind();
241
-    gl::Disable( gl::BLEND );
241
+    glDisable( GL_BLEND );
242 242
 }
243 243
 
244 244
 glm::vec4 slop::GLRectangle::getRect() {

+ 2
- 2
src/glrectangle.hpp Прегледај датотеку

@@ -21,10 +21,10 @@
21 21
 #ifndef N_GLRECTANGLE_H_
22 22
 #define N_GLRECTANGLE_H_
23 23
 
24
-#include "gl_core_3_0.hpp"
25 24
 #include <iostream>
26
-#include <glm/glm.hpp>
25
+#include <GL/glew.h>
27 26
 #include <GL/gl.h>
27
+#include <glm/glm.hpp>
28 28
 #include <vector>
29 29
 
30 30
 #include "shader.hpp"

+ 54
- 54
src/main.cpp Прегледај датотеку

@@ -150,7 +150,7 @@ std::string formatOutput( std::string input, SlopSelection selection, bool cance
150 150
 }
151 151
 
152 152
 void printHelp() {
153
-    std::cout << "slop v5.3.21\n";
153
+    std::cout << "slop " << SLOP_VERSION << "\n";
154 154
     std::cout << "\n";
155 155
     std::cout << "Copyright (C) 2017 Dalton Nell, Slop Contributors\n";
156 156
     std::cout << "(https://github.com/naelstrof/slop/graphs/contributors)\n";
@@ -164,65 +164,65 @@ void printHelp() {
164 164
     std::cout << "Options\n";
165 165
     std::cout << "  -x, --xdisplay=hostname:number.screen_number\n";
166 166
     std::cout << "                                Sets the x display.\n";
167
-	std::cout << "  -k, --nokeyboard              Disables the ability to cancel selections with\n";
168
-	std::cout << "                                  the keyboard.  (default=off)\n";
169
-	std::cout << "  -b, --bordersize=FLOAT        Set the selection rectangle's thickness.\n";
170
-	std::cout << "                                  (default=`1')\n";
171
-	std::cout << "  -p, --padding=FLOAT           Set the padding size of the selection. Can be\n";
172
-	std::cout << "                                  negative.  (default=`0')\n";
173
-	std::cout << "  -t, --tolerance=FLOAT         How far in pixels the mouse can move after\n";
174
-	std::cout << "                                  clicking and still be detected as a normal\n";
175
-	std::cout << "                                  click instead of a click and drag. Setting\n";
176
-	std::cout << "                                  this to 0 will disable window selections.\n";
177
-	std::cout << "                                  Alternatively setting it to 999999 would.\n";
178
-	std::cout << "                                  only allow for window selections.\n";
179
-	std::cout << "                                  (default=`2')\n";
180
-	std::cout << "  -c, --color=FLOAT,FLOAT,FLOAT,FLOAT\n";
181
-	std::cout << "                                Set the selection rectangle's color. Supports\n";
182
-	std::cout << "                                  RGB or RGBA values.\n";
183
-	std::cout << "                                  (default=`0.5,0.5,0.5,1')\n";
184
-	std::cout << "  -n, --nodecorations=INT       Attempt to select child windows in order to\n";
185
-	std::cout << "                                  avoid window decorations. Setting this to\n";
167
+    std::cout << "  -k, --nokeyboard              Disables the ability to cancel selections with\n";
168
+    std::cout << "                                  the keyboard.  (default=off)\n";
169
+    std::cout << "  -b, --bordersize=FLOAT        Set the selection rectangle's thickness.\n";
170
+    std::cout << "                                  (default=`1')\n";
171
+    std::cout << "  -p, --padding=FLOAT           Set the padding size of the selection. Can be\n";
172
+    std::cout << "                                  negative.  (default=`0')\n";
173
+    std::cout << "  -t, --tolerance=FLOAT         How far in pixels the mouse can move after\n";
174
+    std::cout << "                                  clicking and still be detected as a normal\n";
175
+    std::cout << "                                  click instead of a click and drag. Setting\n";
176
+    std::cout << "                                  this to 0 will disable window selections.\n";
177
+    std::cout << "                                  Alternatively setting it to 999999 would.\n";
178
+    std::cout << "                                  only allow for window selections.\n";
179
+    std::cout << "                                  (default=`2')\n";
180
+    std::cout << "  -c, --color=FLOAT,FLOAT,FLOAT,FLOAT\n";
181
+    std::cout << "                                Set the selection rectangle's color. Supports\n";
182
+    std::cout << "                                  RGB or RGBA values.\n";
183
+    std::cout << "                                  (default=`0.5,0.5,0.5,1')\n";
184
+    std::cout << "  -n, --nodecorations=INT       Attempt to select child windows in order to\n";
185
+    std::cout << "                                  avoid window decorations. Setting this to\n";
186 186
     std::cout << "                                  1 will enable a light attempt to\n";
187 187
     std::cout << "                                  remove decorations. Setting this to 2 will\n";
188 188
     std::cout << "                                  enable aggressive decoration removal.\n";
189 189
     std::cout << "                                  Supplying slop with just `-n` is\n";
190 190
     std::cout << "                                  equivalent to supplying `-n1`.\n";
191 191
     std::cout << "                                  (default=`0')\n";
192
-	std::cout << "  -q, --quiet                   Disable any unnecessary cerr output. Any\n";
193
-	std::cout << "                                  warnings simply won't print.\n";
194
-	std::cout << "  -l, --highlight               Instead of outlining selections, slop\n";
195
-	std::cout << "                                  highlights it. This is only useful when\n";
196
-	std::cout << "                                  --color is set to a transparent color.\n";
197
-	std::cout << "                                  (default=off)\n";
198
-	std::cout << "  -r, --shader=STRING           Sets the shader to load and use from\n";
199
-	std::cout << "                                  ~/.config/slop/\n";
200
-	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
201
-	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
202
-	std::cout << "                                  (default=`%g\n')\n";
203
-	std::cout << "  -o, --noopengl                Disable graphics acceleration.\n";
204
-	std::cout << "Examples\n";
205
-	std::cout << "    $ # Gray, thick, transparent border for maximum visiblity.\n";
206
-	std::cout << "    $ slop -b 20 -c 0.5,0.5,0.5,0.8\n";
207
-	std::cout << "\n";
208
-	std::cout << "    $ # Remove window decorations.\n";
209
-	std::cout << "    $ slop --nodecorations\n";
210
-	std::cout << "\n";
211
-	std::cout << "    $ # Disable window selections. Useful for selecting individual pixels.\n";
212
-	std::cout << "    $ slop -t 0\n";
213
-	std::cout << "\n";
214
-	std::cout << "    $ # Classic Windows XP selection.\n";
215
-	std::cout << "    $ slop -l -c 0.3,0.4,0.6,0.4\n";
216
-	std::cout << "\n";
217
-	std::cout << "    $ # Read slop output for use in scripts.\n";
218
-	std::cout << "    $ read -r X Y W H G ID < <(slop -f '%x %y %w %h %g %i')\n";
219
-	std::cout << "\n";
220
-	std::cout << "Tips\n";
221
-	std::cout << "    * If you don't like a selection: you can cancel it by right-clicking\n";
222
-	std::cout << "regardless of which options are enabled or disabled for slop.\n";
223
-	std::cout << "    * If slop doesn't seem to select a window accurately, the problem could be\n";
224
-	std::cout << "because of decorations getting in the way. Try enabling the --nodecorations\n";
225
-	std::cout << "flag.\n";
192
+    std::cout << "  -q, --quiet                   Disable any unnecessary cerr output. Any\n";
193
+    std::cout << "                                  warnings simply won't print.\n";
194
+    std::cout << "  -l, --highlight               Instead of outlining selections, slop\n";
195
+    std::cout << "                                  highlights it. This is only useful when\n";
196
+    std::cout << "                                  --color is set to a transparent color.\n";
197
+    std::cout << "                                  (default=off)\n";
198
+    std::cout << "  -r, --shader=STRING           Sets the shader to load and use from\n";
199
+    std::cout << "                                  ~/.config/slop/\n";
200
+    std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
201
+    std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
202
+    std::cout << "                                  (default=`%g\n')\n";
203
+    std::cout << "  -o, --noopengl                Disable graphics acceleration.\n";
204
+    std::cout << "Examples\n";
205
+    std::cout << "    $ # Gray, thick, transparent border for maximum visiblity.\n";
206
+    std::cout << "    $ slop -b 20 -c 0.5,0.5,0.5,0.8\n";
207
+    std::cout << "\n";
208
+    std::cout << "    $ # Remove window decorations.\n";
209
+    std::cout << "    $ slop --nodecorations\n";
210
+    std::cout << "\n";
211
+    std::cout << "    $ # Disable window selections. Useful for selecting individual pixels.\n";
212
+    std::cout << "    $ slop -t 0\n";
213
+    std::cout << "\n";
214
+    std::cout << "    $ # Classic Windows XP selection.\n";
215
+    std::cout << "    $ slop -l -c 0.3,0.4,0.6,0.4\n";
216
+    std::cout << "\n";
217
+    std::cout << "    $ # Read slop output for use in scripts.\n";
218
+    std::cout << "    $ read -r X Y W H G ID < <(slop -f '%x %y %w %h %g %i')\n";
219
+    std::cout << "\n";
220
+    std::cout << "Tips\n";
221
+    std::cout << "    * If you don't like a selection: you can cancel it by right-clicking\n";
222
+    std::cout << "regardless of which options are enabled or disabled for slop.\n";
223
+    std::cout << "    * If slop doesn't seem to select a window accurately, the problem could be\n";
224
+    std::cout << "because of decorations getting in the way. Try enabling the --nodecorations\n";
225
+    std::cout << "flag.\n";
226 226
 }
227 227
 
228 228
 int app( int argc, char** argv ) {

+ 40
- 40
src/shader.cpp Прегледај датотеку

@@ -27,7 +27,7 @@ slop::Shader::Shader( std::string vert, std::string frag, bool file ) {
27 27
     const char* fragsrc = frag_contents.c_str();
28 28
 
29 29
     // Create the program to link to.
30
-    program = gl::CreateProgram();
30
+    program = glCreateProgram();
31 31
     
32 32
     if ( vert_contents.length() <= 0 ) {
33 33
         std::string errstring = "Failed to open file (or is empty) `" + vert + "`.\n";
@@ -40,26 +40,26 @@ slop::Shader::Shader( std::string vert, std::string frag, bool file ) {
40 40
     }
41 41
 
42 42
     // Compile both shaders.
43
-    unsigned int vertShader = gl::CreateShader( gl::VERTEX_SHADER );
44
-    gl::ShaderSource( vertShader, 1, &vertsrc , NULL );
43
+    unsigned int vertShader = glCreateShader( GL_VERTEX_SHADER );
44
+    glShaderSource( vertShader, 1, &vertsrc , NULL );
45 45
     std::string errortxt;
46 46
     int err = compile( vertShader, errortxt );
47 47
 
48 48
     if ( err ) {
49 49
         std::string errstring = "Failed to compile shader `" + vert + "`:\n" + errortxt;
50 50
         throw new std::runtime_error(errstring);
51
-        gl::DeleteShader( vertShader );
51
+        glDeleteShader( vertShader );
52 52
         return;
53 53
     }
54 54
 
55
-    unsigned int fragShader = gl::CreateShader( gl::FRAGMENT_SHADER );
56
-    gl::ShaderSource( fragShader, 1, &fragsrc, NULL );
55
+    unsigned int fragShader = glCreateShader( GL_FRAGMENT_SHADER );
56
+    glShaderSource( fragShader, 1, &fragsrc, NULL );
57 57
     err = compile( fragShader, errortxt );
58 58
     if ( err ) {
59 59
         std::string errstring = "Failed to compile shader `" + frag + "`:\n" + errortxt;
60 60
         throw new std::runtime_error(errstring);
61
-        gl::DeleteShader( vertShader );
62
-        gl::DeleteShader( fragShader );
61
+        glDeleteShader( vertShader );
62
+        glDeleteShader( fragShader );
63 63
         return;
64 64
     }
65 65
 
@@ -68,19 +68,19 @@ slop::Shader::Shader( std::string vert, std::string frag, bool file ) {
68 68
     if ( err ) {
69 69
         std::string errstring = "Failed to link shader `" + vert + "` and  `" + frag + "`:\n" + errortxt;
70 70
         throw new std::runtime_error(errstring);
71
-        gl::DeleteShader( vertShader );
72
-        gl::DeleteShader( fragShader );
71
+        glDeleteShader( vertShader );
72
+        glDeleteShader( fragShader );
73 73
         return;
74 74
     }
75 75
 
76 76
     // Clean up :)
77
-    gl::DeleteShader( vertShader );
78
-    gl::DeleteShader( fragShader );
79
-    gl::UseProgram( 0 );
77
+    glDeleteShader( vertShader );
78
+    glDeleteShader( fragShader );
79
+    glUseProgram( 0 );
80 80
 }
81 81
 
82 82
 slop::Shader::~Shader() {
83
-    gl::DeleteProgram( program );
83
+    glDeleteProgram( program );
84 84
 }
85 85
 
86 86
 unsigned int slop::Shader::getProgram() {
@@ -88,20 +88,20 @@ unsigned int slop::Shader::getProgram() {
88 88
 }
89 89
 
90 90
 void slop::Shader::bind() {
91
-    gl::UseProgram( program );
91
+    glUseProgram( program );
92 92
 }
93 93
 
94 94
 int slop::Shader::compile( unsigned int shader, std::string& error ) {
95
-    gl::CompileShader( shader );
95
+    glCompileShader( shader );
96 96
 
97 97
     // Compiling the shader is the easy part, all this junk down here is for printing the error it might generate.
98 98
     int result;
99 99
     int logLength;
100
-    gl::GetShaderiv( shader, gl::COMPILE_STATUS, &result );
101
-    gl::GetShaderiv( shader, gl::INFO_LOG_LENGTH, &logLength );
100
+    glGetShaderiv( shader, GL_COMPILE_STATUS, &result );
101
+    glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &logLength );
102 102
     if ( result == false ) {
103 103
         char* errormsg = new char[ logLength ];
104
-        gl::GetShaderInfoLog( shader, logLength, NULL, errormsg );
104
+        glGetShaderInfoLog( shader, logLength, NULL, errormsg );
105 105
         error = errormsg;
106 106
         delete[] errormsg;
107 107
         return 1;
@@ -110,18 +110,18 @@ int slop::Shader::compile( unsigned int shader, std::string& error ) {
110 110
 }
111 111
 
112 112
 int slop::Shader::link( unsigned int vertshader, unsigned int fragshader, std::string& error ) {
113
-    gl::AttachShader( program, vertshader );
114
-    gl::AttachShader( program, fragshader );
115
-    gl::LinkProgram( program );
113
+    glAttachShader( program, vertshader );
114
+    glAttachShader( program, fragshader );
115
+    glLinkProgram( program );
116 116
 
117 117
     // Linking the shader is the easy part, all this junk down here is for printing the error it might generate.
118 118
     int result = false;
119 119
     int logLength;
120
-    gl::GetProgramiv( program, gl::LINK_STATUS, &result);
121
-    gl::GetProgramiv( program, gl::INFO_LOG_LENGTH, &logLength);
120
+    glGetProgramiv( program, GL_LINK_STATUS, &result);
121
+    glGetProgramiv( program, GL_INFO_LOG_LENGTH, &logLength);
122 122
     if ( result == false ) {
123 123
         char* errormsg = new char[ logLength ];
124
-        gl::GetProgramInfoLog( program, logLength, NULL, errormsg );
124
+        glGetProgramInfoLog( program, logLength, NULL, errormsg );
125 125
         error = errormsg;
126 126
         delete[] errormsg;
127 127
         return 1;
@@ -130,47 +130,47 @@ int slop::Shader::link( unsigned int vertshader, unsigned int fragshader, std::s
130 130
 }
131 131
 
132 132
 unsigned int slop::Shader::getUniformLocation( std::string name ) {
133
-    gl::UseProgram( program );
134
-    return gl::GetUniformLocation( program, name.c_str() );
133
+    glUseProgram( program );
134
+    return glGetUniformLocation( program, name.c_str() );
135 135
 }
136 136
 
137 137
 bool slop::Shader::hasParameter( std::string name ) {
138
-    gl::UseProgram( program );
139
-    return gl::GetUniformLocation( program, name.c_str() ) != -1;
138
+    glUseProgram( program );
139
+    return glGetUniformLocation( program, name.c_str() ) != -1;
140 140
 }
141 141
 
142 142
 void slop::Shader::setParameter( std::string name, int foo ) {
143
-    gl::Uniform1i( getUniformLocation( name ), foo );
143
+    glUniform1i( getUniformLocation( name ), foo );
144 144
 }
145 145
 
146 146
 void slop::Shader::setParameter( std::string name, float foo ) {
147
-    gl::Uniform1f( getUniformLocation( name ), foo );
147
+    glUniform1f( getUniformLocation( name ), foo );
148 148
 }
149 149
 
150 150
 void slop::Shader::setParameter( std::string name, glm::mat4& foo ) {
151
-    gl::UniformMatrix4fv( getUniformLocation( name ), 1, false, glm::value_ptr( foo ) );
151
+    glUniformMatrix4fv( getUniformLocation( name ), 1, false, glm::value_ptr( foo ) );
152 152
 }
153 153
 
154 154
 void slop::Shader::setParameter( std::string name, glm::vec4 foo ) {
155
-    gl::Uniform4f( getUniformLocation( name ), foo.x, foo.y, foo.z, foo.w );
155
+    glUniform4f( getUniformLocation( name ), foo.x, foo.y, foo.z, foo.w );
156 156
 }
157 157
 
158 158
 void slop::Shader::setParameter( std::string name, glm::vec2 foo ) {
159
-    gl::Uniform2f( getUniformLocation( name ), foo.x, foo.y );
159
+    glUniform2f( getUniformLocation( name ), foo.x, foo.y );
160 160
 }
161 161
 
162 162
 void slop::Shader::setAttribute( std::string name, unsigned int buffer, unsigned int stepsize ) {
163
-    unsigned int a = gl::GetAttribLocation( program, name.c_str() );
164
-    gl::EnableVertexAttribArray( a );
165
-    gl::BindBuffer( gl::ARRAY_BUFFER, buffer );
166
-    gl::VertexAttribPointer( a, stepsize, gl::FLOAT, false, 0, NULL );
163
+    unsigned int a = glGetAttribLocation( program, name.c_str() );
164
+    glEnableVertexAttribArray( a );
165
+    glBindBuffer( GL_ARRAY_BUFFER, buffer );
166
+    glVertexAttribPointer( a, stepsize, GL_FLOAT, false, 0, NULL );
167 167
     activeAttributes.push_back( a );
168 168
 }
169 169
 
170 170
 void slop::Shader::unbind() {
171 171
     for ( unsigned int i=0; i<activeAttributes.size(); i++ ) {
172
-        gl::DisableVertexAttribArray( activeAttributes[i] );
172
+        glDisableVertexAttribArray( activeAttributes[i] );
173 173
     }
174 174
     activeAttributes.clear();
175
-    gl::UseProgram( 0 );
175
+    glUseProgram( 0 );
176 176
 }

+ 1
- 1
src/shader.hpp Прегледај датотеку

@@ -26,7 +26,7 @@
26 26
 #include <string>
27 27
 #include <exception>
28 28
 
29
-#include "gl_core_3_0.hpp"
29
+#include <GL/glew.h>
30 30
 #include <glm/glm.hpp>
31 31
 #include <glm/gtc/type_ptr.hpp>
32 32
 #include <EGL/egl.h>

+ 25
- 25
src/slop.cpp Прегледај датотеку

@@ -1,4 +1,4 @@
1
-#include "gl_core_3_0.hpp"
1
+#include <GL/glew.h>
2 2
 #include <GL/gl.h>
3 3
 
4 4
 #include <chrono>
@@ -89,10 +89,10 @@ slop::SlopSelection slop::SlopSelect( slop::SlopOptions* options, bool* cancelle
89 89
         // If we have a compositor, we try using OpenGL
90 90
         try {
91 91
             window = new SlopWindow();
92
-	    if (!gl::sys::IsVersionGEQ(3,0)) {
93
-		delete window;
92
+            if (!GLEW_VERSION_3_0) {
93
+                delete window;
94 94
                 throw new std::runtime_error( "OpenGL version is not high enough, slop requires OpenGL 3.0!\nOpenGL accelleration is disabled. Use -o or -q to suppress this message." );
95
-	    }
95
+            }
96 96
             success = true;
97 97
         } catch( std::exception* e ) {
98 98
             errorstring += std::string(e->what()) + "\n";
@@ -224,8 +224,8 @@ slop::SlopSelection slop::GLSlopSelect( slop::SlopOptions* options, bool* cancel
224 224
         // Then we draw our junk to a framebuffer.
225 225
         window->framebuffer->setShader( textured );
226 226
         window->framebuffer->bind();
227
-        gl::ClearColor (0.0, 0.0, 0.0, 0.0);
228
-        gl::Clear (gl::COLOR_BUFFER_BIT);
227
+        glClearColor (0.0, 0.0, 0.0, 0.0);
228
+        glClear (GL_COLOR_BUFFER_BIT);
229 229
         memory->draw( window->camera );
230 230
         window->framebuffer->unbind();
231 231
 
@@ -233,32 +233,32 @@ slop::SlopSelection slop::GLSlopSelect( slop::SlopOptions* options, bool* cancel
233 233
         
234 234
         int i;
235 235
         // We have our clean buffer, now to slather it with some juicy shader chains.
236
-        gl::Enable( gl::BLEND );
237
-        gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
236
+        glEnable( GL_BLEND );
237
+        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
238 238
         for (i=0;i<=(int)shaders.size()-2;i+=2) {
239 239
             pingpong->bind();
240
-            gl::ClearColor (0.0, 0.0, 0.0, 0.0);
241
-            gl::Clear (gl::COLOR_BUFFER_BIT);
240
+            glClearColor (0.0, 0.0, 0.0, 0.0);
241
+            glClear (GL_COLOR_BUFFER_BIT);
242 242
             window->framebuffer->setShader( shaders[i] );
243 243
             window->framebuffer->draw(slop::mouse->getMousePos(), elapsed.count()/1000.f, glm::vec4( options->r, options->g, options->b, options->a ) );
244 244
             pingpong->unbind();
245 245
 
246 246
             window->framebuffer->bind();
247
-            gl::ClearColor (0.0, 0.0, 0.0, 0.0);
248
-            gl::Clear (gl::COLOR_BUFFER_BIT);
247
+            glClearColor (0.0, 0.0, 0.0, 0.0);
248
+            glClear (GL_COLOR_BUFFER_BIT);
249 249
             pingpong->setShader( shaders[i+1] );
250 250
             pingpong->draw(slop::mouse->getMousePos(), elapsed.count()/1000.f, glm::vec4( options->r, options->g, options->b, options->a ) );
251 251
             window->framebuffer->unbind();
252 252
         }
253 253
         for (;i<shaders.size();i++) {
254 254
             pingpong->bind();
255
-            gl::ClearColor (0.0, 0.0, 0.0, 0.0);
256
-            gl::Clear (gl::COLOR_BUFFER_BIT);
255
+            glClearColor (0.0, 0.0, 0.0, 0.0);
256
+            glClear (GL_COLOR_BUFFER_BIT);
257 257
             window->framebuffer->setShader( shaders[i] );
258 258
             window->framebuffer->draw(slop::mouse->getMousePos(), elapsed.count()/1000.f, glm::vec4( options->r, options->g, options->b, options->a ) );
259 259
             pingpong->unbind();
260 260
         }
261
-        gl::Disable( gl::BLEND );
261
+        glDisable( GL_BLEND );
262 262
         if ( i%2 != 0 ) {
263 263
             window->framebuffer->draw(slop::mouse->getMousePos(), elapsed.count()/1000.f, glm::vec4( options->r, options->g, options->b, options->a ) );
264 264
         } else {
@@ -268,15 +268,15 @@ slop::SlopSelection slop::GLSlopSelect( slop::SlopOptions* options, bool* cancel
268 268
         window->display();
269 269
         // Here we sleep just to prevent our CPU usage from going to 100%.
270 270
         std::this_thread::sleep_for(std::chrono::milliseconds(10));
271
-        GLenum err = gl::GetError();
272
-        if ( err != gl::NO_ERROR_ ) {
271
+        GLenum err = glGetError();
272
+        if ( err != GL_NO_ERROR ) {
273 273
             std::string error;
274 274
             switch(err) {
275
-		case gl::INVALID_OPERATION: error="INVALID_OPERATION"; break;
276
-		case gl::INVALID_ENUM: error="INVALID_ENUM"; break;
277
-		case gl::INVALID_VALUE: error="INVALID_VALUE"; break;
278
-		case gl::OUT_OF_MEMORY: error="OUT_OF_MEMORY"; break;
279
-		case gl::INVALID_FRAMEBUFFER_OPERATION: error="INVALID_FRAMEBUFFER_OPERATION"; break;
275
+                case GL_INVALID_OPERATION: error="INVALID_OPERATION"; break;
276
+                case GL_INVALID_ENUM: error="INVALID_ENUM"; break;
277
+                case GL_INVALID_VALUE: error="INVALID_VALUE"; break;
278
+                case GL_OUT_OF_MEMORY: error="OUT_OF_MEMORY"; break;
279
+                case GL_INVALID_FRAMEBUFFER_OPERATION: error="INVALID_FRAMEBUFFER_OPERATION"; break;
280 280
             }
281 281
             throw new std::runtime_error( "OpenGL threw an error: " + error );
282 282
         }
@@ -295,10 +295,10 @@ slop::SlopSelection slop::GLSlopSelect( slop::SlopOptions* options, bool* cancel
295 295
 
296 296
     // Lets now clear both front and back buffers before closing.
297 297
     // hopefully it'll be completely transparent while closing!
298
-    gl::ClearColor (0.0, 0.0, 0.0, 0.0);
299
-    gl::Clear (gl::COLOR_BUFFER_BIT);
298
+    glClearColor (0.0, 0.0, 0.0, 0.0);
299
+    glClear (GL_COLOR_BUFFER_BIT);
300 300
     window->display();
301
-    gl::Clear (gl::COLOR_BUFFER_BIT);
301
+    glClear (GL_COLOR_BUFFER_BIT);
302 302
     window->display();
303 303
     // Then we clean up.
304 304
     for( int i=0;i<shaders.size();i++ ) {

+ 8
- 8
src/window.cpp Прегледај датотеку

@@ -101,14 +101,14 @@ slop::SlopWindow::SlopWindow() {
101 101
     }
102 102
     setCurrent();
103 103
     // Finally we grab some OpenGL 3.3 stuffs.
104
-    gl::exts::LoadTest didLoad = gl::sys::LoadFunctions();
105
-    if(!didLoad)
104
+    GLenum err = glewInit();
105
+    if (GLEW_OK != err)
106 106
     {
107
-        throw new std::runtime_error("Failed to load function pointers for OpenGL.");
107
+      throw new std::runtime_error((char*)glewGetErrorString(err));
108 108
     }
109 109
     framebuffer = new Framebuffer( WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ) );
110 110
 
111
-    gl::Viewport( 0, 0, WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ) );
111
+    glViewport( 0, 0, WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ) );
112 112
     camera = glm::ortho( 0.0f, (float)WidthOfScreen( x11->screen ), (float)HeightOfScreen( x11->screen ), 0.0f, -1.0f, 1.0f);
113 113
 
114 114
     // Last, we actually display the window <:o)
@@ -118,11 +118,11 @@ slop::SlopWindow::SlopWindow() {
118 118
 slop::SlopWindow::~SlopWindow() {
119 119
     delete framebuffer;
120 120
     // Try to erase the window before destroying it.
121
-    gl::ClearColor( 0, 0, 0, 0 );
122
-    gl::Clear( gl::COLOR_BUFFER_BIT );
121
+    glClearColor( 0, 0, 0, 0 );
122
+    glClear( GL_COLOR_BUFFER_BIT );
123 123
     display();
124
-    gl::ClearColor( 0, 0, 0, 0 );
125
-    gl::Clear( gl::COLOR_BUFFER_BIT );
124
+    glClearColor( 0, 0, 0, 0 );
125
+    glClear( GL_COLOR_BUFFER_BIT );
126 126
     display();
127 127
     glXDestroyContext( x11->display, context );
128 128
     XUnmapWindow( x11->display, window );

+ 1
- 1
src/window.hpp Прегледај датотеку

@@ -25,7 +25,7 @@
25 25
 #include <exception>
26 26
 
27 27
 #include <iostream>
28
-#include "gl_core_3_0.hpp"
28
+#include <GL/glew.h>
29 29
 #include <GL/gl.h>
30 30
 #define GL_GLEXT_PROTOTYPES
31 31
 #define GLX_GLXEXT_PROTOTYPES