aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2010-10-06 14:05:36 +0200
committerDan Gudmundsson <[email protected]>2010-11-15 10:13:05 +0100
commita9f305c51ebccefc3ce6725b4f90700a7d250287 (patch)
tree64f522982e763eb5eda411196413a15704db36c4 /lib/wx/c_src
parentb48be79573171e530d97cdf078488eb66fc23f30 (diff)
downloadotp-a9f305c51ebccefc3ce6725b4f90700a7d250287.tar.gz
otp-a9f305c51ebccefc3ce6725b4f90700a7d250287.tar.bz2
otp-a9f305c51ebccefc3ce6725b4f90700a7d250287.zip
Split opengl functionality into separate dynamic library
The idea is to build a separate opengl library which can be reused by other erlang applications.
Diffstat (limited to 'lib/wx/c_src')
-rw-r--r--lib/wx/c_src/Makefile.in68
-rw-r--r--lib/wx/c_src/egl_impl.cpp316
-rw-r--r--lib/wx/c_src/egl_impl.h146
-rw-r--r--lib/wx/c_src/gen/gl_funcs.cpp445
-rw-r--r--lib/wx/c_src/gen/wxe_funcs.cpp10
-rw-r--r--lib/wx/c_src/wxe_driver.h5
-rw-r--r--lib/wx/c_src/wxe_gl.cpp335
-rw-r--r--lib/wx/c_src/wxe_gl.h119
-rw-r--r--lib/wx/c_src/wxe_impl.cpp2
9 files changed, 800 insertions, 646 deletions
diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in
index 8710641b57..9c85549a5c 100644
--- a/lib/wx/c_src/Makefile.in
+++ b/lib/wx/c_src/Makefile.in
@@ -32,14 +32,16 @@ endif
SO_EXT = @SO_EXT@
-GENERAL = wxe_driver wxe_ps_init wxe_impl wxePrintout wxe_return
+GENERAL = wxe_driver wxe_ps_init wxe_impl wxePrintout wxe_return wxe_gl
GENERAL_H = wxe_driver.h wxe_impl.h wxe_return.h
GENERATED_F = wxe_funcs wxe_events wxe_init
-GENERATED_H = gen/wxe_macros.h gen/glu_finit.h gen/gl_finit.h gen/gl_fdefs.h
+GENERATED_H = gen/wxe_macros.h
+
+GL_H = egl_impl.h gen/glu_finit.h gen/gl_finit.h gen/gl_fdefs.h
HAVE_OPENGL = true
-OPENGL_F = gl_funcs wxe_gl
+OPENGL_F = gl_funcs egl_impl
ifneq ($(INSIDE_ERLSRC),true)
@@ -60,9 +62,9 @@ SYS_TYPE = @WXERL_SYS_TYPE@
GENERAL_O = $(GENERAL:%=$(SYS_TYPE)/%.o)
GENERATED_O = $(GENERATED_F:%=$(SYS_TYPE)/%.o)
ifeq ($(HAVE_OPENGL), true)
- OPENGL_O = $(OPENGL_F:%=$(SYS_TYPE)/%.o)
+ GL_OBJECTS = $(OPENGL_F:%=$(SYS_TYPE)/%.o)
else
- OPENGL_O =
+ GL_OBJECTS =
endif
RC_FILE_EXT = @RC_FILE_TYPE@
@@ -72,9 +74,11 @@ else
RC_FILE =
endif
-OBJECTS = $(GENERAL_O) $(GENERATED_O) $(OPENGL_O) $(RC_FILE)
+WX_OBJECTS = $(GENERAL_O) $(GENERATED_O) $(RC_FILE)
+
+OBJECTS = $(WX_OBJECTS) $(OPENGL_O)
-TARGET_API = wxe_driver
+TARGET_APIS = wxe_driver erl_gl
TARGET_DIR = ../priv/$(SYS_TYPE)
# -O2 -funroll-loops -ffast-math -fomit-frame-pointer
@@ -87,31 +91,36 @@ LD = $(CPP)
LDFLAGS = @LDFLAGS@
RESCOMP = @WX_RESCOMP@
-
ifeq (@WX_HAVE_STATIC_LIBS@,true)
-WX_LIBS = @WX_LIBS_STATIC@
+OPT_WX_LIBS = @WX_LIBS_STATIC@
DEBUG_WX_LIBS = @DEBUG_WX_LIBS_STATIC@
else
-WX_LIBS = @WX_LIBS@
+OPT_WX_LIBS = @WX_LIBS@
DEBUG_WX_LIBS = @DEBUG_WX_LIBS@
endif
ifeq ($(TYPE),debug)
-CFLAGS = @DEBUG_WX_CFLAGS@ @DEBUG_CFLAGS@
-CPP_FLAGS = @DEBUG_WX_CXXFLAGS@ @DEBUG_CXXFLAGS@
-LIBS = $(DEBUG_WX_LIBS)
+WX_CFLAGS = @DEBUG_WX_CFLAGS@
+CFLAGS = @DEBUG_CFLAGS@
+WX_CXX_FLAGS = @DEBUG_WX_CXXFLAGS@
+CXX_FLAGS = @DEBUG_CXXFLAGS@
+WX_LIBS = $(DEBUG_WX_LIBS)
else
-CFLAGS = @WX_CFLAGS@ @CFLAGS@
-CPP_FLAGS = @WX_CXXFLAGS@ @CXXFLAGS@
-LIBS = $(WX_LIBS)
+WX_CFLAGS = @WX_CFLAGS@
+CFLAGS = @CFLAGS@
+WX_CXX_FLAGS = @WX_CXXFLAGS@
+CXX_FLAGS = @CXXFLAGS@
+WX_LIBS = $(OPT_WX_LIBS)
endif
-CC_O = $(CC) -c $(CFLAGS) $(COMMON_CFLAGS)
-CPP_O = $(CPP) -c $(CPP_FLAGS) $(COMMON_CFLAGS)
+CL_LIBS = -lGL -lGLU
+
+CC_O = $(CC) -c $(CFLAGS) $(WX_CFLAGS) $(COMMON_CFLAGS)
+CPP_O = $(CPP) -c $(CXX_FLAGS) $(WX_CXX_FLAGS) $(COMMON_CFLAGS)
# Targets
-opt: $(TARGET_DIR)/$(TARGET_API)$(SO_EXT)
+opt: $(TARGET_DIR)/wxe_driver$(SO_EXT) $(TARGET_DIR)/erl_gl$(SO_EXT)
debug:
@${MAKE} TYPE=debug
@@ -132,20 +141,22 @@ complete_clean:
docs:
+$(GL_OBJECTS): $(GL_H)
+$(WX_OBJECTS): $(GENERATED_H) $(GENERAL_H)
-$(SYS_TYPE)/%.o: %.cpp $(GENERATED_H) $(GENERAL_H)
+$(SYS_TYPE)/%.o: %.cpp
mkdir -p $(SYS_TYPE)
$(CPP_O) $< -o $@
-$(SYS_TYPE)/%.o: %.c $(GENERATED_H) $(GENERAL_H)
+$(SYS_TYPE)/%.o: %.c
mkdir -p $(SYS_TYPE)
$(CC_O) $< -o $@
-$(SYS_TYPE)/%.o: gen/%.cpp $(GENERATED_H) $(GENERAL_H)
+$(SYS_TYPE)/%.o: gen/%.cpp
mkdir -p $(SYS_TYPE)
$(CPP_O) $< -o $@
-$(SYS_TYPE)/%.o: gen/%.c $(GENERATED_H) $(GENERAL_H)
+$(SYS_TYPE)/%.o: gen/%.c
mkdir -p $(SYS_TYPE)
$(CC_O) $< -o $@
@@ -153,9 +164,13 @@ $(SYS_TYPE)/wxe_win32.$(RC_FILE_EXT): wxe_win32.rc
mkdir -p $(SYS_TYPE)
$(RESCOMP) -o $@ $<
-$(TARGET_DIR)/$(TARGET_API)$(SO_EXT): $(OBJECTS)
+$(TARGET_DIR)/wxe_driver$(SO_EXT): $(WX_OBJECTS)
+ mkdir -p $(TARGET_DIR)
+ $(LD) $(LDFLAGS) $(WX_OBJECTS) $(WX_LIBS) -o $@
+
+$(TARGET_DIR)/erl_gl$(SO_EXT): $(GL_OBJECTS)
mkdir -p $(TARGET_DIR)
- $(LD) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
+ $(CC) $(LDFLAGS) $(GL_OBJECTS) $(CL_LIBS) -o $@
# ----------------------------------------------------
@@ -167,7 +182,8 @@ release_spec: opt
$(INSTALL_DIR) $(RELSYSDIR)/priv/$(SYS_TYPE)
$(INSTALL_DATA) ../priv/erlang-logo32.png $(RELSYSDIR)/priv/
$(INSTALL_DATA) ../priv/erlang-logo64.png $(RELSYSDIR)/priv/
- $(INSTALL_PROGRAM) $(TARGET_DIR)/$(TARGET_API)$(SO_EXT) $(RELSYSDIR)/priv/$(SYS_TYPE)
+ $(INSTALL_PROGRAM) $(TARGET_DIR)/wxe_driver$(SO_EXT) $(RELSYSDIR)/priv/$(SYS_TYPE)
+ $(INSTALL_PROGRAM) $(TARGET_DIR)/erl_gl$(SO_EXT) $(RELSYSDIR)/priv/$(SYS_TYPE)
release_docs_spec:
diff --git a/lib/wx/c_src/egl_impl.cpp b/lib/wx/c_src/egl_impl.cpp
new file mode 100644
index 0000000000..9240bc49f0
--- /dev/null
+++ b/lib/wx/c_src/egl_impl.cpp
@@ -0,0 +1,316 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2010. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "egl_impl.h"
+
+#define WX_DEF_EXTS
+#include "gen/gl_fdefs.h"
+#include "gen/gl_finit.h"
+#include "gen/glu_finit.h"
+
+void init_tess();
+void exit_tess();
+int load_gl_functions();
+
+/* ****************************************************************************
+ * OPENGL INITIALIZATION
+ *****************************************************************************/
+
+int egl_initiated = 0;
+
+#ifdef _WIN32
+void * dlsym(HMODULE Lib, const char *func) {
+ void * funcp;
+ if((funcp = (void *) GetProcAddress(Lib, func)))
+ return funcp;
+ else
+ return (void *) wglGetProcAddress(func);
+}
+#endif
+
+int egl_init_opengl()
+{
+ if(egl_initiated == 0) {
+ if(load_gl_functions()) {
+ init_tess();
+ egl_initiated = 1;
+ }
+ }
+ return 1;
+}
+
+int load_gl_functions() {
+#ifdef _MACOSX
+ char * DLName = "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib";
+ void * LIBhandle = dlopen(DLName, RTLD_LAZY);
+#elif defined(_WIN32)
+ WCHAR * DLName = wxT("opengl32.dll");
+ HMODULE LIBhandle = LoadLibrary(DLName);
+#else
+ char * DLName = (char *) "libGL.so";
+ void * LIBhandle = dlopen(DLName, RTLD_LAZY);
+#endif
+ // fprintf(stderr, "Loading GL: %s\r\n", (const char*)DLName);
+ void * func = NULL;
+ int i;
+
+ if(LIBhandle) {
+ for(i=0; gl_fns[i].name != NULL; i++) {
+ if((func = dlsym(LIBhandle, gl_fns[i].name))) {
+ * (void **) (gl_fns[i].func) = func;
+ // fprintf(stderr, "GL LOADED %s \r\n", gl_fns[i].name);
+ } else {
+ if(gl_fns[i].alt != NULL) {
+ if((func = dlsym(LIBhandle, gl_fns[i].alt))) {
+ * (void **) (gl_fns[i].func) = func;
+ // fprintf(stderr, "GL LOADED %s \r\n", gl_fns[i].alt);
+ } else {
+ * (void **) (gl_fns[i].func) = (void *) &gl_error;
+ // fprintf(stderr, "GL Skipped %s and %s \r\n", gl_fns[i].name, gl_fns[i].alt);
+ };
+ } else {
+ * (void **) (gl_fns[i].func) = (void *) &gl_error;
+ // fprintf(stderr, "GL Skipped %s \r\n", gl_fns[i].name);
+ }
+ }
+ }
+#ifdef _WIN32
+ FreeLibrary(LIBhandle);
+#else
+ dlclose(LIBhandle);
+#endif
+ // fprintf(stderr, "OPENGL library is loaded\r\n");
+ } else {
+// wxString msg;
+// msg.Printf(wxT("Could NOT load OpenGL library: "));
+// #ifdef _WIN32
+// msg += DLName;
+// #else
+// msg += wxString::FromAscii((char *)DLName);
+// #endif
+// send_msg("error", &msg);
+ fprintf(stderr, "Could NOT load OpenGL library: %s\r\n", DLName);
+ };
+
+#ifdef _MACOSX
+ DLName = "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib";
+ LIBhandle = dlopen(DLName, RTLD_LAZY);
+#elif defined(_WIN32)
+ DLName = wxT("glu32.dll");
+ LIBhandle = LoadLibrary(DLName);
+#else
+ DLName = (char *) "libGLU.so";
+ LIBhandle = dlopen(DLName, RTLD_LAZY);
+#endif
+ // fprintf(stderr, "Loading GL: %s\r\n", (const char*)DLName);
+ func = NULL;
+
+ if(LIBhandle) {
+ for(i=0; glu_fns[i].name != NULL; i++) {
+ if((func = dlsym(LIBhandle, glu_fns[i].name))) {
+ * (void **) (glu_fns[i].func) = func;
+ } else {
+ if(glu_fns[i].alt != NULL) {
+ if((func = dlsym(LIBhandle, glu_fns[i].alt))) {
+ * (void **) (glu_fns[i].func) = func;
+ } else {
+ * (void **) (glu_fns[i].func) = (void *) &gl_error;
+ // fprintf(stderr, "GLU Skipped %s\r\n", glu_fns[i].alt);
+ };
+ } else {
+ * (void **) (glu_fns[i].func) = (void *) &gl_error;
+ // fprintf(stderr, "GLU Skipped %s\r\n", glu_fns[i].name);
+ }
+ }
+ }
+#ifdef _WIN32
+ FreeLibrary(LIBhandle);
+#else
+ dlclose(LIBhandle);
+#endif
+ // fprintf(stderr, "GLU library is loaded\r\n");
+ } else {
+// wxString msg;
+// msg.Printf(wxT("Could NOT load OpenGL GLU library: "));
+// #ifdef _WIN32
+// msg += DLName;
+// #else
+// msg += wxString::FromAscii((char *)DLName);
+// #endif
+// send_msg("error", &msg);
+ fprintf(stderr, "Could NOT load OpenGL GLU library: %s\r\n", DLName);
+ };
+
+ return 1;
+}
+
+void gl_error() {
+ // int AP = 0; ErlDrvTermData rt[8];
+ // rt[AP++] = ERL_DRV_ATOM; rt[AP++] = driver_mk_atom((char *)"_wxe_error_");
+ // rt[AP++] = ERL_DRV_INT; rt[AP++] = (int) gl_error_op;
+ // rt[AP++] = ERL_DRV_ATOM; rt[AP++] = driver_mk_atom((char *)"undef");
+ // rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
+ // driver_send_term(WXE_DRV_PORT,gl_active,rt,AP);
+ // BUGBUG
+ fprintf(stderr, "OpenGL Extension not available : %d\r\n", gl_error_op);
+}
+
+/* *******************************************************************************
+ * GLU Tesselation special
+ * ******************************************************************************/
+
+static GLUtesselator* tess;
+static GLdouble* tess_coords;
+static GLdouble* tess_alloc_vertex;
+static int* tess_vertices;
+
+void CALLBACK
+egl_ogla_vertex(GLdouble* coords)
+{
+ /* fprintf(stderr, "%d\r\n", (int) (coords - tess_coords) / 3); */
+
+ *tess_vertices++ = (int) (coords - tess_coords) / 3;
+}
+
+void CALLBACK
+egl_ogla_edge_flag(GLboolean flag)
+{
+}
+
+void CALLBACK
+egl_ogla_error(GLenum errorCode)
+{
+ const GLubyte *err;
+ err = gluErrorString(errorCode);
+ // wxString msg;
+ // msg.Printf(wxT("Tesselation error: %d: "), (int)errorCode);
+ // msg += wxString::FromAscii((char *) err);
+ // send_msg("error", &msg);
+ fprintf(stderr, "Tesselation error: %d\r\n", (int) errorCode);
+}
+
+void CALLBACK
+egl_ogla_combine(GLdouble coords[3],
+ void* vertex_data[4],
+ GLfloat w[4],
+ void **dataOut)
+{
+ GLdouble* vertex = tess_alloc_vertex;
+
+ tess_alloc_vertex += 3;
+
+#if 0
+ fprintf(stderr, "combine: ");
+ int i;
+ for (i = 0; i < 4; i++) {
+ if (w[i] > 0.0) {
+ fprintf(stderr, "%d(%g) ", (int) vertex_data[i], w[i]);
+ }
+ }
+ fprintf(stderr, "\r\n");
+ fprintf(stderr, "%g %g %g\r\n", vertex[0], vertex[1], vertex[2]);
+#endif
+
+ vertex[0] = coords[0];
+ vertex[1] = coords[1];
+ vertex[2] = coords[2];
+ *dataOut = vertex;
+}
+
+void init_tess()
+{
+ tess = gluNewTess();
+
+ gluTessCallback(tess, GLU_TESS_VERTEX, (GLUfuncptr) egl_ogla_vertex);
+ gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (GLUfuncptr) egl_ogla_edge_flag);
+ gluTessCallback(tess, GLU_TESS_COMBINE, (GLUfuncptr) egl_ogla_combine);
+ gluTessCallback(tess, GLU_TESS_ERROR, (GLUfuncptr) egl_ogla_error);
+
+}
+
+void exit_tess()
+{
+ gluDeleteTess(tess);
+}
+
+int erl_tess_impl(char* buff, ErlDrvPort port, ErlDrvTermData caller)
+{
+ ErlDrvBinary* bin;
+ int i;
+ GLdouble* new_vertices;
+ int *vertices;
+ int num_vertices;
+ GLdouble *n;
+ int n_pos, AP, res;
+
+ num_vertices = * (int *) buff; buff += 8; /* Align */
+ n = (double *) buff; buff += 8*3;
+
+ bin = driver_alloc_binary(num_vertices*6*sizeof(GLdouble));
+ new_vertices = tess_coords = (double *) bin->orig_bytes;
+ memcpy(tess_coords,buff,num_vertices*3*sizeof(GLdouble));
+ tess_alloc_vertex = tess_coords + num_vertices*3;
+
+#if 0
+ fprintf(stderr, "n=%d\r\n", num_vertices);
+#endif
+ vertices = (int *) driver_alloc(sizeof(int) * 16*num_vertices);
+
+ tess_vertices = vertices;
+
+ gluTessNormal(tess, n[0], n[1], n[2]);
+ gluTessBeginPolygon(tess, 0);
+ gluTessBeginContour(tess);
+ for (i = 0; i < num_vertices; i++) {
+ gluTessVertex(tess, tess_coords+3*i, tess_coords+3*i);
+ }
+ gluTessEndContour(tess);
+ gluTessEndPolygon(tess);
+
+ n_pos = (tess_vertices - vertices);
+
+ AP = 0; ErlDrvTermData *rt;
+ rt = (ErlDrvTermData *) driver_alloc(sizeof(ErlDrvTermData) * (13+n_pos*2));
+ rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_egl_result_");
+
+ for(i=0; i < n_pos; i++) {
+ rt[AP++] = ERL_DRV_INT; rt[AP++] = (int) vertices[i];
+ };
+ rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = n_pos+1;
+
+ rt[AP++] = ERL_DRV_BINARY; rt[AP++] = (ErlDrvTermData) bin;
+ rt[AP++] = (tess_alloc_vertex-new_vertices)*sizeof(GLdouble); rt[AP++] = 0;
+
+ rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2; // Return tuple {list, Bin}
+ rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2; // Result tuple
+
+ res = driver_send_term(port,caller,rt,AP);
+ /* fprintf(stderr, "List %d: %d %d %d \r\n", */
+ /* res, */
+ /* n_pos, */
+ /* (tess_alloc_vertex-new_vertices)*sizeof(GLdouble), */
+ /* num_vertices*6*sizeof(GLdouble)); */
+ driver_free_binary(bin);
+ driver_free(vertices);
+ driver_free(rt);
+ return 0;
+}
diff --git a/lib/wx/c_src/egl_impl.h b/lib/wx/c_src/egl_impl.h
new file mode 100644
index 0000000000..60be2c41d2
--- /dev/null
+++ b/lib/wx/c_src/egl_impl.h
@@ -0,0 +1,146 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2010. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#include "erl_driver.h"
+
+/* Wrap everything from glext.h so we are not dependent on the user version of it */
+
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
+
+#ifndef __WXMAC__
+# include <GL/gl.h>
+# include <GL/glu.h> /* Header File For The OpenGL Library */
+#else
+# include <OpenGL/glu.h> /* Header File For The OpenGL Library */
+#endif
+
+#ifndef CALLBACK
+# define CALLBACK
+#endif
+
+#ifdef _WIN32
+# ifndef _GLUfuncptr
+// Visual studio CPP ++ compiler
+# define _GLUfuncptr void (_stdcall *)()
+# endif
+#endif
+
+#ifdef _GLUfuncptr
+# define GLUfuncptr _GLUfuncptr
+#elif defined(TESS_CB_TIGER_STYLE)
+# define GLUfuncptr GLvoid (*)(...)
+#else
+# define GLUfuncptr GLvoid (*)()
+#endif
+
+#ifdef WIN32
+#include <windows.h>
+#include <gl/gl.h>
+#elif defined(HAVE_GL_GL_H)
+#include <GL/gl.h>
+#elif defined(HAVE_OPENGL_GL_H)
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+/* Some new GL types (eliminates the need for glext.h) */
+
+#ifndef HAVE_GLINTPTR
+#ifndef HAVE_GLINTPTRARB
+# include <stddef.h>
+/* GL types for handling large vertex buffer objects */
+typedef ptrdiff_t GLintptrARB;
+typedef ptrdiff_t GLsizeiptrARB;
+#endif /* HAVE_GLINTPTRARB */
+typedef GLintptrARB GLintptr;
+typedef GLsizeiptrARB GLsizeiptr;
+#endif /* HAVE_GLINTPTR */
+
+#ifndef HAVE_GLCHAR
+# ifndef HAVE_GLCHARARB
+/* GL types for handling shader object handles and characters */
+typedef char GLcharARB; /* native character */
+typedef unsigned int GLhandleARB; /* shader object handle */
+#endif /* HAVE_GLCHARARB */
+typedef GLcharARB GLchar;
+#endif
+
+#ifndef HAVE_GLHALFARB
+/* GL types for "half" precision (s10e5) float data in host memory */
+typedef unsigned short GLhalfARB;
+#endif
+
+/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
+/* (as used in the GLX_OML_sync_control extension). */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+#elif defined(__sun__)
+#include <inttypes.h>
+#if defined(__STDC__)
+#if defined(__arch64__)
+typedef long int int64_t;
+typedef unsigned long int uint64_t;
+#else
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#endif /* __arch64__ */
+#endif /* __STDC__ */
+#elif defined( __VMS )
+#include <inttypes.h>
+#elif defined(__SCO__) || defined(__USLC__)
+#include <stdint.h>
+#elif defined(__UNIXOS2__) || defined(__SOL64__)
+typedef long int int32_t;
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#elif defined(WIN32) && defined(_MSC_VER)
+typedef long int int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#elif defined(WIN32) && defined(__GNUC__)
+#include <stdint.h>
+#else
+#include <inttypes.h> /* Fallback option */
+#endif
+
+#ifndef HAVE_GLINT64EXT
+typedef int64_t GLint64EXT;
+typedef uint64_t GLuint64EXT;
+#endif
+
+/* External Api */
+
+#ifdef _WIN32
+__declspec(dllexport) int egl_init_opengl();
+__declspec(dllexport) void egl_dispatch(int, char *, ErlDrvPort, ErlDrvTermData, char **);
+#else
+extern "C" int egl_init_opengl();
+extern "C" void egl_dispatch(int, char *, ErlDrvPort, ErlDrvTermData, char **);
+#endif
+
+/* internal */
+int erl_tess_impl(char* buff, ErlDrvPort port, ErlDrvTermData caller);
+void gl_error();
+extern int gl_error_op;
+extern ErlDrvTermData gl_active;
+
diff --git a/lib/wx/c_src/gen/gl_funcs.cpp b/lib/wx/c_src/gen/gl_funcs.cpp
index 95d3c23b23..3bda818366 100644
--- a/lib/wx/c_src/gen/gl_funcs.cpp
+++ b/lib/wx/c_src/gen/gl_funcs.cpp
@@ -20,37 +20,16 @@
#include <stdio.h>
#include <string.h>
-#include "../wxe_impl.h"
-#include "../wxe_gl.h"
+#include "../egl_impl.h"
#include "gl_fdefs.h"
int gl_error_op;
-void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
+void egl_dispatch(int op, char *bp, ErlDrvPort port, ErlDrvTermData caller, char *bins[]){
gl_error_op = op;
- if(caller != gl_active) {
- wxGLCanvas * current = glc[caller];
- if(current) { gl_active = caller; current->SetCurrent();}
- else {
- ErlDrvTermData rt[] = // Error msg
- {ERL_DRV_ATOM, driver_mk_atom((char *) "_wxe_error_"),
- ERL_DRV_INT, op,
- ERL_DRV_ATOM, driver_mk_atom((char *) "no_gl_context"),
- ERL_DRV_TUPLE,3};
- driver_send_term(WXE_DRV_PORT,caller,rt,8);
- return ;
- }
- };
-
switch(op)
{
case 5000:
- wxe_tess_impl(bp, caller);
- break;
- case WXE_BIN_INCR:
- driver_binary_inc_refc(bins[0]->bin);
- break;
- case WXE_BIN_DECR:
- driver_binary_dec_refc(bins[0]->bin);
+ erl_tess_impl(bp, port, caller);
break;
case 5010: { // gluBuild1DMipmapLevels
GLenum *target = (GLenum *) bp; bp += 4;
@@ -61,14 +40,14 @@ case 5010: { // gluBuild1DMipmapLevels
GLint *level = (GLint *) bp; bp += 4;
GLint *base = (GLint *) bp; bp += 4;
GLint *max = (GLint *) bp; bp += 4;
- void *data = (void *) bins[0]->base;
+ void *data = (void *) bins[0];
GLint result = wegluBuild1DMipmapLevels(*target,*internalFormat,*width,*format,*type,*level,*base,*max,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5011: { // gluBuild1DMipmaps
GLenum *target = (GLenum *) bp; bp += 4;
@@ -76,14 +55,14 @@ case 5011: { // gluBuild1DMipmaps
GLsizei *width = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- void *data = (void *) bins[0]->base;
+ void *data = (void *) bins[0];
GLint result = wegluBuild1DMipmaps(*target,*internalFormat,*width,*format,*type,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5012: { // gluBuild2DMipmapLevels
GLenum *target = (GLenum *) bp; bp += 4;
@@ -95,14 +74,14 @@ case 5012: { // gluBuild2DMipmapLevels
GLint *level = (GLint *) bp; bp += 4;
GLint *base = (GLint *) bp; bp += 4;
GLint *max = (GLint *) bp; bp += 4;
- void *data = (void *) bins[0]->base;
+ void *data = (void *) bins[0];
GLint result = wegluBuild2DMipmapLevels(*target,*internalFormat,*width,*height,*format,*type,*level,*base,*max,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5013: { // gluBuild2DMipmaps
GLenum *target = (GLenum *) bp; bp += 4;
@@ -111,14 +90,14 @@ case 5013: { // gluBuild2DMipmaps
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- void *data = (void *) bins[0]->base;
+ void *data = (void *) bins[0];
GLint result = wegluBuild2DMipmaps(*target,*internalFormat,*width,*height,*format,*type,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5014: { // gluBuild3DMipmapLevels
GLenum *target = (GLenum *) bp; bp += 4;
@@ -131,14 +110,14 @@ case 5014: { // gluBuild3DMipmapLevels
GLint *level = (GLint *) bp; bp += 4;
GLint *base = (GLint *) bp; bp += 4;
GLint *max = (GLint *) bp; bp += 4;
- void *data = (void *) bins[0]->base;
+ void *data = (void *) bins[0];
GLint result = wegluBuild3DMipmapLevels(*target,*internalFormat,*width,*height,*depth,*format,*type,*level,*base,*max,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5015: { // gluBuild3DMipmaps
GLenum *target = (GLenum *) bp; bp += 4;
@@ -148,14 +127,14 @@ case 5015: { // gluBuild3DMipmaps
GLsizei *depth = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- void *data = (void *) bins[0]->base;
+ void *data = (void *) bins[0];
GLint result = wegluBuild3DMipmaps(*target,*internalFormat,*width,*height,*depth,*format,*type,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5016: { // gluCheckExtension
int * extNameLen = (int *) bp; bp += 4;
@@ -168,7 +147,7 @@ case 5016: { // gluCheckExtension
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5017: { // gluCylinder
GLUquadric * quad = (GLUquadric *) * (GLuint64EXT *) bp; bp += 8;
@@ -199,7 +178,7 @@ case 5020: { // gluErrorString
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) result; rt[AP++] = strlen((char *) result);
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5021: { // gluGetString
GLenum *name = (GLenum *) bp; bp += 4;
@@ -209,7 +188,7 @@ case 5021: { // gluGetString
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) result; rt[AP++] = strlen((char *) result);
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5022: { // gluLookAt
GLdouble *eyeX = (GLdouble *) bp; bp += 8;
@@ -230,7 +209,7 @@ case 5023: { // gluNewQuadric
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5024: { // gluOrtho2D
GLdouble *left = (GLdouble *) bp; bp += 8;
@@ -284,7 +263,7 @@ case 5028: { // gluProject
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5029: { // gluQuadricDrawStyle
GLUquadric * quad = (GLUquadric *) * (GLuint64EXT *) bp; bp += 8;
@@ -311,18 +290,18 @@ case 5033: { // gluScaleImage
GLsizei *wIn = (GLsizei *) bp; bp += 4;
GLsizei *hIn = (GLsizei *) bp; bp += 4;
GLenum *typeIn = (GLenum *) bp; bp += 4;
- void *dataIn = (void *) bins[0]->base;
+ void *dataIn = (void *) bins[0];
GLsizei *wOut = (GLsizei *) bp; bp += 4;
GLsizei *hOut = (GLsizei *) bp; bp += 4;
GLenum *typeOut = (GLenum *) bp; bp += 4;
- GLvoid *dataOut = (GLvoid *) bins[1]->base;
+ GLvoid *dataOut = (GLvoid *) bins[1];
GLint result = wegluScaleImage(*format,*wIn,*hIn,*typeIn,dataIn,*wOut,*hOut,*typeOut,dataOut);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5034: { // gluSphere
GLUquadric * quad = (GLUquadric *) * (GLuint64EXT *) bp; bp += 8;
@@ -351,7 +330,7 @@ case 5035: { // gluUnProject
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5036: { // gluUnProject4
GLdouble *winX = (GLdouble *) bp; bp += 8;
@@ -378,7 +357,7 @@ case 5036: { // gluUnProject4
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 5;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 16 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,16);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5037: { // glAccum
GLenum *op = (GLenum *) bp; bp += 4;
@@ -406,7 +385,7 @@ case 5039: { // glAreTexturesResident
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 11 + (*texturesLen)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,11 + (*texturesLen)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(residences);
}; break;
@@ -440,7 +419,7 @@ case 5044: { // glBitmap
GLfloat *yorig = (GLfloat *) bp; bp += 4;
GLfloat *xmove = (GLfloat *) bp; bp += 4;
GLfloat *ymove = (GLfloat *) bp; bp += 4;
- GLubyte *bitmap = (GLubyte *) bins[0]->base;
+ GLubyte *bitmap = (GLubyte *) bins[0];
weglBitmap(*width,*height,*xorig,*yorig,*xmove,*ymove,bitmap);
}; break;
case 5045: { // glBlendFunc
@@ -580,7 +559,7 @@ case 5074: { // glColorPointer
GLint *size = (GLint *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglColorPointer(*size,*type,*stride,pointer);
}; break;
case 5075: { // glCopyPixels
@@ -688,7 +667,7 @@ case 5091: { // glDrawElements
GLenum *mode = (GLenum *) bp; bp += 4;
GLsizei *count = (GLsizei *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *indices = (GLvoid *) bins[0]->base;
+ GLvoid *indices = (GLvoid *) bins[0];
weglDrawElements(*mode,*count,*type,indices);
}; break;
case 5092: { // glDrawPixels
@@ -704,7 +683,7 @@ case 5093: { // glDrawPixels
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglDrawPixels(*width,*height,*format,*type,pixels);
}; break;
case 5094: { // glEdgeFlagv
@@ -718,7 +697,7 @@ case 5095: { // glEdgeFlagPointer
}; break;
case 5096: { // glEdgeFlagPointer
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglEdgeFlagPointer(*stride,pointer);
}; break;
case 5097: { // glEnable
@@ -777,13 +756,13 @@ case 5108: { // glEvalPoint2
case 5109: { // glFeedbackBuffer
GLsizei *size = (GLsizei *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLfloat *buffer = (GLfloat *) bins[0]->base;
+ GLfloat *buffer = (GLfloat *) bins[0];
weglFeedbackBuffer(*size,*type,buffer);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5110: { // glFinish
weglFinish();
@@ -834,7 +813,7 @@ case 5118: { // glGenLists
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5119: { // glGenTextures
GLsizei *n = (GLsizei *) bp; bp += 4;
@@ -849,7 +828,7 @@ case 5119: { // glGenTextures
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(textures);
}; break;
@@ -879,7 +858,7 @@ case 5120: { // glGetBooleanv
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = 16+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 39 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,39);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5121: { // glGetClipPlane
GLenum *plane = (GLenum *) bp; bp += 4;
@@ -895,7 +874,7 @@ case 5121: { // glGetClipPlane
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5122: { // glGetDoublev
GLenum *pname = (GLenum *) bp; bp += 4;
@@ -923,7 +902,7 @@ case 5122: { // glGetDoublev
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = 16+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 39 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,39);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5123: { // glGetError
GLenum result = weglGetError();
@@ -932,7 +911,7 @@ case 5123: { // glGetError
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5124: { // glGetFloatv
GLenum *pname = (GLenum *) bp; bp += 4;
@@ -961,7 +940,7 @@ case 5124: { // glGetFloatv
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = 16+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 39 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,39);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5125: { // glGetIntegerv
GLenum *pname = (GLenum *) bp; bp += 4;
@@ -989,7 +968,7 @@ case 5125: { // glGetIntegerv
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = 16+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 39 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,39);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5126: { // glGetLightfv
GLenum *light = (GLenum *) bp; bp += 4;
@@ -1007,7 +986,7 @@ case 5126: { // glGetLightfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5127: { // glGetLightiv
GLenum *light = (GLenum *) bp; bp += 4;
@@ -1024,40 +1003,40 @@ case 5127: { // glGetLightiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5128: { // glGetMapdv
GLenum *target = (GLenum *) bp; bp += 4;
GLenum *query = (GLenum *) bp; bp += 4;
- GLdouble *v = (GLdouble *) bins[0]->base;
+ GLdouble *v = (GLdouble *) bins[0];
weglGetMapdv(*target,*query,v);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5129: { // glGetMapfv
GLenum *target = (GLenum *) bp; bp += 4;
GLenum *query = (GLenum *) bp; bp += 4;
- GLfloat *v = (GLfloat *) bins[0]->base;
+ GLfloat *v = (GLfloat *) bins[0];
weglGetMapfv(*target,*query,v);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5130: { // glGetMapiv
GLenum *target = (GLenum *) bp; bp += 4;
GLenum *query = (GLenum *) bp; bp += 4;
- GLint *v = (GLint *) bins[0]->base;
+ GLint *v = (GLint *) bins[0];
weglGetMapiv(*target,*query,v);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5131: { // glGetMaterialfv
GLenum *face = (GLenum *) bp; bp += 4;
@@ -1075,7 +1054,7 @@ case 5131: { // glGetMaterialfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5132: { // glGetMaterialiv
GLenum *face = (GLenum *) bp; bp += 4;
@@ -1092,37 +1071,37 @@ case 5132: { // glGetMaterialiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5133: { // glGetPixelMapfv
GLenum *map = (GLenum *) bp; bp += 4;
- GLfloat *values = (GLfloat *) bins[0]->base;
+ GLfloat *values = (GLfloat *) bins[0];
weglGetPixelMapfv(*map,values);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5134: { // glGetPixelMapuiv
GLenum *map = (GLenum *) bp; bp += 4;
- GLuint *values = (GLuint *) bins[0]->base;
+ GLuint *values = (GLuint *) bins[0];
weglGetPixelMapuiv(*map,values);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5135: { // glGetPixelMapusv
GLenum *map = (GLenum *) bp; bp += 4;
- GLushort *values = (GLushort *) bins[0]->base;
+ GLushort *values = (GLushort *) bins[0];
weglGetPixelMapusv(*map,values);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5136: { // glGetPolygonStipple
GLubyte mask[128];
@@ -1134,7 +1113,7 @@ case 5136: { // glGetPolygonStipple
rt[AP++] = ERL_DRV_BINARY; rt[AP++] = (ErlDrvTermData) BinCopy; rt[AP++] = 128; rt[AP++] = 0;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free_binary(BinCopy);
}; break;
case 5137: { // glGetString
@@ -1145,7 +1124,7 @@ case 5137: { // glGetString
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) result; rt[AP++] = strlen((char *) result);
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5138: { // glGetTexEnvfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1163,7 +1142,7 @@ case 5138: { // glGetTexEnvfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5139: { // glGetTexEnviv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1180,7 +1159,7 @@ case 5139: { // glGetTexEnviv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5140: { // glGetTexGendv
GLenum *coord = (GLenum *) bp; bp += 4;
@@ -1197,7 +1176,7 @@ case 5140: { // glGetTexGendv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5141: { // glGetTexGenfv
GLenum *coord = (GLenum *) bp; bp += 4;
@@ -1215,7 +1194,7 @@ case 5141: { // glGetTexGenfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5142: { // glGetTexGeniv
GLenum *coord = (GLenum *) bp; bp += 4;
@@ -1232,20 +1211,20 @@ case 5142: { // glGetTexGeniv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5143: { // glGetTexImage
GLenum *target = (GLenum *) bp; bp += 4;
GLint *level = (GLint *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglGetTexImage(*target,*level,*format,*type,pixels);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5144: { // glGetTexLevelParameterfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1261,7 +1240,7 @@ case 5144: { // glGetTexLevelParameterfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5145: { // glGetTexLevelParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1276,7 +1255,7 @@ case 5145: { // glGetTexLevelParameteriv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5146: { // glGetTexParameterfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1294,7 +1273,7 @@ case 5146: { // glGetTexParameterfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5147: { // glGetTexParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1311,7 +1290,7 @@ case 5147: { // glGetTexParameteriv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5148: { // glHint
GLenum *target = (GLenum *) bp; bp += 4;
@@ -1331,7 +1310,7 @@ case 5150: { // glIndexPointer
case 5151: { // glIndexPointer
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglIndexPointer(*type,*stride,pointer);
}; break;
case 5152: { // glIndexdv
@@ -1366,7 +1345,7 @@ case 5158: { // glInterleavedArrays
case 5159: { // glInterleavedArrays
GLenum *format = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglInterleavedArrays(*format,*stride,pointer);
}; break;
case 5160: { // glIsEnabled
@@ -1377,7 +1356,7 @@ case 5160: { // glIsEnabled
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5161: { // glIsList
GLuint *list = (GLuint *) bp; bp += 4;
@@ -1387,7 +1366,7 @@ case 5161: { // glIsList
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5162: { // glIsTexture
GLuint *texture = (GLuint *) bp; bp += 4;
@@ -1397,7 +1376,7 @@ case 5162: { // glIsTexture
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5163: { // glLightModelf
GLenum *pname = (GLenum *) bp; bp += 4;
@@ -1486,7 +1465,7 @@ case 5179: { // glMap1d
GLdouble *u2 = (GLdouble *) bp; bp += 8;
GLint *stride = (GLint *) bp; bp += 4;
GLint *order = (GLint *) bp; bp += 4;
- GLdouble *points = (GLdouble *) bins[0]->base;
+ GLdouble *points = (GLdouble *) bins[0];
weglMap1d(*target,*u1,*u2,*stride,*order,points);
}; break;
case 5180: { // glMap1f
@@ -1495,7 +1474,7 @@ case 5180: { // glMap1f
GLfloat *u2 = (GLfloat *) bp; bp += 4;
GLint *stride = (GLint *) bp; bp += 4;
GLint *order = (GLint *) bp; bp += 4;
- GLfloat *points = (GLfloat *) bins[0]->base;
+ GLfloat *points = (GLfloat *) bins[0];
weglMap1f(*target,*u1,*u2,*stride,*order,points);
}; break;
case 5181: { // glMap2d
@@ -1509,7 +1488,7 @@ case 5181: { // glMap2d
GLdouble *v2 = (GLdouble *) bp; bp += 8;
GLint *vstride = (GLint *) bp; bp += 4;
GLint *vorder = (GLint *) bp; bp += 4;
- GLdouble *points = (GLdouble *) bins[0]->base;
+ GLdouble *points = (GLdouble *) bins[0];
weglMap2d(*target,*u1,*u2,*ustride,*uorder,*v1,*v2,*vstride,*vorder,points);
}; break;
case 5182: { // glMap2f
@@ -1522,7 +1501,7 @@ case 5182: { // glMap2f
GLfloat *v2 = (GLfloat *) bp; bp += 4;
GLint *vstride = (GLint *) bp; bp += 4;
GLint *vorder = (GLint *) bp; bp += 4;
- GLfloat *points = (GLfloat *) bins[0]->base;
+ GLfloat *points = (GLfloat *) bins[0];
weglMap2f(*target,*u1,*u2,*ustride,*uorder,*v1,*v2,*vstride,*vorder,points);
}; break;
case 5183: { // glMapGrid1d
@@ -1630,7 +1609,7 @@ case 5200: { // glNormalPointer
case 5201: { // glNormalPointer
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglNormalPointer(*type,*stride,pointer);
}; break;
case 5202: { // glOrtho
@@ -1649,19 +1628,19 @@ case 5203: { // glPassThrough
case 5204: { // glPixelMapfv
GLenum *map = (GLenum *) bp; bp += 4;
GLsizei *mapsize = (GLsizei *) bp; bp += 4;
- GLfloat *values = (GLfloat *) bins[0]->base;
+ GLfloat *values = (GLfloat *) bins[0];
weglPixelMapfv(*map,*mapsize,values);
}; break;
case 5205: { // glPixelMapuiv
GLenum *map = (GLenum *) bp; bp += 4;
GLsizei *mapsize = (GLsizei *) bp; bp += 4;
- GLuint *values = (GLuint *) bins[0]->base;
+ GLuint *values = (GLuint *) bins[0];
weglPixelMapuiv(*map,*mapsize,values);
}; break;
case 5206: { // glPixelMapusv
GLenum *map = (GLenum *) bp; bp += 4;
GLsizei *mapsize = (GLsizei *) bp; bp += 4;
- GLushort *values = (GLushort *) bins[0]->base;
+ GLushort *values = (GLushort *) bins[0];
weglPixelMapusv(*map,*mapsize,values);
}; break;
case 5207: { // glPixelStoref
@@ -1704,7 +1683,7 @@ case 5214: { // glPolygonOffset
weglPolygonOffset(*factor,*units);
}; break;
case 5215: { // glPolygonStipple
- GLubyte *mask = (GLubyte *) bins[0]->base;
+ GLubyte *mask = (GLubyte *) bins[0];
weglPolygonStipple(mask);
}; break;
case 5216: { // glPopAttrib
@@ -1800,13 +1779,13 @@ case 5238: { // glReadPixels
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglReadPixels(*x,*y,*width,*height,*format,*type,pixels);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5239: { // glRectd
GLdouble *x1 = (GLdouble *) bp; bp += 8;
@@ -1864,7 +1843,7 @@ case 5247: { // glRenderMode
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5248: { // glRotated
GLdouble *angle = (GLdouble *) bp; bp += 8;
@@ -1901,13 +1880,13 @@ case 5252: { // glScissor
}; break;
case 5253: { // glSelectBuffer
GLsizei *size = (GLsizei *) bp; bp += 4;
- GLuint *buffer = (GLuint *) bins[0]->base;
+ GLuint *buffer = (GLuint *) bins[0];
weglSelectBuffer(*size,buffer);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5254: { // glShadeModel
GLenum *mode = (GLenum *) bp; bp += 4;
@@ -2004,7 +1983,7 @@ case 5275: { // glTexCoordPointer
GLint *size = (GLint *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglTexCoordPointer(*size,*type,*stride,pointer);
}; break;
case 5276: { // glTexEnvf
@@ -2091,7 +2070,7 @@ case 5287: { // glTexImage1D
GLint *border = (GLint *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglTexImage1D(*target,*level,*internalformat,*width,*border,*format,*type,pixels);
}; break;
case 5288: { // glTexImage2D
@@ -2115,7 +2094,7 @@ case 5289: { // glTexImage2D
GLint *border = (GLint *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglTexImage2D(*target,*level,*internalformat,*width,*height,*border,*format,*type,pixels);
}; break;
case 5290: { // glTexParameterf
@@ -2161,7 +2140,7 @@ case 5295: { // glTexSubImage1D
GLsizei *width = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglTexSubImage1D(*target,*level,*xoffset,*width,*format,*type,pixels);
}; break;
case 5296: { // glTexSubImage2D
@@ -2185,7 +2164,7 @@ case 5297: { // glTexSubImage2D
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglTexSubImage2D(*target,*level,*xoffset,*yoffset,*width,*height,*format,*type,pixels);
}; break;
case 5298: { // glTranslated
@@ -2259,7 +2238,7 @@ case 5313: { // glVertexPointer
GLint *size = (GLint *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglVertexPointer(*size,*type,*stride,pointer);
}; break;
case 5314: { // glViewport
@@ -2295,7 +2274,7 @@ case 5318: { // glDrawRangeElements
GLuint *end = (GLuint *) bp; bp += 4;
GLsizei *count = (GLsizei *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *indices = (GLvoid *) bins[0]->base;
+ GLvoid *indices = (GLvoid *) bins[0];
weglDrawRangeElements(*mode,*start,*end,*count,*type,indices);
}; break;
case 5319: { // glTexImage3D
@@ -2321,7 +2300,7 @@ case 5320: { // glTexImage3D
GLint *border = (GLint *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglTexImage3D(*target,*level,*internalformat,*width,*height,*depth,*border,*format,*type,pixels);
}; break;
case 5321: { // glTexSubImage3D
@@ -2349,7 +2328,7 @@ case 5322: { // glTexSubImage3D
GLsizei *depth = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *pixels = (GLvoid *) bins[0]->base;
+ GLvoid *pixels = (GLvoid *) bins[0];
weglTexSubImage3D(*target,*level,*xoffset,*yoffset,*zoffset,*width,*height,*depth,*format,*type,pixels);
}; break;
case 5323: { // glCopyTexSubImage3D
@@ -2379,7 +2358,7 @@ case 5325: { // glColorTable
GLsizei *width = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *table = (GLvoid *) bins[0]->base;
+ GLvoid *table = (GLvoid *) bins[0];
weglColorTable(*target,*internalformat,*width,*format,*type,table);
}; break;
case 5326: { // glColorTableParameterfv
@@ -2406,13 +2385,13 @@ case 5329: { // glGetColorTable
GLenum *target = (GLenum *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *table = (GLvoid *) bins[0]->base;
+ GLvoid *table = (GLvoid *) bins[0];
weglGetColorTable(*target,*format,*type,table);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5330: { // glGetColorTableParameterfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2430,7 +2409,7 @@ case 5330: { // glGetColorTableParameterfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5331: { // glGetColorTableParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2447,7 +2426,7 @@ case 5331: { // glGetColorTableParameteriv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5332: { // glColorSubTable
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2464,7 +2443,7 @@ case 5333: { // glColorSubTable
GLsizei *count = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglColorSubTable(*target,*start,*count,*format,*type,data);
}; break;
case 5334: { // glCopyColorSubTable
@@ -2490,7 +2469,7 @@ case 5336: { // glConvolutionFilter1D
GLsizei *width = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *image = (GLvoid *) bins[0]->base;
+ GLvoid *image = (GLvoid *) bins[0];
weglConvolutionFilter1D(*target,*internalformat,*width,*format,*type,image);
}; break;
case 5337: { // glConvolutionFilter2D
@@ -2510,7 +2489,7 @@ case 5338: { // glConvolutionFilter2D
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *image = (GLvoid *) bins[0]->base;
+ GLvoid *image = (GLvoid *) bins[0];
weglConvolutionFilter2D(*target,*internalformat,*width,*height,*format,*type,image);
}; break;
case 5339: { // glConvolutionParameterfv
@@ -2548,13 +2527,13 @@ case 5343: { // glGetConvolutionFilter
GLenum *target = (GLenum *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *image = (GLvoid *) bins[0]->base;
+ GLvoid *image = (GLvoid *) bins[0];
weglGetConvolutionFilter(*target,*format,*type,image);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5344: { // glGetConvolutionParameterfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2572,7 +2551,7 @@ case 5344: { // glGetConvolutionParameterfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5345: { // glGetConvolutionParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2589,7 +2568,7 @@ case 5345: { // glGetConvolutionParameteriv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5346: { // glSeparableFilter2D
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2609,8 +2588,8 @@ case 5347: { // glSeparableFilter2D
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *row = (GLvoid *) bins[0]->base;
- GLvoid *column = (GLvoid *) bins[1]->base;
+ GLvoid *row = (GLvoid *) bins[0];
+ GLvoid *column = (GLvoid *) bins[1];
weglSeparableFilter2D(*target,*internalformat,*width,*height,*format,*type,row,column);
}; break;
case 5348: { // glGetHistogram
@@ -2619,13 +2598,13 @@ case 5348: { // glGetHistogram
bp += 3;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *values = (GLvoid *) bins[0]->base;
+ GLvoid *values = (GLvoid *) bins[0];
weglGetHistogram(*target,*reset,*format,*type,values);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5349: { // glGetHistogramParameterfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2640,7 +2619,7 @@ case 5349: { // glGetHistogramParameterfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5350: { // glGetHistogramParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2654,7 +2633,7 @@ case 5350: { // glGetHistogramParameteriv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5351: { // glGetMinmax
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2662,13 +2641,13 @@ case 5351: { // glGetMinmax
bp += 3;
GLenum *format = (GLenum *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *values = (GLvoid *) bins[0]->base;
+ GLvoid *values = (GLvoid *) bins[0];
weglGetMinmax(*target,*reset,*format,*type,values);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5352: { // glGetMinmaxParameterfv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2683,7 +2662,7 @@ case 5352: { // glGetMinmaxParameterfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5353: { // glGetMinmaxParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2697,7 +2676,7 @@ case 5353: { // glGetMinmaxParameteriv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 8 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,8);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5354: { // glHistogram
GLenum *target = (GLenum *) bp; bp += 4;
@@ -2750,7 +2729,7 @@ case 5361: { // glCompressedTexImage3D
GLsizei *depth = (GLsizei *) bp; bp += 4;
GLint *border = (GLint *) bp; bp += 4;
GLsizei *imageSize = (GLsizei *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglCompressedTexImage3D(*target,*level,*internalformat,*width,*height,*depth,*border,*imageSize,data);
}; break;
case 5362: { // glCompressedTexImage2D
@@ -2772,7 +2751,7 @@ case 5363: { // glCompressedTexImage2D
GLsizei *height = (GLsizei *) bp; bp += 4;
GLint *border = (GLint *) bp; bp += 4;
GLsizei *imageSize = (GLsizei *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglCompressedTexImage2D(*target,*level,*internalformat,*width,*height,*border,*imageSize,data);
}; break;
case 5364: { // glCompressedTexImage1D
@@ -2792,7 +2771,7 @@ case 5365: { // glCompressedTexImage1D
GLsizei *width = (GLsizei *) bp; bp += 4;
GLint *border = (GLint *) bp; bp += 4;
GLsizei *imageSize = (GLsizei *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglCompressedTexImage1D(*target,*level,*internalformat,*width,*border,*imageSize,data);
}; break;
case 5366: { // glCompressedTexSubImage3D
@@ -2820,7 +2799,7 @@ case 5367: { // glCompressedTexSubImage3D
GLsizei *depth = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLsizei *imageSize = (GLsizei *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglCompressedTexSubImage3D(*target,*level,*xoffset,*yoffset,*zoffset,*width,*height,*depth,*format,*imageSize,data);
}; break;
case 5368: { // glCompressedTexSubImage2D
@@ -2844,7 +2823,7 @@ case 5369: { // glCompressedTexSubImage2D
GLsizei *height = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLsizei *imageSize = (GLsizei *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglCompressedTexSubImage2D(*target,*level,*xoffset,*yoffset,*width,*height,*format,*imageSize,data);
}; break;
case 5370: { // glCompressedTexSubImage1D
@@ -2864,19 +2843,19 @@ case 5371: { // glCompressedTexSubImage1D
GLsizei *width = (GLsizei *) bp; bp += 4;
GLenum *format = (GLenum *) bp; bp += 4;
GLsizei *imageSize = (GLsizei *) bp; bp += 4;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglCompressedTexSubImage1D(*target,*level,*xoffset,*width,*format,*imageSize,data);
}; break;
case 5372: { // glGetCompressedTexImage
GLenum *target = (GLenum *) bp; bp += 4;
GLint *level = (GLint *) bp; bp += 4;
- GLvoid *img = (GLvoid *) bins[0]->base;
+ GLvoid *img = (GLvoid *) bins[0];
weglGetCompressedTexImage(*target,*level,img);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5373: { // glClientActiveTexture
GLenum *texture = (GLenum *) bp; bp += 4;
@@ -3036,7 +3015,7 @@ case 5402: { // glFogCoordPointer
case 5403: { // glFogCoordPointer
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglFogCoordPointer(*type,*stride,pointer);
}; break;
case 5404: { // glSecondaryColor3bv
@@ -3082,7 +3061,7 @@ case 5413: { // glSecondaryColorPointer
GLint *size = (GLint *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglSecondaryColorPointer(*size,*type,*stride,pointer);
}; break;
case 5414: { // glWindowPos2dv
@@ -3130,7 +3109,7 @@ case 5422: { // glGenQueries
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(ids);
}; break;
@@ -3147,7 +3126,7 @@ case 5424: { // glIsQuery
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5425: { // glBeginQuery
GLenum *target = (GLenum *) bp; bp += 4;
@@ -3168,7 +3147,7 @@ case 5427: { // glGetQueryiv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5428: { // glGetQueryObjectiv
GLuint *id = (GLuint *) bp; bp += 4;
@@ -3180,7 +3159,7 @@ case 5428: { // glGetQueryObjectiv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5429: { // glGetQueryObjectuiv
GLuint *id = (GLuint *) bp; bp += 4;
@@ -3192,7 +3171,7 @@ case 5429: { // glGetQueryObjectuiv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5430: { // glBindBuffer
GLenum *target = (GLenum *) bp; bp += 4;
@@ -3217,7 +3196,7 @@ case 5432: { // glGenBuffers
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(buffers);
}; break;
@@ -3229,7 +3208,7 @@ case 5433: { // glIsBuffer
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5434: { // glBufferData
GLenum *target = (GLenum *) bp; bp += 4;
@@ -3243,7 +3222,7 @@ case 5435: { // glBufferData
GLenum *target = (GLenum *) bp; bp += 4;
bp += 4;
GLsizeiptr size = (GLsizeiptr) * (GLuint64EXT *) bp; bp += 8;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
GLenum *usage = (GLenum *) bp; bp += 4;
weglBufferData(*target,size,data,*usage);
}; break;
@@ -3260,7 +3239,7 @@ case 5437: { // glBufferSubData
bp += 4;
GLintptr offset = (GLintptr) * (GLuint64EXT *) bp; bp += 8;
GLsizeiptr size = (GLsizeiptr) * (GLuint64EXT *) bp; bp += 8;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglBufferSubData(*target,offset,size,data);
}; break;
case 5438: { // glGetBufferSubData
@@ -3268,13 +3247,13 @@ case 5438: { // glGetBufferSubData
bp += 4;
GLintptr offset = (GLintptr) * (GLuint64EXT *) bp; bp += 8;
GLsizeiptr size = (GLsizeiptr) * (GLuint64EXT *) bp; bp += 8;
- GLvoid *data = (GLvoid *) bins[0]->base;
+ GLvoid *data = (GLvoid *) bins[0];
weglGetBufferSubData(*target,offset,size,data);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5439: { // glGetBufferParameteriv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -3286,7 +3265,7 @@ case 5439: { // glGetBufferParameteriv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5440: { // glBlendEquationSeparate
GLenum *modeRGB = (GLenum *) bp; bp += 4;
@@ -3340,7 +3319,7 @@ case 5448: { // glCreateProgram
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5449: { // glCreateShader
GLenum *type = (GLenum *) bp; bp += 4;
@@ -3350,7 +3329,7 @@ case 5449: { // glCreateShader
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5450: { // glDeleteProgram
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3391,7 +3370,7 @@ case 5455: { // glGetActiveAttrib
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 13 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,13);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(name);
}; break;
case 5456: { // glGetActiveUniform
@@ -3412,7 +3391,7 @@ case 5456: { // glGetActiveUniform
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 13 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,13);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(name);
}; break;
case 5457: { // glGetAttachedShaders
@@ -3430,7 +3409,7 @@ case 5457: { // glGetAttachedShaders
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*count)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*count)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*count)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(obj);
}; break;
@@ -3444,7 +3423,7 @@ case 5458: { // glGetAttribLocation
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5459: { // glGetProgramiv
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3456,7 +3435,7 @@ case 5459: { // glGetProgramiv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5460: { // glGetProgramInfoLog
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3470,7 +3449,7 @@ case 5460: { // glGetProgramInfoLog
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) infoLog; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(infoLog);
}; break;
case 5461: { // glGetShaderiv
@@ -3483,7 +3462,7 @@ case 5461: { // glGetShaderiv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5462: { // glGetShaderInfoLog
GLuint *shader = (GLuint *) bp; bp += 4;
@@ -3497,7 +3476,7 @@ case 5462: { // glGetShaderInfoLog
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) infoLog; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(infoLog);
}; break;
case 5463: { // glGetShaderSource
@@ -3512,7 +3491,7 @@ case 5463: { // glGetShaderSource
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) source; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(source);
}; break;
case 5464: { // glGetUniformLocation
@@ -3525,7 +3504,7 @@ case 5464: { // glGetUniformLocation
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5465: { // glGetUniformfv
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3555,7 +3534,7 @@ case 5465: { // glGetUniformfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 16;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 38 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,38);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5466: { // glGetUniformiv
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3584,7 +3563,7 @@ case 5466: { // glGetUniformiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 16;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 38 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,38);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5467: { // glGetVertexAttribdv
GLuint *index = (GLuint *) bp; bp += 4;
@@ -3601,7 +3580,7 @@ case 5467: { // glGetVertexAttribdv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5468: { // glGetVertexAttribfv
GLuint *index = (GLuint *) bp; bp += 4;
@@ -3619,7 +3598,7 @@ case 5468: { // glGetVertexAttribfv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5469: { // glGetVertexAttribiv
GLuint *index = (GLuint *) bp; bp += 4;
@@ -3636,7 +3615,7 @@ case 5469: { // glGetVertexAttribiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5470: { // glIsProgram
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3646,7 +3625,7 @@ case 5470: { // glIsProgram
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5471: { // glIsShader
GLuint *shader = (GLuint *) bp; bp += 4;
@@ -3656,7 +3635,7 @@ case 5471: { // glIsShader
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5472: { // glLinkProgram
GLuint *program = (GLuint *) bp; bp += 4;
@@ -3942,7 +3921,7 @@ case 5519: { // glVertexAttribPointer
GLboolean *normalized = (GLboolean *) bp; bp += 1;
bp += 3;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglVertexAttribPointer(*index,*size,*type,*normalized,*stride,pointer);
}; break;
case 5520: { // glUniformMatrix2x3fv
@@ -4028,7 +4007,7 @@ case 5527: { // glGetBooleani_v
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = 16+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 39 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,39);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5528: { // glGetIntegeri_v
GLenum *target = (GLenum *) bp; bp += 4;
@@ -4057,7 +4036,7 @@ case 5528: { // glGetIntegeri_v
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = 16+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 39 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,39);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5529: { // glEnablei
GLenum *target = (GLenum *) bp; bp += 4;
@@ -4078,7 +4057,7 @@ case 5531: { // glIsEnabledi
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5532: { // glBeginTransformFeedback
GLenum *primitiveMode = (GLenum *) bp; bp += 4;
@@ -4133,7 +4112,7 @@ case 5537: { // glGetTransformFeedbackVarying
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 13 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,13);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(name);
}; break;
case 5538: { // glClampColor
@@ -4162,7 +4141,7 @@ case 5542: { // glVertexAttribIPointer
GLint *size = (GLint *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
GLsizei *stride = (GLsizei *) bp; bp += 4;
- GLvoid *pointer = (GLvoid *) bins[0]->base;
+ GLvoid *pointer = (GLvoid *) bins[0];
weglVertexAttribIPointer(*index,*size,*type,*stride,pointer);
}; break;
case 5543: { // glGetVertexAttribIiv
@@ -4180,7 +4159,7 @@ case 5543: { // glGetVertexAttribIiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5544: { // glGetVertexAttribIuiv
GLuint *index = (GLuint *) bp; bp += 4;
@@ -4197,7 +4176,7 @@ case 5544: { // glGetVertexAttribIuiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5545: { // glGetUniformuiv
GLuint *program = (GLuint *) bp; bp += 4;
@@ -4226,7 +4205,7 @@ case 5545: { // glGetUniformuiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 16;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 38 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,38);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5546: { // glBindFragDataLocation
GLuint *program = (GLuint *) bp; bp += 4;
@@ -4245,7 +4224,7 @@ case 5547: { // glGetFragDataLocation
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5548: { // glUniform1ui
GLint *location = (GLint *) bp; bp += 4;
@@ -4326,7 +4305,7 @@ case 5558: { // glGetTexParameterIiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5559: { // glGetTexParameterIuiv
GLenum *target = (GLenum *) bp; bp += 4;
@@ -4343,7 +4322,7 @@ case 5559: { // glGetTexParameterIuiv
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5560: { // glClearBufferiv
GLenum *buffer = (GLenum *) bp; bp += 4;
@@ -4382,7 +4361,7 @@ case 5564: { // glGetStringi
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) result; rt[AP++] = strlen((char *) result);
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5565: { // glVertexAttribI1iv
GLuint *index = (GLuint *) bp; bp += 4;
@@ -4463,7 +4442,7 @@ case 5579: { // glDrawElementsInstanced
GLenum *mode = (GLenum *) bp; bp += 4;
GLsizei *count = (GLsizei *) bp; bp += 4;
GLenum *type = (GLenum *) bp; bp += 4;
- GLvoid *indices = (GLvoid *) bins[0]->base;
+ GLvoid *indices = (GLvoid *) bins[0];
GLsizei *primcount = (GLsizei *) bp; bp += 4;
weglDrawElementsInstanced(*mode,*count,*type,indices,*primcount);
}; break;
@@ -4586,7 +4565,7 @@ case 5602: { // glGenProgramsARB
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(programs);
}; break;
@@ -4665,7 +4644,7 @@ case 5611: { // glGetProgramEnvParameterdvARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5612: { // glGetProgramEnvParameterfvARB
GLenum *target = (GLenum *) bp; bp += 4;
@@ -4683,7 +4662,7 @@ case 5612: { // glGetProgramEnvParameterfvARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5613: { // glGetProgramLocalParameterdvARB
GLenum *target = (GLenum *) bp; bp += 4;
@@ -4700,7 +4679,7 @@ case 5613: { // glGetProgramLocalParameterdvARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5614: { // glGetProgramLocalParameterfvARB
GLenum *target = (GLenum *) bp; bp += 4;
@@ -4718,18 +4697,18 @@ case 5614: { // glGetProgramLocalParameterfvARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 4;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 14 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,14);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5615: { // glGetProgramStringARB
GLenum *target = (GLenum *) bp; bp += 4;
GLenum *pname = (GLenum *) bp; bp += 4;
- GLvoid *string = (GLvoid *) bins[0]->base;
+ GLvoid *string = (GLvoid *) bins[0];
weglGetProgramStringARB(*target,*pname,string);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5616: { // glDeleteObjectARB
GLhandleARB obj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4743,7 +4722,7 @@ case 5617: { // glGetHandleARB
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5618: { // glDetachObjectARB
GLhandleARB containerObj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4758,7 +4737,7 @@ case 5619: { // glCreateShaderObjectARB
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5620: { // glShaderSourceARB
GLhandleARB shaderObj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4783,7 +4762,7 @@ case 5622: { // glCreateProgramObjectARB
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5623: { // glAttachObjectARB
GLhandleARB containerObj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4813,7 +4792,7 @@ case 5627: { // glGetObjectParameterfvARB
rt[AP++] = ERL_DRV_FLOAT; rt[AP++] = (ErlDrvTermData) &paramsConv;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5628: { // glGetObjectParameterivARB
GLhandleARB obj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4825,7 +4804,7 @@ case 5628: { // glGetObjectParameterivARB
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5629: { // glGetInfoLogARB
GLhandleARB obj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4839,7 +4818,7 @@ case 5629: { // glGetInfoLogARB
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) infoLog; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(infoLog);
}; break;
case 5630: { // glGetAttachedObjectsARB
@@ -4857,7 +4836,7 @@ case 5630: { // glGetAttachedObjectsARB
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*count)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*count)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*count)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(obj);
}; break;
@@ -4871,7 +4850,7 @@ case 5631: { // glGetUniformLocationARB
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5632: { // glGetActiveUniformARB
GLhandleARB programObj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4891,7 +4870,7 @@ case 5632: { // glGetActiveUniformARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 13 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,13);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(name);
}; break;
case 5633: { // glGetUniformfvARB
@@ -4922,7 +4901,7 @@ case 5633: { // glGetUniformfvARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 16;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 38 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,38);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5634: { // glGetUniformivARB
GLhandleARB programObj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4951,7 +4930,7 @@ case 5634: { // glGetUniformivARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 16;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 38 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,38);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5635: { // glGetShaderSourceARB
GLhandleARB obj = (GLhandleARB) * (GLuint64EXT *) bp; bp += 8;
@@ -4965,7 +4944,7 @@ case 5635: { // glGetShaderSourceARB
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) source; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(source);
}; break;
case 5636: { // glBindAttribLocationARB
@@ -4993,7 +4972,7 @@ case 5637: { // glGetActiveAttribARB
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 13 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,13);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(name);
}; break;
case 5638: { // glGetAttribLocationARB
@@ -5006,7 +4985,7 @@ case 5638: { // glGetAttribLocationARB
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5639: { // glIsRenderbuffer
GLuint *renderbuffer = (GLuint *) bp; bp += 4;
@@ -5016,7 +4995,7 @@ case 5639: { // glIsRenderbuffer
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5640: { // glBindRenderbuffer
GLenum *target = (GLenum *) bp; bp += 4;
@@ -5041,7 +5020,7 @@ case 5642: { // glGenRenderbuffers
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(renderbuffers);
}; break;
@@ -5062,7 +5041,7 @@ case 5644: { // glGetRenderbufferParameteriv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5645: { // glIsFramebuffer
GLuint *framebuffer = (GLuint *) bp; bp += 4;
@@ -5072,7 +5051,7 @@ case 5645: { // glIsFramebuffer
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5646: { // glBindFramebuffer
GLenum *target = (GLenum *) bp; bp += 4;
@@ -5097,7 +5076,7 @@ case 5648: { // glGenFramebuffers
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(framebuffers);
}; break;
@@ -5109,7 +5088,7 @@ case 5649: { // glCheckFramebufferStatus
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5650: { // glFramebufferTexture1D
GLenum *target = (GLenum *) bp; bp += 4;
@@ -5154,7 +5133,7 @@ case 5654: { // glGetFramebufferAttachmentParameteriv
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) *params;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5655: { // glGenerateMipmap
GLenum *target = (GLenum *) bp; bp += 4;
@@ -5244,7 +5223,7 @@ case 5666: { // glGenVertexArrays
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*n)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*n)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*n)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(arrays);
}; break;
@@ -5256,7 +5235,7 @@ case 5667: { // glIsVertexArray
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5668: { // glGetUniformIndices
GLuint *program = (GLuint *) bp; bp += 4;
@@ -5278,7 +5257,7 @@ case 5668: { // glGetUniformIndices
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*uniformNamesLen)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*uniformNamesLen)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*uniformNamesLen)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(uniformIndices);
driver_free(uniformNames);
@@ -5299,7 +5278,7 @@ case 5669: { // glGetActiveUniformsiv
rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = (*uniformIndicesLen)+1;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 + (*uniformIndicesLen)*2 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7 + (*uniformIndicesLen)*2);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(rt);
driver_free(params);
}; break;
@@ -5316,7 +5295,7 @@ case 5670: { // glGetActiveUniformName
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) uniformName; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(uniformName);
}; break;
case 5671: { // glGetUniformBlockIndex
@@ -5329,19 +5308,19 @@ case 5671: { // glGetUniformBlockIndex
rt[AP++] = ERL_DRV_INT; rt[AP++] = (ErlDrvSInt) result;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 6 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,6);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5672: { // glGetActiveUniformBlockiv
GLuint *program = (GLuint *) bp; bp += 4;
GLuint *uniformBlockIndex = (GLuint *) bp; bp += 4;
GLenum *pname = (GLenum *) bp; bp += 4;
- GLint *params = (GLint *) bins[0]->base;
+ GLint *params = (GLint *) bins[0];
weglGetActiveUniformBlockiv(*program,*uniformBlockIndex,*pname,params);
int AP = 0; ErlDrvTermData rt[6];
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "ok");
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
}; break;
case 5673: { // glGetActiveUniformBlockName
GLuint *program = (GLuint *) bp; bp += 4;
@@ -5356,7 +5335,7 @@ case 5673: { // glGetActiveUniformBlockName
rt[AP++] = ERL_DRV_STRING; rt[AP++] = (ErlDrvTermData) uniformBlockName; rt[AP++] = *length;
rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2;
if (AP != 7 ) fprintf(stderr, "%d: ERROR AP mismatch %d %d\r\n",__LINE__,AP,7);
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
+ driver_send_term(port,caller,rt,AP);
driver_free(uniformBlockName);
}; break;
case 5674: { // glUniformBlockBinding
diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp
index 8c056bbb91..479d7679a4 100644
--- a/lib/wx/c_src/gen/wxe_funcs.cpp
+++ b/lib/wx/c_src/gen/wxe_funcs.cpp
@@ -23,6 +23,7 @@
#include "../wxe_impl.h"
#include "../wxe_events.h"
#include "../wxe_return.h"
+#include "../wxe_gl.h"
#include "wxe_macros.h"
#include "wxe_derived_dest.h"
@@ -43,6 +44,15 @@ void WxeApp::wxe_dispatch(wxeCommand& Ecmd)
rt.addAtom("ok");
break;
}
+ case WXE_BIN_INCR:
+ driver_binary_inc_refc(Ecmd.bin[0]->bin);
+ break;
+ case WXE_BIN_DECR:
+ driver_binary_dec_refc(Ecmd.bin[0]->bin);
+ break;
+ case WXE_INIT_OPENGL:
+ wxe_initOpenGL(rt, bp);
+ break;
case 98: { // wxeEvtListener::wxeEvtListener
wxeEvtListener *Result = new wxeEvtListener(Ecmd.port);
rt.addRef(getRef((void *)Result,memenv), "wxeEvtListener");
diff --git a/lib/wx/c_src/wxe_driver.h b/lib/wx/c_src/wxe_driver.h
index 13a17e356f..5c5b8614ed 100644
--- a/lib/wx/c_src/wxe_driver.h
+++ b/lib/wx/c_src/wxe_driver.h
@@ -83,8 +83,9 @@ extern char * erl_wx_privdir;
#define WXE_CB_START 8
#define WXE_DEBUG_DRIVER 9
#define WXE_DEBUG_PING 10
-#define WXE_BIN_INCR 5001
-#define WXE_BIN_DECR 5002
+#define WXE_BIN_INCR 11
+#define WXE_BIN_DECR 12
+#define WXE_INIT_OPENGL 13
#define OPENGL_START 5000
diff --git a/lib/wx/c_src/wxe_gl.cpp b/lib/wx/c_src/wxe_gl.cpp
index 63dd68fa5e..eb4462047f 100644
--- a/lib/wx/c_src/wxe_gl.cpp
+++ b/lib/wx/c_src/wxe_gl.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2009. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2010. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -19,303 +19,104 @@
#include <stdio.h>
#include <string.h>
+#include <dlfcn.h>
#include "wxe_impl.h"
-
-#include "wxe_gl.h"
+#include "wxe_return.h"
#define WX_DEF_EXTS
-#include "gen/gl_fdefs.h"
-#include "gen/gl_finit.h"
-#include "gen/glu_finit.h"
/* ****************************************************************************
* Opengl context management *
* ****************************************************************************/
-int gl_initiated = FALSE;
+int erl_gl_initiated = FALSE;
ErlDrvTermData gl_active = 0;
wxeGLC glc;
-void setActiveGL(ErlDrvTermData caller, wxGLCanvas *canvas)
-{
- if(gl_initiated == FALSE) {
- initOpenGL();
- init_tess();
- gl_initiated = TRUE;
- }
- gl_active = caller;
- glc[caller] = canvas;
-}
-
-void deleteActiveGL(wxGLCanvas *canvas)
-{
- gl_active = 0;
- wxeGLC::iterator it;
- for(it = glc.begin(); it != glc.end(); ++it) {
- if(it->second == canvas) {
- it->second = (wxGLCanvas *) 0;
- }
- }
-}
-
-/* ****************************************************************************
- * OPENGL INITIALIZATION
- *****************************************************************************/
+typedef void (*WXE_GL_DISPATCH) (int, char *, ErlDrvPort, ErlDrvTermData, char **);
+WXE_GL_DISPATCH wxe_gl_dispatch;
#ifdef _WIN32
void * dlsym(HMODULE Lib, const char *func) {
- void * funcp;
- if((funcp = (void *) GetProcAddress(Lib, func)))
- return funcp;
- else
- return (void *) wglGetProcAddress(func);
+ funcp = (void *) GetProcAddress(Lib, func);
+ return funcp;
}
#endif
-int initOpenGL()
-{
-#ifdef _MACOSX
- char * DLName = "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib";
- void * LIBhandle = dlopen(DLName, RTLD_LAZY);
-#elif defined(_WIN32)
- WCHAR * DLName = wxT("opengl32.dll");
- HMODULE LIBhandle = LoadLibrary(DLName);
-#else
- char * DLName = (char *) "libGL.so";
- void * LIBhandle = dlopen(DLName, RTLD_LAZY);
-#endif
- // fprintf(stderr, "Loading GL: %s\r\n", (const char*)DLName);
- void * func = NULL;
- int i;
-
- if(LIBhandle) {
- for(i=0; gl_fns[i].name != NULL; i++) {
- if((func = dlsym(LIBhandle, gl_fns[i].name))) {
- * (void **) (gl_fns[i].func) = func;
- // fprintf(stderr, "GL LOADED %s \r\n", gl_fns[i].name);
- } else {
- if(gl_fns[i].alt != NULL) {
- if((func = dlsym(LIBhandle, gl_fns[i].alt))) {
- * (void **) (gl_fns[i].func) = func;
- // fprintf(stderr, "GL LOADED %s \r\n", gl_fns[i].alt);
- } else {
- * (void **) (gl_fns[i].func) = (void *) &gl_error;
- // fprintf(stderr, "GL Skipped %s and %s \r\n", gl_fns[i].name, gl_fns[i].alt);
- };
+void wxe_initOpenGL(wxeReturn rt, char *bp) {
+ void * LIBhandle;
+ int (*init_opengl) ();
+
+ if(erl_gl_initiated == FALSE) {
+ if((LIBhandle = dlopen(bp, RTLD_LAZY))) {
+ *(void **) (&init_opengl) = dlsym(LIBhandle, "egl_init_opengl");
+ wxe_gl_dispatch = (WXE_GL_DISPATCH) dlsym(LIBhandle, "egl_dispatch");
+ if(init_opengl && wxe_gl_dispatch) {
+ (*init_opengl)();
+ rt.addAtom((char *) "ok");
+ rt.add(wxString::FromAscii("initiated"));
+ rt.addTupleCount(2);
+ erl_gl_initiated = TRUE;
} else {
- * (void **) (gl_fns[i].func) = (void *) &gl_error;
- // fprintf(stderr, "GL Skipped %s \r\n", gl_fns[i].name);
+ wxString msg;
+ msg.Printf(wxT("In library: "));
+ msg += wxString::FromAscii(bp);
+ msg += wxT(" functions: ");
+ if(!init_opengl)
+ msg += wxT("egl_init_opengl ");
+ if(!wxe_gl_dispatch)
+ msg += wxT("egl_dispatch ");
+ rt.addAtom((char *) "error");
+ rt.add(msg);
+ rt.addTupleCount(2);
}
- }
}
-#ifdef _WIN32
- FreeLibrary(LIBhandle);
-#else
- dlclose(LIBhandle);
-#endif
- // fprintf(stderr, "OPENGL library is loaded\r\n");
} else {
- wxString msg;
- msg.Printf(wxT("Could NOT load OpenGL library: "));
-#ifdef _WIN32
- msg += DLName;
-#else
- msg += wxString::FromAscii((char *)DLName);
-#endif
- send_msg("error", &msg);
- };
-
-#ifdef _MACOSX
- DLName = "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib";
- LIBhandle = dlopen(DLName, RTLD_LAZY);
-#elif defined(_WIN32)
- DLName = wxT("glu32.dll");
- LIBhandle = LoadLibrary(DLName);
-#else
- DLName = (char *) "libGLU.so";
- LIBhandle = dlopen(DLName, RTLD_LAZY);
-#endif
- // fprintf(stderr, "Loading GL: %s\r\n", (const char*)DLName);
- func = NULL;
-
- if(LIBhandle) {
- for(i=0; glu_fns[i].name != NULL; i++) {
- if((func = dlsym(LIBhandle, glu_fns[i].name))) {
- * (void **) (glu_fns[i].func) = func;
- } else {
- if(glu_fns[i].alt != NULL) {
- if((func = dlsym(LIBhandle, glu_fns[i].alt))) {
- * (void **) (glu_fns[i].func) = func;
- } else {
- * (void **) (glu_fns[i].func) = (void *) &gl_error;
- // fprintf(stderr, "GLU Skipped %s\r\n", glu_fns[i].alt);
- };
- } else {
- * (void **) (glu_fns[i].func) = (void *) &gl_error;
- // fprintf(stderr, "GLU Skipped %s\r\n", glu_fns[i].name);
- }
- }
- }
-#ifdef _WIN32
- FreeLibrary(LIBhandle);
-#else
- dlclose(LIBhandle);
-#endif
- // fprintf(stderr, "GLU library is loaded\r\n");
- } else {
- wxString msg;
- msg.Printf(wxT("Could NOT load OpenGL GLU library: "));
-#ifdef _WIN32
- msg += DLName;
-#else
- msg += wxString::FromAscii((char *)DLName);
-#endif
- send_msg("error", &msg);
- };
- return 0;
-}
-
-void gl_error() {
- int AP = 0; ErlDrvTermData rt[8];
- rt[AP++] = ERL_DRV_ATOM; rt[AP++] = driver_mk_atom((char *)"_wxe_error_");
- rt[AP++] = ERL_DRV_INT; rt[AP++] = (int) gl_error_op;
- rt[AP++] = ERL_DRV_ATOM; rt[AP++] = driver_mk_atom((char *)"undef");
- rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 3;
- driver_send_term(WXE_DRV_PORT,gl_active,rt,AP);
-}
-
-/* *******************************************************************************
- * GLU Tesselation special
- * ******************************************************************************/
-
-static GLUtesselator* tess;
-static GLdouble* tess_coords;
-static GLdouble* tess_alloc_vertex;
-static int* tess_vertices;
-
-void CALLBACK
-wxe_ogla_vertex(GLdouble* coords)
-{
- /* fprintf(stderr, "%d\r\n", (int) (coords - tess_coords) / 3); */
-
- *tess_vertices++ = (int) (coords - tess_coords) / 3;
-}
-
-void CALLBACK
-wxe_ogla_edge_flag(GLboolean flag)
-{
+ rt.addAtom((char *) "ok");
+ rt.add(wxString::FromAscii("already initilized"));
+ rt.addTupleCount(2);
+ }
+ rt.send();
}
-void CALLBACK
-wxe_ogla_error(GLenum errorCode)
+void setActiveGL(ErlDrvTermData caller, wxGLCanvas *canvas)
{
- const GLubyte *err;
- err = gluErrorString(errorCode);
- wxString msg;
- msg.Printf(wxT("Tesselation error: %d: "), (int)errorCode);
- msg += wxString::FromAscii((char *) err);
- send_msg("error", &msg);
+ gl_active = caller;
+ glc[caller] = canvas;
}
-void CALLBACK
-wxe_ogla_combine(GLdouble coords[3],
- void* vertex_data[4],
- GLfloat w[4],
- void **dataOut)
+void deleteActiveGL(wxGLCanvas *canvas)
{
- GLdouble* vertex = tess_alloc_vertex;
-
- tess_alloc_vertex += 3;
-
-#if 0
- fprintf(stderr, "combine: ");
- int i;
- for (i = 0; i < 4; i++) {
- if (w[i] > 0.0) {
- fprintf(stderr, "%d(%g) ", (int) vertex_data[i], w[i]);
+ gl_active = 0;
+ wxeGLC::iterator it;
+ for(it = glc.begin(); it != glc.end(); ++it) {
+ if(it->second == canvas) {
+ it->second = (wxGLCanvas *) 0;
}
}
- fprintf(stderr, "\r\n");
- fprintf(stderr, "%g %g %g\r\n", vertex[0], vertex[1], vertex[2]);
-#endif
-
- vertex[0] = coords[0];
- vertex[1] = coords[1];
- vertex[2] = coords[2];
- *dataOut = vertex;
-}
-
-void init_tess()
-{
- tess = gluNewTess();
-
- gluTessCallback(tess, GLU_TESS_VERTEX, (GLUfuncptr) wxe_ogla_vertex);
- gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (GLUfuncptr) wxe_ogla_edge_flag);
- gluTessCallback(tess, GLU_TESS_COMBINE, (GLUfuncptr) wxe_ogla_combine);
- gluTessCallback(tess, GLU_TESS_ERROR, (GLUfuncptr) wxe_ogla_error);
-
-}
-
-void exit_tess()
-{
- gluDeleteTess(tess);
}
-int wxe_tess_impl(char* buff, ErlDrvTermData caller)
-{
- ErlDrvBinary* bin;
- int i;
- int num_vertices = * (int *) buff; buff += 8; // Align
- GLdouble *n = (double *) buff; buff += 8*3;
-
- GLdouble* new_vertices;
- bin = driver_alloc_binary(num_vertices*6*sizeof(GLdouble));
- new_vertices = tess_coords = (double *) bin->orig_bytes;
- memcpy(tess_coords,buff,num_vertices*3*sizeof(GLdouble));
- tess_alloc_vertex = tess_coords + num_vertices*3;
-
-#if 0
- fprintf(stderr, "n=%d\r\n", num_vertices);
-#endif
- int *vertices;
- vertices = (int *) driver_alloc(sizeof(int) * 16*num_vertices);
-
- tess_vertices = vertices;
-
- gluTessNormal(tess, n[0], n[1], n[2]);
- gluTessBeginPolygon(tess, 0);
- gluTessBeginContour(tess);
- for (i = 0; i < num_vertices; i++) {
- gluTessVertex(tess, tess_coords+3*i, tess_coords+3*i);
- }
- gluTessEndContour(tess);
- gluTessEndPolygon(tess);
-
- int n_pos = (tess_vertices - vertices);
-
- int AP = 0; ErlDrvTermData *rt;
- rt = (ErlDrvTermData *) driver_alloc(sizeof(ErlDrvTermData) * (13+n_pos*2));
- rt[AP++]=ERL_DRV_ATOM; rt[AP++]=driver_mk_atom((char *) "_wxe_result_");
-
- for(i=0; i < n_pos; i++) {
- rt[AP++] = ERL_DRV_INT; rt[AP++] = (int) vertices[i];
+void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
+ if(caller != gl_active) {
+ wxGLCanvas * current = glc[caller];
+ if(current) { gl_active = caller; current->SetCurrent();}
+ else {
+ ErlDrvTermData rt[] = // Error msg
+ {ERL_DRV_ATOM, driver_mk_atom((char *) "_wxe_error_"),
+ ERL_DRV_INT, op,
+ ERL_DRV_ATOM, driver_mk_atom((char *) "no_gl_context"),
+ ERL_DRV_TUPLE,3};
+ driver_send_term(WXE_DRV_PORT,caller,rt,8);
+ return ;
+ }
};
- rt[AP++] = ERL_DRV_NIL; rt[AP++] = ERL_DRV_LIST; rt[AP++] = n_pos+1;
-
- rt[AP++] = ERL_DRV_BINARY; rt[AP++] = (ErlDrvTermData) bin;
- rt[AP++] = (tess_alloc_vertex-new_vertices)*sizeof(GLdouble); rt[AP++] = 0;
-
- rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2; // Return tuple {list, Bin}
- rt[AP++] = ERL_DRV_TUPLE; rt[AP++] = 2; // Result tuple
-
- driver_send_term(WXE_DRV_PORT,caller,rt,AP);
-// fprintf(stderr, "List %d %d %d \r\n",
-// n_pos,
-// (tess_alloc_vertex-new_vertices)*sizeof(GLdouble),
-// num_vertices*6*sizeof(GLdouble));
- driver_free_binary(bin);
- driver_free(vertices);
- driver_free(rt);
- return 0;
+ char * bs[3];
+ for(int i=0; i<3; i++) {
+ if(bins[i])
+ bs[i] = bins[i]->base;
+ else
+ bs[i] = NULL;
+ }
+ wxe_gl_dispatch(op, bp, WXE_DRV_PORT, caller, bs);
}
diff --git a/lib/wx/c_src/wxe_gl.h b/lib/wx/c_src/wxe_gl.h
index 3a47b3c1bd..1b556ff4ec 100644
--- a/lib/wx/c_src/wxe_gl.h
+++ b/lib/wx/c_src/wxe_gl.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2009. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2010. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -17,119 +17,6 @@
* %CopyrightEnd%
*/
+#include "egl_impl.h"
-#ifndef _WIN32
-# include <dlfcn.h>
-#endif
-
-#ifndef __WXMAC__
-# include <GL/gl.h>
-# include <GL/glu.h> /* Header File For The OpenGL Library */
-#else
-# include <OpenGL/glu.h> /* Header File For The OpenGL Library */
-#endif
-
-#ifndef CALLBACK
-# define CALLBACK
-#endif
-
-#ifdef _WIN32
-# ifndef _GLUfuncptr
-// Visual studio CPP ++ compiler
-# define _GLUfuncptr void (_stdcall *)()
-# endif
-#endif
-
-#ifdef _GLUfuncptr
-# define GLUfuncptr _GLUfuncptr
-#elif defined(TESS_CB_TIGER_STYLE)
-# define GLUfuncptr GLvoid (*)(...)
-#else
-# define GLUfuncptr GLvoid (*)()
-#endif
-
-#ifdef WIN32
-#include <windows.h>
-#include <gl/gl.h>
-#elif defined(HAVE_GL_GL_H)
-#include <GL/gl.h>
-#elif defined(HAVE_OPENGL_GL_H)
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-
-int initOpenGL();
-void gl_error();
-extern int gl_error_op;
-extern ErlDrvTermData gl_active;
-
-/* Some new GL types (eliminates the need for glext.h) */
-
-#ifndef HAVE_GLINTPTR
-#ifndef HAVE_GLINTPTRARB
-# include <stddef.h>
-/* GL types for handling large vertex buffer objects */
-typedef ptrdiff_t GLintptrARB;
-typedef ptrdiff_t GLsizeiptrARB;
-#endif /* HAVE_GLINTPTRARB */
-typedef GLintptrARB GLintptr;
-typedef GLsizeiptrARB GLsizeiptr;
-#endif /* HAVE_GLINTPTR */
-
-#ifndef HAVE_GLCHAR
-# ifndef HAVE_GLCHARARB
-/* GL types for handling shader object handles and characters */
-typedef char GLcharARB; /* native character */
-typedef unsigned int GLhandleARB; /* shader object handle */
-#endif /* HAVE_GLCHARARB */
-typedef GLcharARB GLchar;
-#endif
-
-#ifndef HAVE_GLHALFARB
-/* GL types for "half" precision (s10e5) float data in host memory */
-typedef unsigned short GLhalfARB;
-#endif
-
-/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
-/* (as used in the GLX_OML_sync_control extension). */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#include <inttypes.h>
-#elif defined(__sun__)
-#include <inttypes.h>
-#if defined(__STDC__)
-#if defined(__arch64__)
-typedef long int int64_t;
-typedef unsigned long int uint64_t;
-#else
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#endif /* __arch64__ */
-#endif /* __STDC__ */
-#elif defined( __VMS )
-#include <inttypes.h>
-#elif defined(__SCO__) || defined(__USLC__)
-#include <stdint.h>
-#elif defined(__UNIXOS2__) || defined(__SOL64__)
-typedef long int int32_t;
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#elif defined(WIN32) && defined(_MSC_VER)
-typedef long int int32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#elif defined(WIN32) && defined(__GNUC__)
-#include <stdint.h>
-#else
-#include <inttypes.h> /* Fallback option */
-#endif
-
-#ifndef HAVE_GLINT64EXT
-typedef int64_t GLint64EXT;
-typedef uint64_t GLuint64EXT;
-#endif
-
-void init_tess();
-void exit_tess();
-int wxe_tess_impl(char* buff, ErlDrvTermData caller);
+void wxe_initOpenGL(wxeReturn, char*);
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index 6d2926ce4e..79d1a29519 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -68,7 +68,6 @@ ErlDrvTermData wxe_batch_caller = 0;
ErlDrvTermData init_caller = 0;
// extern opengl
-extern int gl_initiated;
void gl_dispatch(int op, char *bp, ErlDrvTermData caller, WXEBinRef *bins[]);
@@ -265,7 +264,6 @@ bool WxeApp::OnInit()
init_nonconsts(global_me, init_caller);
erl_drv_mutex_lock(wxe_status_m);
wxe_status = WXE_INITIATED;
- gl_initiated = FALSE;
erl_drv_cond_signal(wxe_status_c);
erl_drv_mutex_unlock(wxe_status_m);
return TRUE;