Kaynağa Gözat

macOS improvements/changes

danaugrs 7 yıl önce
ebeveyn
işleme
1929d60701

+ 3 - 1
README.md

@@ -44,7 +44,9 @@ In all cases it is necessary to have a gcc compatible C compiler installed.
 * For Windows the necessary audio libraries sources and `dlls` are supplied but they need to be installed
   manually. Please see [Audio libraries for Windows](audio/windows) for details.
   We tested the Windows build using the [mingw-w64](https://mingw-w64.org) toolchain.
-* Currently not tested on OS X
+* (Not fully-tested on OSX) On OSX, you should install the development files of OpenAL and Vorbis. If
+  your are using [Homebrew](https://brew.sh/) as your package manager, run:
+  `brew install libvorbis openal-soft`
 
 G3N was only tested with Go1.7.4+
 

+ 2 - 2
audio/al/al.go

@@ -7,10 +7,10 @@
 package al
 
 /*
-#cgo darwin   CFLAGS:  -DGO_DARWIN  -I/usr/include/AL
+#cgo darwin   CFLAGS:  -DGO_DARWIN  -I/usr/local/opt/openal-soft/include/AL -I/usr/include/AL
 #cgo linux    CFLAGS:  -DGO_LINUX   -I/usr/include/AL
 #cgo windows  CFLAGS:  -DGO_WINDOWS -I${SRCDIR}/../windows/openal-soft-1.18.2/include/AL
-#cgo darwin   LDFLAGS: -lopenal
+#cgo darwin   LDFLAGS: -L/usr/local/opt/openal-soft/lib -lopenal
 #cgo linux    LDFLAGS: -lopenal
 #cgo windows  LDFLAGS: -L${SRCDIR}/../windows/bin -lOpenAL32
 

+ 2 - 2
audio/ov/vorbisfile.go

@@ -6,10 +6,10 @@
 // The libvorbisfile C API reference is at: https://xiph.org/vorbis/doc/vorbisfile/reference.html
 package ov
 
-// #cgo darwin   CFLAGS:  -DGO_DARWIN  -I/usr/include/vorbis
+// #cgo darwin   CFLAGS:  -DGO_DARWIN  -I/usr/include/vorbis -I/usr/local/include/vorbis
 // #cgo linux    CFLAGS:  -DGO_LINUX   -I/usr/include/vorbis
 // #cgo windows  CFLAGS:  -DGO_WINDOWS -I${SRCDIR}/../windows/libvorbis-1.3.5/include/vorbis -I${SRCDIR}/../windows/libogg-1.3.3/include
-// #cgo darwin   LDFLAGS: -lvorbisfile
+// #cgo darwin   LDFLAGS: -L/usr/lib -L/usr/local/lib -lvorbisfile
 // #cgo linux    LDFLAGS: -lvorbisfile
 // #cgo windows  LDFLAGS: -L${SRCDIR}/../windows/bin -llibvorbisfile
 // #include <stdlib.h>

+ 2 - 2
audio/vorbis/vorbis.go

@@ -6,10 +6,10 @@
 // See API reference at: https://xiph.org/vorbis/doc/libvorbis/reference.html
 package vorbis
 
-// #cgo darwin   CFLAGS:  -DGO_DARWIN  -I/usr/include/vorbis
+// #cgo darwin   CFLAGS:  -DGO_DARWIN  -I/usr/include/vorbis -I/usr/local/include/vorbis
 // #cgo linux    CFLAGS:  -DGO_LINUX   -I/usr/include/vorbis
 // #cgo windows  CFLAGS:  -DGO_WINDOWS -I${SRCDIR}/../windows/libvorbis-1.3.5/include/vorbis -I${SRCDIR}/../windows/libogg-1.3.3/include
-// #cgo darwin   LDFLAGS: -lvorbis
+// #cgo darwin   LDFLAGS: -L/usr/lib -L/usr/local/lib -lvorbis
 // #cgo linux    LDFLAGS: -lvorbis
 // #cgo windows  LDFLAGS: -L${SRCDIR}/../windows/bin -llibvorbis
 // #include "codec.h"

+ 32 - 2
gls/glapi.c

@@ -153,8 +153,38 @@ void glapiCheckError(int check) {
 // Internal function to abort process when error
 static void panic(GLenum err, const char* fname) {
 
-	printf("\nGLAPI Error: %d calling: %s\n", err, fname);
-	exit(1);
+		const char *msg;
+		switch(err) {
+    	case GL_NO_ERROR:
+    		msg = "No error";
+    		break;
+    	case GL_INVALID_ENUM:
+    		msg = "An unacceptable value is specified for an enumerated argument";
+    		break;
+    	case GL_INVALID_VALUE:
+    		msg = "A numeric argument is out of range";
+    		break;
+    	case GL_INVALID_OPERATION:
+    		msg = "The specified operation is not allowed in the current state";
+    		break;
+    	case GL_INVALID_FRAMEBUFFER_OPERATION:
+    		msg = "The framebuffer object is not complete";
+    		break;
+    	case GL_OUT_OF_MEMORY:
+    		msg = "There is not enough memory left to execute the command";
+    		break;
+    	case GL_STACK_UNDERFLOW:
+    		msg = "An attempt has been made to perform an operation that would cause an internal stack to underflow";
+    		break;
+    	case GL_STACK_OVERFLOW:
+    		msg = "An attempt has been made to perform an operation that would cause an internal stack to overflow";
+    		break;
+    	default:
+    		msg = "Unexpected error";
+    		break;
+    }
+    printf("\nGLAPI Error: %s (%d) calling: %s\n", msg, err, fname);
+    exit(1);
 }
 
 

+ 32 - 2
gls/glapi2go/template.go

@@ -240,8 +240,38 @@ void glapiCheckError(int check) {
 // Internal function to abort process when error
 static void panic(GLenum err, const char* fname) {
 
-	printf("\nGLAPI Error: %d calling: %s\n", err, fname);
-	exit(1);
+		const char *msg;
+		switch(err) {
+    	case GL_NO_ERROR:
+    		msg = "No error";
+    		break;
+    	case GL_INVALID_ENUM:
+    		msg = "An unacceptable value is specified for an enumerated argument";
+    		break;
+    	case GL_INVALID_VALUE:
+    		msg = "A numeric argument is out of range";
+    		break;
+    	case GL_INVALID_OPERATION:
+    		msg = "The specified operation is not allowed in the current state";
+    		break;
+    	case GL_INVALID_FRAMEBUFFER_OPERATION:
+    		msg = "The framebuffer object is not complete";
+    		break;
+    	case GL_OUT_OF_MEMORY:
+    		msg = "There is not enough memory left to execute the command";
+    		break;
+    	case GL_STACK_UNDERFLOW:
+    		msg = "An attempt has been made to perform an operation that would cause an internal stack to underflow";
+    		break;
+    	case GL_STACK_OVERFLOW:
+    		msg = "An attempt has been made to perform an operation that would cause an internal stack to overflow";
+    		break;
+    	default:
+    		msg = "Unexpected error";
+    		break;
+    }
+    printf("\nGLAPI Error: %s (%d) calling: %s\n", msg, err, fname);
+    exit(1);
 }
 
 

+ 0 - 1
graphic/axis_helper.go

@@ -41,7 +41,6 @@ func NewAxisHelper(size float32) *AxisHelper {
 
 	// Creates line material
 	mat := material.NewBasic()
-	mat.SetLineWidth(2.0)
 
 	// Initialize lines with the specified geometry and material
 	axis.Lines.Init(geom, mat)

+ 0 - 1
graphic/grid_helper.go

@@ -44,7 +44,6 @@ func NewGridHelper(size, step float32, color *math32.Color) *GridHelper {
 
 	// Creates material
 	mat := material.NewBasic()
-	mat.SetLineWidth(1.0)
 
 	// Initialize lines with the specified geometry and material
 	grid.Lines.Init(geom, mat)