Skip to content

Commit 971ac85

Browse files
committed
Merge pull request #3 from Meisaka/develop
Some OS X Fixes
2 parents 4c7d28c + de0f459 commit 971ac85

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

cmake/Platform.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if (CMAKE_HOST_APPLE)
66
/usr/local
77
/opt/local
88
)
9+
INCLUDE_DIRECTORIES(/usr/include)
10+
INCLUDE_DIRECTORIES(/usr/local/include)
911
else (CMAKE_HOST_APPLE)
1012
# OS X is a Unix, but it's not a normal Unix as far as search paths go.
1113
if (CMAKE_HOST_UNIX)

tools/config_main.hpp.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#else
1515
#ifdef __APPLE__
1616
#include <OpenGL/gl3.h>
17-
#include <GL/glew.h>
1817
#define GLFW_INCLUDE_GLCOREARB
1918
#include <GLFW/glfw3.h>
2019
// Needed so we can disable retina support for our window.

tools/include/al_engine.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
#ifdef __APPLE__
1717
#include <OpenAL/al.h>
1818
#include <OpenAL/alc.h>
19+
#include <OpenAL/alure.h>
1920
#else
2021
#include <AL/al.h>
2122
#include <AL/alc.h>
23+
#include <AL/alure.h>
2224
#endif
23-
#include <AL/alure.h> // Check if in MacOS or Win needs other stuff here
2425

2526

2627
#include "types.hpp"

tools/src/gl_engine.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int GlEngine::initGL(OS::OS& os) {
6060
// Use the GL3 way to get the version number
6161
glGetIntegerv(GL_MAJOR_VERSION, &OpenGLVersion[0]);
6262
glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
63-
std::cout << "Using OpenGL " << OpenGLVersion[0] << "." << OpenGLVersion[1] << "\n";
63+
std::cerr << "Using OpenGL " << OpenGLVersion[0] << "." << OpenGLVersion[1] << "\n";
6464

6565
// Sanity check to make sure we are at least in a good major version number.
6666
assert((OpenGLVersion[0] > 1) && (OpenGLVersion[0] < 5));
@@ -324,6 +324,11 @@ int GlEngine::initGL(OS::OS& os) {
324324
glAttachShader(shaderProgram, fragmentShader);
325325
check_gl_error();
326326

327+
// Bind attributes indexes
328+
glBindAttribLocation(shaderProgram, sh_in_Position, "in_Position");
329+
glBindAttribLocation(shaderProgram, sh_in_Color, "in_Color");
330+
glBindAttribLocation(shaderProgram, sh_in_UV, "in_UV");
331+
327332
// Link shader program
328333
glLinkProgram(shaderProgram);
329334

@@ -347,11 +352,6 @@ int GlEngine::initGL(OS::OS& os) {
347352
return -1;
348353
}
349354

350-
// Bind attributes indexes
351-
glBindAttribLocation(shaderProgram, sh_in_Position, "in_Position");
352-
glBindAttribLocation(shaderProgram, sh_in_Color, "in_Color");
353-
glBindAttribLocation(shaderProgram, sh_in_UV, "in_UV");
354-
355355
modelId = glGetUniformLocation(shaderProgram, "in_Model");
356356
viewId = glGetUniformLocation(shaderProgram, "in_View");
357357
projId = glGetUniformLocation(shaderProgram, "in_Proj");
@@ -426,7 +426,7 @@ void GlEngine::UpdScreen (OS::OS& os, const double delta) {
426426
auto tdata = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, 320*240*4 ,
427427
GL_MAP_WRITE_BIT |GL_MAP_INVALIDATE_BUFFER_BIT );
428428
if (tdata != nullptr) {
429-
//std::fill_n(tdata, 320*240, 0xFF800000);
429+
std::fill_n((unsigned*)tdata, 320*240, 0xFF800000);
430430
if (painter) {
431431
painter(tdata);
432432
}

tools/tda_view.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int main (int argc, char* argv[]) {
105105
// Ugly hack
106106
for(unsigned long i=0; i < 10000000 ; i++) {
107107
;
108-
}
108+
}
109109

110110
gl.UpdScreen (glfwos, delta);
111111
}

0 commit comments

Comments
 (0)