Explorar el Código

new opengl binding dev

leonsal hace 8 años
padre
commit
838d3795ae
Se han modificado 5 ficheros con 15 adiciones y 14 borrados
  1. 1 1
      gls/build.go
  2. 7 1
      gls/glapi.c
  3. 0 6
      gls/glapi2go/main.go
  4. 7 1
      gls/glapi2go/template.go
  5. 0 5
      gls/gls.go

+ 1 - 1
gls/build.go

@@ -13,6 +13,6 @@ package gls
 // #cgo linux CFLAGS: -DGL_GLEXT_PROTOTYPES
 // #cgo linux LDFLAGS: -ldl -lGL
 //
-// #cgo windows CFLAGS: -DGL_GEXT_PROTOTYPES
+// #cgo windows CFLAGS: -DGL_GLEXT_PROTOTYPES
 // #cgo windows LDFLAGS: -lopengl32
 import "C"

+ 7 - 1
gls/glapi.c

@@ -18,13 +18,19 @@
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN 1
 #include <windows.h>
+#undef near
+#undef far
 
 static HMODULE libgl;
 
 // open_libgl opens the OpenGL dll for Windows
-static void open_libgl(void) {
+static int open_libgl(void) {
 
 	libgl = LoadLibraryA("opengl32.dll");
+	if (libgl == NULL) {
+		return -1;
+	}
+	return 0;
 }
 
 // close_libgl closes the OpenGL dll object for Windows

+ 0 - 6
gls/glapi2go/main.go

@@ -262,12 +262,6 @@ func glfname2go(glfname string) string {
 func gldef2go(gldef string) string {
 
 	return strings.TrimPrefix(gldef, "GL_")
-	//parts := strings.Split(gldef, "_")
-	//var res string
-	//for _, p := range parts[1:] {
-	//	res += strings.Title(strings.ToLower(p))
-	//}
-	//return res
 }
 
 // glval2go converts a C OpenGL value to a Go value

+ 7 - 1
gls/glapi2go/template.go

@@ -101,13 +101,19 @@ const templGLAPIC = `
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN 1
 #include <windows.h>
+#undef near
+#undef far
 
 static HMODULE libgl;
 
 // open_libgl opens the OpenGL dll for Windows
-static void open_libgl(void) {
+static int open_libgl(void) {
 
 	libgl = LoadLibraryA("opengl32.dll");
+	if (libgl == NULL) {
+		return -1;
+	}
+	return 0;
 }
 
 // close_libgl closes the OpenGL dll object for Windows

+ 0 - 5
gls/gls.go

@@ -517,11 +517,6 @@ func (gs *GLS) TexImage2D(target uint32, level int32, iformat int32, width int32
 		ptr(data))
 }
 
-func (gs *GLS) TexStorage2D(target int, levels int, iformat int, width, height int) {
-
-	C.glTexStorage2D(C.GLenum(target), C.GLsizei(levels), C.GLenum(iformat), C.GLsizei(width), C.GLsizei(height))
-}
-
 func (gs *GLS) TexParameteri(target uint32, pname uint32, param int32) {
 
 	C.glTexParameteri(C.GLenum(target), C.GLenum(pname), C.GLint(param))