diff options
Diffstat (limited to 'lib/wx/c_src/egl_impl.cpp')
-rw-r--r-- | lib/wx/c_src/egl_impl.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/wx/c_src/egl_impl.cpp b/lib/wx/c_src/egl_impl.cpp index e2dbbb73c4..6d873abc44 100644 --- a/lib/wx/c_src/egl_impl.cpp +++ b/lib/wx/c_src/egl_impl.cpp @@ -1,20 +1,20 @@ /* * %CopyrightBegin% - * - * Copyright Ericsson AB 2010. All Rights Reserved. - * + * + * Copyright Ericsson AB 2011. 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% + * + * %CopyrightEnd% */ #include <stdio.h> @@ -35,8 +35,8 @@ void init_tess(); void exit_tess(); int load_gl_functions(); -/* **************************************************************************** - * OPENGL INITIALIZATION +/* **************************************************************************** + * OPENGL INITIALIZATION *****************************************************************************/ int egl_initiated = 0; @@ -51,7 +51,7 @@ void * dlsym(HMODULE Lib, const char *func) { void * funcp; if((funcp = (void *) GetProcAddress(Lib, func))) return funcp; - else + else return (void *) wglGetProcAddress(func); } @@ -73,14 +73,14 @@ typedef char DL_CHAR; # define OPENGL_LIB "libGL.so" # define OPENGLU_LIB "libGLU.so" # endif -#endif +#endif extern "C" { -DRIVER_INIT(EGL_DRIVER) { +DRIVER_INIT(EGL_DRIVER) { return NULL; } } -int egl_init_opengl(void *erlCallbacks) +int egl_init_opengl(void *erlCallbacks) { #ifdef _WIN32 driver_init((TWinDynDriverCallbacks *) erlCallbacks); @@ -95,7 +95,7 @@ int egl_init_opengl(void *erlCallbacks) } int load_gl_functions() { - DL_CHAR * DLName = OPENGL_LIB; + DL_CHAR * DLName = (DL_CHAR *) OPENGL_LIB; DL_LIB_P LIBhandle = dlopen(DLName, RTLD_LAZY); //fprintf(stderr, "Loading GL: %s\r\n", (const char*)DLName); void * func = NULL; @@ -127,13 +127,13 @@ int load_gl_functions() { fprintf(stderr, "Could NOT load OpenGL library: %s\r\n", DLName); }; - DLName = OPENGLU_LIB; + DLName = (DL_CHAR *) OPENGLU_LIB; LIBhandle = dlopen(DLName, RTLD_LAZY); // fprintf(stderr, "Loading GLU: %s\r\n", (const char*)DLName); func = NULL; if(LIBhandle) { - for(i=0; glu_fns[i].name != NULL; i++) { + for(i=0; glu_fns[i].name != NULL; i++) { if((func = dlsym(LIBhandle, glu_fns[i].name))) { * (void **) (glu_fns[i].func) = func; } else { @@ -201,7 +201,7 @@ egl_ogla_error(GLenum errorCode) void CALLBACK egl_ogla_combine(GLdouble coords[3], void* vertex_data[4], - GLfloat w[4], + GLfloat w[4], void **dataOut) { GLdouble* vertex = tess_alloc_vertex; @@ -226,7 +226,7 @@ egl_ogla_combine(GLdouble coords[3], *dataOut = vertex; } -void init_tess() +void init_tess() { tess = gluNewTess(); @@ -237,7 +237,7 @@ void init_tess() } -void exit_tess() +void exit_tess() { gluDeleteTess(tess); } @@ -251,22 +251,22 @@ int erl_tess_impl(char* buff, ErlDrvPort port, ErlDrvTermData caller) 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)); + 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 +#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); @@ -275,9 +275,9 @@ int erl_tess_impl(char* buff, ErlDrvPort port, ErlDrvTermData caller) } gluTessEndContour(tess); gluTessEndPolygon(tess); - - n_pos = (tess_vertices - vertices); - + + 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_"); @@ -287,12 +287,12 @@ int erl_tess_impl(char* buff, ErlDrvPort port, ErlDrvTermData caller) }; 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++] = 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, */ |