Subject: [Nel] patch to compile on GNU/Linux

From: Loic Dachary <[email-masked]>
Date: Thu, 7 Feb 2002 02:24:42 +0100

Hi,

	Following the advices of Vincent Caron I managed to get a snowballs
client that core dumps instead of barking because of a missing glSetFenceNV
symbol. During the process, I was trapped by something I could not figure out
and temporarily worked around by patching gl.h (Mesa-4.0.1). The 
GL_ARB_multitexture block of gl.h does not contain the typedefs that
show in the glext.h (
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
...
). Since gl.h is included before glext.h, the typedefs are missing. 
I hesitated to simply duplicate them in the nel sources. There must be
a solution to include them although I can't currently figure out how.

	At the end of the patch there is a minor fix to the acinclude.m4
so that the proper STL debug library is loaded with --with-debug=full is
activated. I quickly backed up to --with-debug alone, though, because the
STL-4.0 library in debug more creates problems in which I had no inclination
to dive ;-) It dumps core during the iostream initialization.

	When I first ran the snowballs client, a window appeared and the 
core dump occured at the following point:

(gdb) run
Starting program: /spare3/nel/bin/snowballs 
[New Thread 1024 (LWP 22130)]
INF22130 client.cpp 145 : Starting Snowballs !
[New Thread 2049 (LWP 22131)]
[New Thread 1026 (LWP 22132)]
DBG22130 driver_opengl.cpp 563 : XOpenDisplay on 'loic.dachary.org:10.0' OK
DBG22130 driver_opengl.cpp 600 : glXChooseVisual OK
DBG22130 driver_opengl.cpp 611 : glXCreateContext() OK
DBG22130 driver_opengl.cpp 646 : XCreateWindow() OK
WARNING: This Mesa Library includes the Glide driver but
         you have not defined the MESA_GLX_FX env. var.
         (check the README.3DFX file for more information).

         you can disable this message with a 'export MESA_GLX_FX=disable'.
DBG22130 driver_opengl_extension.cpp 576 : GLExt: GL_ARB_imaging GL_ARB_multisample GL_ARB_multitexture GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_transpose_matrix GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_func_separate GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_clip_volume_hint GL_EXT_convolution GL_EXT_compiled_vertex_array GL_EXT_fog_coord GL_EXT_histogram GL_EXT_packed_pixels GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_shared_texture_palette GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_object GL_EXT_texture_lod_bias GL_EXT_vertex_array GL_HP_occlusion_test GL_IBM_rasterpos_clip GL_INGR_blend_func_separate GL_MESA_resize_buffers GL_MESA_window_pos GL_NV_blend_square GL_NV_texgen_reflection GL_SGI_color_matrix GL_SGI_color_table GL_SGIS_generate_mipmap GL_SGIS_pixel_texture GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIX_depth_texture GL_SGIX_pixel_texture GL_SGIX_shadow GL_SGIX_shadow_ambient

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 22130)]
0x41a50aec in glMultiTexCoord1iARB () from /spare3/nel/lib/libnel_drv_opengl.so
(gdb) bt
#0  0x41a50aec in glMultiTexCoord1iARB () from /spare3/nel/lib/libnel_drv_opengl.so
#1  0x41a0d33a in NL3D::CDriverGLStates::forceDefaults (this=0x86c1798, nbStages=4)
    at driver_opengl_states.cpp:119
#2  0x41a06657 in NL3D::CDriverGL::setDisplay (this=0x86c0588, wnd=0x0, 
    mode=@0xbffffa74) at driver_opengl.cpp:813
#3  0x40b25157 in NL3D::CDriverUser::setDisplay (this=0x8599160, mode=@0xbffffce0)
    at driver_user.cpp:186
#4  0x08063a9a in main (argc=1, argv=0xbffffd74) at client.cpp:171
#5  0x4177c6cf in __libc_start_main () from /lib/libc.so.6

	I was puzzled since the matching line in driver_opengl_states is
really a call to : glActiveTextureARB(GL_TEXTURE0_ARB+stage); I figured that
I'd get more information by recompiling Mesa with debugging information. 
And I did so with the sources of Mesa-4.0.1 and made sure nel + snowballs
were recompiled from scratch using this instance of Mesa.

	Running snowballs again showed something quite different, as it
often happens when adding debugging information on top of a core dumping
piece of code.

(gdb) cd /spare3/nel/code/snowballs2/client/
Working directory /spare3/nel/code/snowballs2/client.
(gdb) run 
Starting program: /spare3/nel/bin/snowballs 
[New Thread 1024 (LWP 15015)]
INF15015 client.cpp 145 : Starting Snowballs !
[New Thread 2049 (LWP 15016)]
[New Thread 1026 (LWP 15017)]
DBG15015 driver_opengl.cpp 563 : XOpenDisplay on 'loic.dachary.org:10.0' OK
DBG15015 driver_opengl.cpp 600 : glXChooseVisual OK

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 15015)]
0x41c5d52e in xmesa_register_swrast_functions (ctx=0x86c6dd8) at xm_dd.c:1037
Current language:  auto; currently c
(gdb) bt
#0  0x41c5d52e in xmesa_register_swrast_functions (ctx=0x86c6dd8) at xm_dd.c:1037
#1  0x41c59a0b in XMesaCreateContext (v=0x86c4b90, share_list=0x0) at xm_api.c:1661
#2  0x41c5407d in Fake_glXCreateContext (dpy=0x86c1ee8, visinfo=0x86c49f8, 
    share_list=0x0, direct=1) at fakeglx.c:1154
#3  0x41c500d8 in glXCreateContext (dpy=0x86c1ee8, visinfo=0x86c49f8, shareList=0x0, 
    direct=1) at glxapi.c:188
#4  0x41a05bc8 in NL3D::CDriverGL::setDisplay (this=0x86c0578, wnd=0x0, 
    mode=@0xbffffa74) at driver_opengl.cpp:603
#5  0x40b25157 in NL3D::CDriverUser::setDisplay (this=0x8599160, mode=@0xbffffce0)
    at driver_user.cpp:186
#6  0x08063a9a in main (argc=1, argv=0xbffffd74) at client.cpp:171
#7  0x4177c6cf in __libc_start_main () from /lib/libc.so.6
(gdb) print swrast
$1 = (SWcontext *) 0x0

	There, I know why it core dumps. Not being familiar enough with Mesa,
I can hardly imagine why that pointer is null. I'd expect Mesa to bark earlier
with a nice error message but I guess it's too much asking :-)

	Any kind of help or advice will be welcome.

	Cheers,

Index: nel/src/3d/driver/opengl/driver_opengl.cpp
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl.cpp,v
retrieving revision 1.134
diff -u -r1.134 driver_opengl.cpp
--- nel/src/3d/driver/opengl/driver_opengl.cpp	18 Jan 2002 10:08:12 -0000	1.134
+++ nel/src/3d/driver/opengl/driver_opengl.cpp	7 Feb 2002 00:58:30 -0000
@@ -37,7 +37,6 @@
 
 #else // NL_OS_UNIX
 
-#define	GL_GLEXT_PROTOTYPES
 #include <GL/glx.h>
 
 #endif // NL_OS_UNIX
Index: nel/src/3d/driver/opengl/driver_opengl.h
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl.h,v
retrieving revision 1.108
diff -u -r1.108 driver_opengl.h
--- nel/src/3d/driver/opengl/driver_opengl.h	18 Jan 2002 10:08:12 -0000	1.108
+++ nel/src/3d/driver/opengl/driver_opengl.h	7 Feb 2002 00:58:30 -0000
@@ -42,7 +42,6 @@
 
 #else // NL_OS_UNIX
 
-#define	GL_GLEXT_PROTOTYPES
 #include <GL/glx.h>
 
 #ifdef XF86VIDMODE
Index: nel/src/3d/driver/opengl/driver_opengl_extension.cpp
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp,v
retrieving revision 1.25
diff -u -r1.25 driver_opengl_extension.cpp
--- nel/src/3d/driver/opengl/driver_opengl_extension.cpp	18 Jan 2002 10:08:12 -0000	1.25
+++ nel/src/3d/driver/opengl/driver_opengl_extension.cpp	7 Feb 2002 00:58:31 -0000
@@ -23,17 +23,21 @@
  * MA 02111-1307, USA.
  */
 
+#define GLX_GLXEXT_PROTOTYPES
 
 #include "stdopengl.h"
 
 #include "driver_opengl_extension.h"
 #include "3d/material.h"
 
-
+#ifdef NL_OS_UNIX
+#define GetProcAddress glXGetProcAddressARB 
+#else /* NL_OS_WINDOWS */
+#define GetProcAddress wglGetProcAddress
+#endif /* NL_OS_UNIX */
 
 // ***************************************************************************
 // The exported function names for the windows platform.
-#ifdef NL_OS_WINDOWS
 
 // ARB_multitexture
 //=================
@@ -90,8 +94,10 @@
 //====================
 PFNGLFLUSHVERTEXARRAYRANGENVPROC	glFlushVertexArrayRangeNV;
 PFNGLVERTEXARRAYRANGENVPROC			glVertexArrayRangeNV;
+#ifdef NL_OS_WINDOWS
 PFNWGLALLOCATEMEMORYNVPROC			wglAllocateMemoryNV;
 PFNWGLFREEMEMORYNVPROC				wglFreeMemoryNV;
+#endif // NL_OS_WINDOWS

 // FenceNV.
@@ -200,6 +206,7 @@
 PFNGLSECONDARYCOLORPOINTEREXTPROC	glSecondaryColorPointerEXT;

+#ifdef NL_OS_WINDOWS
 // Pbuffer extension
 //==================
 PFNWGLCREATEPBUFFERARBPROC			wglCreatePbufferARB;
@@ -218,9 +225,9 @@
 
 // WGL_ARB_extensions_string
 PFNWGFGETEXTENSIONSSTRINGARB		wglGetExtensionsStringARB;
+#endif // NL_OS_WINDOWS

-#endif // NL_OS_WINDOWS

@@ -245,44 +252,42 @@
 	if(strstr(glext, "GL_ARB_multitexture")==NULL)
 		return false;
 
-#ifdef NL_OS_WINDOWS
-	if(!(glActiveTextureARB=(PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB")))return false;
-	if(!(glClientActiveTextureARB=(PFNGLCLIENTACTIVETEXTUREARBPROC)wglGetProcAddress("glClientActiveTextureARB")))return false;
+	if(!(glActiveTextureARB=(PFNGLACTIVETEXTUREARBPROC)GetProcAddress((const GLubyte *)"glActiveTextureARB")))return false;
+	if(!(glClientActiveTextureARB=(PFNGLCLIENTACTIVETEXTUREARBPROC)GetProcAddress((const GLubyte *)"glClientActiveTextureARB")))return false;
 
-	if(!(glMultiTexCoord1sARB=(PFNGLMULTITEXCOORD1SARBPROC)wglGetProcAddress("glMultiTexCoord1sARB")))return false;
-	if(!(glMultiTexCoord1iARB=(PFNGLMULTITEXCOORD1IARBPROC)wglGetProcAddress("glMultiTexCoord1iARB")))return false;
-	if(!(glMultiTexCoord1fARB=(PFNGLMULTITEXCOORD1FARBPROC)wglGetProcAddress("glMultiTexCoord1fARB")))return false;
-	if(!(glMultiTexCoord1dARB=(PFNGLMULTITEXCOORD1DARBPROC)wglGetProcAddress("glMultiTexCoord1dARB")))return false;
-	if(!(glMultiTexCoord2sARB=(PFNGLMULTITEXCOORD2SARBPROC)wglGetProcAddress("glMultiTexCoord2sARB")))return false;
-	if(!(glMultiTexCoord2iARB=(PFNGLMULTITEXCOORD2IARBPROC)wglGetProcAddress("glMultiTexCoord2iARB")))return false;
-	if(!(glMultiTexCoord2fARB=(PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB")))return false;
-	if(!(glMultiTexCoord2dARB=(PFNGLMULTITEXCOORD2DARBPROC)wglGetProcAddress("glMultiTexCoord2dARB")))return false;
-	if(!(glMultiTexCoord3sARB=(PFNGLMULTITEXCOORD3SARBPROC)wglGetProcAddress("glMultiTexCoord3sARB")))return false;
-	if(!(glMultiTexCoord3iARB=(PFNGLMULTITEXCOORD3IARBPROC)wglGetProcAddress("glMultiTexCoord3iARB")))return false;
-	if(!(glMultiTexCoord3fARB=(PFNGLMULTITEXCOORD3FARBPROC)wglGetProcAddress("glMultiTexCoord3fARB")))return false;
-	if(!(glMultiTexCoord3dARB=(PFNGLMULTITEXCOORD3DARBPROC)wglGetProcAddress("glMultiTexCoord3dARB")))return false;
-	if(!(glMultiTexCoord4sARB=(PFNGLMULTITEXCOORD4SARBPROC)wglGetProcAddress("glMultiTexCoord4sARB")))return false;
-	if(!(glMultiTexCoord4iARB=(PFNGLMULTITEXCOORD4IARBPROC)wglGetProcAddress("glMultiTexCoord4iARB")))return false;
-	if(!(glMultiTexCoord4fARB=(PFNGLMULTITEXCOORD4FARBPROC)wglGetProcAddress("glMultiTexCoord4fARB")))return false;
-	if(!(glMultiTexCoord4dARB=(PFNGLMULTITEXCOORD4DARBPROC)wglGetProcAddress("glMultiTexCoord4dARB")))return false;
-
-	if(!(glMultiTexCoord1svARB=(PFNGLMULTITEXCOORD1SVARBPROC)wglGetProcAddress("glMultiTexCoord1svARB")))return false;
-	if(!(glMultiTexCoord1ivARB=(PFNGLMULTITEXCOORD1IVARBPROC)wglGetProcAddress("glMultiTexCoord1ivARB")))return false;
-	if(!(glMultiTexCoord1fvARB=(PFNGLMULTITEXCOORD1FVARBPROC)wglGetProcAddress("glMultiTexCoord1fvARB")))return false;
-	if(!(glMultiTexCoord1dvARB=(PFNGLMULTITEXCOORD1DVARBPROC)wglGetProcAddress("glMultiTexCoord1dvARB")))return false;
-	if(!(glMultiTexCoord2svARB=(PFNGLMULTITEXCOORD2SVARBPROC)wglGetProcAddress("glMultiTexCoord2svARB")))return false;
-	if(!(glMultiTexCoord2ivARB=(PFNGLMULTITEXCOORD2IVARBPROC)wglGetProcAddress("glMultiTexCoord2ivARB")))return false;
-	if(!(glMultiTexCoord2fvARB=(PFNGLMULTITEXCOORD2FVARBPROC)wglGetProcAddress("glMultiTexCoord2fvARB")))return false;
-	if(!(glMultiTexCoord2dvARB=(PFNGLMULTITEXCOORD2DVARBPROC)wglGetProcAddress("glMultiTexCoord2dvARB")))return false;
-	if(!(glMultiTexCoord3svARB=(PFNGLMULTITEXCOORD3SVARBPROC)wglGetProcAddress("glMultiTexCoord3svARB")))return false;
-	if(!(glMultiTexCoord3ivARB=(PFNGLMULTITEXCOORD3IVARBPROC)wglGetProcAddress("glMultiTexCoord3ivARB")))return false;
-	if(!(glMultiTexCoord3fvARB=(PFNGLMULTITEXCOORD3FVARBPROC)wglGetProcAddress("glMultiTexCoord3fvARB")))return false;
-	if(!(glMultiTexCoord3dvARB=(PFNGLMULTITEXCOORD3DVARBPROC)wglGetProcAddress("glMultiTexCoord3dvARB")))return false;
-	if(!(glMultiTexCoord4svARB=(PFNGLMULTITEXCOORD4SVARBPROC)wglGetProcAddress("glMultiTexCoord4svARB")))return false;
-	if(!(glMultiTexCoord4ivARB=(PFNGLMULTITEXCOORD4IVARBPROC)wglGetProcAddress("glMultiTexCoord4ivARB")))return false;
-	if(!(glMultiTexCoord4fvARB=(PFNGLMULTITEXCOORD4FVARBPROC)wglGetProcAddress("glMultiTexCoord4fvARB")))return false;
-	if(!(glMultiTexCoord4dvARB=(PFNGLMULTITEXCOORD4DVARBPROC)wglGetProcAddress("glMultiTexCoord4dvARB")))return false;
-#endif
+	if(!(glMultiTexCoord1sARB=(PFNGLMULTITEXCOORD1SARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1sARB")))return false;
+	if(!(glMultiTexCoord1iARB=(PFNGLMULTITEXCOORD1IARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1iARB")))return false;
+	if(!(glMultiTexCoord1fARB=(PFNGLMULTITEXCOORD1FARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1fARB")))return false;
+	if(!(glMultiTexCoord1dARB=(PFNGLMULTITEXCOORD1DARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1dARB")))return false;
+	if(!(glMultiTexCoord2sARB=(PFNGLMULTITEXCOORD2SARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2sARB")))return false;
+	if(!(glMultiTexCoord2iARB=(PFNGLMULTITEXCOORD2IARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2iARB")))return false;
+	if(!(glMultiTexCoord2fARB=(PFNGLMULTITEXCOORD2FARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2fARB")))return false;
+	if(!(glMultiTexCoord2dARB=(PFNGLMULTITEXCOORD2DARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2dARB")))return false;
+	if(!(glMultiTexCoord3sARB=(PFNGLMULTITEXCOORD3SARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3sARB")))return false;
+	if(!(glMultiTexCoord3iARB=(PFNGLMULTITEXCOORD3IARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3iARB")))return false;
+	if(!(glMultiTexCoord3fARB=(PFNGLMULTITEXCOORD3FARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3fARB")))return false;
+	if(!(glMultiTexCoord3dARB=(PFNGLMULTITEXCOORD3DARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3dARB")))return false;
+	if(!(glMultiTexCoord4sARB=(PFNGLMULTITEXCOORD4SARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4sARB")))return false;
+	if(!(glMultiTexCoord4iARB=(PFNGLMULTITEXCOORD4IARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4iARB")))return false;
+	if(!(glMultiTexCoord4fARB=(PFNGLMULTITEXCOORD4FARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4fARB")))return false;
+	if(!(glMultiTexCoord4dARB=(PFNGLMULTITEXCOORD4DARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4dARB")))return false;
+
+	if(!(glMultiTexCoord1svARB=(PFNGLMULTITEXCOORD1SVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1svARB")))return false;
+	if(!(glMultiTexCoord1ivARB=(PFNGLMULTITEXCOORD1IVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1ivARB")))return false;
+	if(!(glMultiTexCoord1fvARB=(PFNGLMULTITEXCOORD1FVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1fvARB")))return false;
+	if(!(glMultiTexCoord1dvARB=(PFNGLMULTITEXCOORD1DVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord1dvARB")))return false;
+	if(!(glMultiTexCoord2svARB=(PFNGLMULTITEXCOORD2SVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2svARB")))return false;
+	if(!(glMultiTexCoord2ivARB=(PFNGLMULTITEXCOORD2IVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2ivARB")))return false;
+	if(!(glMultiTexCoord2fvARB=(PFNGLMULTITEXCOORD2FVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2fvARB")))return false;
+	if(!(glMultiTexCoord2dvARB=(PFNGLMULTITEXCOORD2DVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord2dvARB")))return false;
+	if(!(glMultiTexCoord3svARB=(PFNGLMULTITEXCOORD3SVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3svARB")))return false;
+	if(!(glMultiTexCoord3ivARB=(PFNGLMULTITEXCOORD3IVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3ivARB")))return false;
+	if(!(glMultiTexCoord3fvARB=(PFNGLMULTITEXCOORD3FVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3fvARB")))return false;
+	if(!(glMultiTexCoord3dvARB=(PFNGLMULTITEXCOORD3DVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord3dvARB")))return false;
+	if(!(glMultiTexCoord4svARB=(PFNGLMULTITEXCOORD4SVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4svARB")))return false;
+	if(!(glMultiTexCoord4ivARB=(PFNGLMULTITEXCOORD4IVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4ivARB")))return false;
+	if(!(glMultiTexCoord4fvARB=(PFNGLMULTITEXCOORD4FVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4fvARB")))return false;
+	if(!(glMultiTexCoord4dvARB=(PFNGLMULTITEXCOORD4DVARBPROC)GetProcAddress((const GLubyte *)"glMultiTexCoord4dvARB")))return false;
 
 	return true;
 }
@@ -304,15 +309,13 @@
 	if(strstr(glext, "GL_ARB_texture_compression")==NULL)
 	  return false;
 
-#ifdef NL_OS_WINDOWS
-	if(!(glCompressedTexImage3DARB=(PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)wglGetProcAddress("glCompressedTexImage3DARB")))return false;
-	if(!(glCompressedTexImage2DARB=(PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)wglGetProcAddress("glCompressedTexImage2DARB")))return false;
-	if(!(glCompressedTexImage1DARB=(PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)wglGetProcAddress("glCompressedTexImage1DARB")))return false;
-	if(!(glCompressedTexSubImage3DARB=(PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)wglGetProcAddress("glCompressedTexSubImage3DARB")))return false;
-	if(!(glCompressedTexSubImage2DARB=(PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)wglGetProcAddress("glCompressedTexSubImage2DARB")))return false;
-	if(!(glCompressedTexSubImage1DARB=(PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)wglGetProcAddress("glCompressedTexSubImage1DARB")))return false;
-	if(!(glGetCompressedTexImageARB=(PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)wglGetProcAddress("glGetCompressedTexImageARB")))return false;
-#endif
+	if(!(glCompressedTexImage3DARB=(PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)GetProcAddress((const GLubyte *)"glCompressedTexImage3DARB")))return false;
+	if(!(glCompressedTexImage2DARB=(PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)GetProcAddress((const GLubyte *)"glCompressedTexImage2DARB")))return false;
+	if(!(glCompressedTexImage1DARB=(PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)GetProcAddress((const GLubyte *)"glCompressedTexImage1DARB")))return false;
+	if(!(glCompressedTexSubImage3DARB=(PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)GetProcAddress((const GLubyte *)"glCompressedTexSubImage3DARB")))return false;
+	if(!(glCompressedTexSubImage2DARB=(PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)GetProcAddress((const GLubyte *)"glCompressedTexSubImage2DARB")))return false;
+	if(!(glCompressedTexSubImage1DARB=(PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)GetProcAddress((const GLubyte *)"glCompressedTexSubImage1DARB")))return false;
+	if(!(glGetCompressedTexImageARB=(PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)GetProcAddress((const GLubyte *)"glGetCompressedTexImageARB")))return false;
 
 	return true;
 }
@@ -336,19 +339,21 @@
 
 #ifdef NL_OS_WINDOWS
 	// Get VAR adress.
-	if(!(glFlushVertexArrayRangeNV=(PFNGLFLUSHVERTEXARRAYRANGENVPROC)wglGetProcAddress("glFlushVertexArrayRangeNV")))return false;
-	if(!(glVertexArrayRangeNV=(PFNGLVERTEXARRAYRANGENVPROC)wglGetProcAddress("glVertexArrayRangeNV")))return false;
-	if(!(wglAllocateMemoryNV= (PFNWGLALLOCATEMEMORYNVPROC)wglGetProcAddress("wglAllocateMemoryNV")))return false;
-	if(!(wglFreeMemoryNV= (PFNWGLFREEMEMORYNVPROC)wglGetProcAddress("wglFreeMemoryNV")))return false;
+	if(!(glFlushVertexArrayRangeNV=(PFNGLFLUSHVERTEXARRAYRANGENVPROC)GetProcAddress((const GLubyte *)"glFlushVertexArrayRangeNV")))return false;
+	if(!(glVertexArrayRangeNV=(PFNGLVERTEXARRAYRANGENVPROC)GetProcAddress((const GLubyte *)"glVertexArrayRangeNV")))return false;
+#ifdef NL_OS_WINDOWS
+	if(!(wglAllocateMemoryNV= (PFNWGLALLOCATEMEMORYNVPROC)GetProcAddress((const GLubyte *)"wglAllocateMemoryNV")))return false;
+	if(!(wglFreeMemoryNV= (PFNWGLFREEMEMORYNVPROC)GetProcAddress((const GLubyte *)"wglFreeMemoryNV")))return false;
+#endif // NL_OS_WINDOWS
 
 	// Get fence adress.
-	if(!(glDeleteFencesNV= (PFNGLDELETEFENCESNVPROC)wglGetProcAddress("glDeleteFencesNV")))return false;
-	if(!(glGenFencesNV= (PFNGLGENFENCESNVPROC)wglGetProcAddress("glGenFencesNV")))return false;
-	if(!(glIsFenceNV= (PFNGLISFENCENVPROC)wglGetProcAddress("glIsFenceNV")))return false;
-	if(!(glTestFenceNV= (PFNGLTESTFENCENVPROC)wglGetProcAddress("glTestFenceNV")))return false;
-	if(!(glGetFenceivNV= (PFNGLGETFENCEIVNVPROC)wglGetProcAddress("glGetFenceivNV")))return false;
-	if(!(glFinishFenceNV= (PFNGLFINISHFENCENVPROC)wglGetProcAddress("glFinishFenceNV")))return false;
-	if(!(glSetFenceNV= (PFNGLSETFENCENVPROC)wglGetProcAddress("glSetFenceNV")))return false;
+	if(!(glDeleteFencesNV= (PFNGLDELETEFENCESNVPROC)GetProcAddress((const GLubyte *)"glDeleteFencesNV")))return false;
+	if(!(glGenFencesNV= (PFNGLGENFENCESNVPROC)GetProcAddress((const GLubyte *)"glGenFencesNV")))return false;
+	if(!(glIsFenceNV= (PFNGLISFENCENVPROC)GetProcAddress((const GLubyte *)"glIsFenceNV")))return false;
+	if(!(glTestFenceNV= (PFNGLTESTFENCENVPROC)GetProcAddress((const GLubyte *)"glTestFenceNV")))return false;
+	if(!(glGetFenceivNV= (PFNGLGETFENCEIVNVPROC)GetProcAddress((const GLubyte *)"glGetFenceivNV")))return false;
+	if(!(glFinishFenceNV= (PFNGLFINISHFENCENVPROC)GetProcAddress((const GLubyte *)"glFinishFenceNV")))return false;
+	if(!(glSetFenceNV= (PFNGLSETFENCENVPROC)GetProcAddress((const GLubyte *)"glSetFenceNV")))return false;
 
 #endif
 
@@ -372,11 +377,9 @@
 	if(strstr (glext, "GL_EXT_vertex_weighting")==NULL)
 		return false;
 
-#ifdef NL_OS_WINDOWS
-	if(!(glVertexWeightfEXT=(PFNGLVERTEXWEIGHTFEXTPROC)wglGetProcAddress("glVertexWeightfEXT")))return false;
-	if(!(glVertexWeightfvEXT=(PFNGLVERTEXWEIGHTFVEXTPROC)wglGetProcAddress("glVertexWeightfvEXT")))return false;
-	if(!(glVertexWeightPointerEXT=(PFNGLVERTEXWEIGHTPOINTEREXTPROC)wglGetProcAddress("glVertexWeightPointerEXT")))return false;
-#endif
+	if(!(glVertexWeightfEXT=(PFNGLVERTEXWEIGHTFEXTPROC)GetProcAddress((const GLubyte *)"glVertexWeightfEXT")))return false;
+	if(!(glVertexWeightfvEXT=(PFNGLVERTEXWEIGHTFVEXTPROC)GetProcAddress((const GLubyte *)"glVertexWeightfvEXT")))return false;
+	if(!(glVertexWeightPointerEXT=(PFNGLVERTEXWEIGHTPOINTEREXTPROC)GetProcAddress((const GLubyte *)"glVertexWeightPointerEXT")))return false;
 
 	return true;
 }
@@ -417,72 +420,69 @@
 	if(strstr(glext, "GL_NV_vertex_program")==NULL)
 		return false;
 
-#ifdef NL_OS_WINDOWS
-	if(!(glAreProgramsResidentNV= (PFNGLAREPROGRAMSRESIDENTNVPROC)wglGetProcAddress("glAreProgramsResidentNV"))) return false;
-	if(!(glBindProgramNV= (PFNGLBINDPROGRAMNVPROC)wglGetProcAddress("glBindProgramNV"))) return false;
-	if(!(glDeleteProgramsNV= (PFNGLDELETEPROGRAMSNVPROC)wglGetProcAddress("glDeleteProgramsNV"))) return false;
-	if(!(glExecuteProgramNV= (PFNGLEXECUTEPROGRAMNVPROC)wglGetProcAddress("glExecuteProgramNV"))) return false;
-	if(!(glGenProgramsNV= (PFNGLGENPROGRAMSNVPROC)wglGetProcAddress("glGenProgramsNV"))) return false;
-	if(!(glGetProgramParameterdvNV= (PFNGLGETPROGRAMPARAMETERDVNVPROC)wglGetProcAddress("glGetProgramParameterdvNV"))) return false;
-	if(!(glGetProgramParameterfvNV= (PFNGLGETPROGRAMPARAMETERFVNVPROC)wglGetProcAddress("glGetProgramParameterfvNV"))) return false;
-	if(!(glGetProgramivNV= (PFNGLGETPROGRAMIVNVPROC)wglGetProcAddress("glGetProgramivNV"))) return false;
-	if(!(glGetProgramStringNV= (PFNGLGETPROGRAMSTRINGNVPROC)wglGetProcAddress("glGetProgramStringNV"))) return false;
-	if(!(glGetTrackMatrixivNV= (PFNGLGETTRACKMATRIXIVNVPROC)wglGetProcAddress("glGetTrackMatrixivNV"))) return false;
-	if(!(glGetVertexAttribdvNV= (PFNGLGETVERTEXATTRIBDVNVPROC)wglGetProcAddress("glGetVertexAttribdvNV"))) return false;
-	if(!(glGetVertexAttribfvNV= (PFNGLGETVERTEXATTRIBFVNVPROC)wglGetProcAddress("glGetVertexAttribfvNV"))) return false;
-	if(!(glGetVertexAttribivNV= (PFNGLGETVERTEXATTRIBIVNVPROC)wglGetProcAddress("glGetVertexAttribivNV"))) return false;
-	if(!(glGetVertexAttribPointervNV= (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)wglGetProcAddress("glGetVertexAttribPointervNV"))) return false;
-	if(!(glIsProgramNV= (PFNGLISPROGRAMNVPROC)wglGetProcAddress("glIsProgramNV"))) return false;
-	if(!(glLoadProgramNV= (PFNGLLOADPROGRAMNVPROC)wglGetProcAddress("glLoadProgramNV"))) return false;
-	if(!(glProgramParameter4dNV= (PFNGLPROGRAMPARAMETER4DNVPROC)wglGetProcAddress("glProgramParameter4dNV"))) return false;
-	if(!(glProgramParameter4dvNV= (PFNGLPROGRAMPARAMETER4DVNVPROC)wglGetProcAddress("glProgramParameter4dvNV"))) return false;
-	if(!(glProgramParameter4fNV= (PFNGLPROGRAMPARAMETER4FNVPROC)wglGetProcAddress("glProgramParameter4fNV"))) return false;
-	if(!(glProgramParameter4fvNV= (PFNGLPROGRAMPARAMETER4FVNVPROC)wglGetProcAddress("glProgramParameter4fvNV"))) return false;
-	if(!(glProgramParameters4dvNV= (PFNGLPROGRAMPARAMETERS4DVNVPROC)wglGetProcAddress("glProgramParameters4dvNV"))) return false;
-	if(!(glProgramParameters4fvNV= (PFNGLPROGRAMPARAMETERS4FVNVPROC)wglGetProcAddress("glProgramParameters4fvNV"))) return false;
-	if(!(glRequestResidentProgramsNV= (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)wglGetProcAddress("glRequestResidentProgramsNV"))) return false;
-	if(!(glTrackMatrixNV= (PFNGLTRACKMATRIXNVPROC)wglGetProcAddress("glTrackMatrixNV"))) return false;
-	if(!(glVertexAttribPointerNV= (PFNGLVERTEXATTRIBPOINTERNVPROC)wglGetProcAddress("glVertexAttribPointerNV"))) return false;
-	if(!(glVertexAttrib1dNV= (PFNGLVERTEXATTRIB1DNVPROC)wglGetProcAddress("glVertexAttrib1dNV"))) return false;
-	if(!(glVertexAttrib1dvNV= (PFNGLVERTEXATTRIB1DVNVPROC)wglGetProcAddress("glVertexAttrib1dvNV"))) return false;
-	if(!(glVertexAttrib1fNV= (PFNGLVERTEXATTRIB1FNVPROC)wglGetProcAddress("glVertexAttrib1fNV"))) return false;
-	if(!(glVertexAttrib1fvNV= (PFNGLVERTEXATTRIB1FVNVPROC)wglGetProcAddress("glVertexAttrib1fvNV"))) return false;
-	if(!(glVertexAttrib1sNV= (PFNGLVERTEXATTRIB1SNVPROC)wglGetProcAddress("glVertexAttrib1sNV"))) return false;
-	if(!(glVertexAttrib1svNV= (PFNGLVERTEXATTRIB1SVNVPROC)wglGetProcAddress("glVertexAttrib1svNV"))) return false;
-	if(!(glVertexAttrib2dNV= (PFNGLVERTEXATTRIB2DNVPROC)wglGetProcAddress("glVertexAttrib2dNV"))) return false;
-	if(!(glVertexAttrib2dvNV= (PFNGLVERTEXATTRIB2DVNVPROC)wglGetProcAddress("glVertexAttrib2dvNV"))) return false;
-	if(!(glVertexAttrib2fNV= (PFNGLVERTEXATTRIB2FNVPROC)wglGetProcAddress("glVertexAttrib2fNV"))) return false;
-	if(!(glVertexAttrib2fvNV= (PFNGLVERTEXATTRIB2FVNVPROC)wglGetProcAddress("glVertexAttrib2fvNV"))) return false;
-	if(!(glVertexAttrib2sNV= (PFNGLVERTEXATTRIB2SNVPROC)wglGetProcAddress("glVertexAttrib2sNV"))) return false;
-	if(!(glVertexAttrib2svNV= (PFNGLVERTEXATTRIB2SVNVPROC)wglGetProcAddress("glVertexAttrib2svNV"))) return false;
-	if(!(glVertexAttrib3dNV= (PFNGLVERTEXATTRIB3DNVPROC)wglGetProcAddress("glVertexAttrib3dNV"))) return false;
-	if(!(glVertexAttrib3dvNV= (PFNGLVERTEXATTRIB3DVNVPROC)wglGetProcAddress("glVertexAttrib3dvNV"))) return false;
-	if(!(glVertexAttrib3fNV= (PFNGLVERTEXATTRIB3FNVPROC)wglGetProcAddress("glVertexAttrib3fNV"))) return false;
-	if(!(glVertexAttrib3fvNV= (PFNGLVERTEXATTRIB3FVNVPROC)wglGetProcAddress("glVertexAttrib3fvNV"))) return false;
-	if(!(glVertexAttrib3sNV= (PFNGLVERTEXATTRIB3SNVPROC)wglGetProcAddress("glVertexAttrib3sNV"))) return false;
-	if(!(glVertexAttrib3svNV= (PFNGLVERTEXATTRIB3SVNVPROC)wglGetProcAddress("glVertexAttrib3svNV"))) return false;
-	if(!(glVertexAttrib4dNV= (PFNGLVERTEXATTRIB4DNVPROC)wglGetProcAddress("glVertexAttrib4dNV"))) return false;
-	if(!(glVertexAttrib4dvNV= (PFNGLVERTEXATTRIB4DVNVPROC)wglGetProcAddress("glVertexAttrib4dvNV"))) return false;
-	if(!(glVertexAttrib4fNV= (PFNGLVERTEXATTRIB4FNVPROC)wglGetProcAddress("glVertexAttrib4fNV"))) return false;
-	if(!(glVertexAttrib4fvNV= (PFNGLVERTEXATTRIB4FVNVPROC)wglGetProcAddress("glVertexAttrib4fvNV"))) return false;
-	if(!(glVertexAttrib4sNV= (PFNGLVERTEXATTRIB4SNVPROC)wglGetProcAddress("glVertexAttrib4sNV"))) return false;
-	if(!(glVertexAttrib4svNV= (PFNGLVERTEXATTRIB4SVNVPROC)wglGetProcAddress("glVertexAttrib4svNV"))) return false;
-	if(!(glVertexAttrib4ubvNV= (PFNGLVERTEXATTRIB4UBVNVPROC)wglGetProcAddress("glVertexAttrib4ubvNV"))) return false;
-	if(!(glVertexAttribs1dvNV= (PFNGLVERTEXATTRIBS1DVNVPROC)wglGetProcAddress("glVertexAttribs1dvNV"))) return false;
-	if(!(glVertexAttribs1fvNV= (PFNGLVERTEXATTRIBS1FVNVPROC)wglGetProcAddress("glVertexAttribs1fvNV"))) return false;
-	if(!(glVertexAttribs1svNV= (PFNGLVERTEXATTRIBS1SVNVPROC)wglGetProcAddress("glVertexAttribs1svNV"))) return false;
-	if(!(glVertexAttribs2dvNV= (PFNGLVERTEXATTRIBS2DVNVPROC)wglGetProcAddress("glVertexAttribs2dvNV"))) return false;
-	if(!(glVertexAttribs2fvNV= (PFNGLVERTEXATTRIBS2FVNVPROC)wglGetProcAddress("glVertexAttribs2fvNV"))) return false;
-	if(!(glVertexAttribs2svNV= (PFNGLVERTEXATTRIBS2SVNVPROC)wglGetProcAddress("glVertexAttribs2svNV"))) return false;
-	if(!(glVertexAttribs3dvNV= (PFNGLVERTEXATTRIBS3DVNVPROC)wglGetProcAddress("glVertexAttribs3dvNV"))) return false;
-	if(!(glVertexAttribs3fvNV= (PFNGLVERTEXATTRIBS3FVNVPROC)wglGetProcAddress("glVertexAttribs3fvNV"))) return false;
-	if(!(glVertexAttribs3svNV= (PFNGLVERTEXATTRIBS3SVNVPROC)wglGetProcAddress("glVertexAttribs3svNV"))) return false;
-	if(!(glVertexAttribs4dvNV= (PFNGLVERTEXATTRIBS4DVNVPROC)wglGetProcAddress("glVertexAttribs4dvNV"))) return false;
-	if(!(glVertexAttribs4fvNV= (PFNGLVERTEXATTRIBS4FVNVPROC)wglGetProcAddress("glVertexAttribs4fvNV"))) return false;
-	if(!(glVertexAttribs4svNV= (PFNGLVERTEXATTRIBS4SVNVPROC)wglGetProcAddress("glVertexAttribs4svNV"))) return false;
-	if(!(glVertexAttribs4ubvNV= (PFNGLVERTEXATTRIBS4UBVNVPROC)wglGetProcAddress("glVertexAttribs4ubvNV"))) return false;
-
-#endif
+	if(!(glAreProgramsResidentNV= (PFNGLAREPROGRAMSRESIDENTNVPROC)GetProcAddress((const GLubyte *)"glAreProgramsResidentNV"))) return false;
+	if(!(glBindProgramNV= (PFNGLBINDPROGRAMNVPROC)GetProcAddress((const GLubyte *)"glBindProgramNV"))) return false;
+	if(!(glDeleteProgramsNV= (PFNGLDELETEPROGRAMSNVPROC)GetProcAddress((const GLubyte *)"glDeleteProgramsNV"))) return false;
+	if(!(glExecuteProgramNV= (PFNGLEXECUTEPROGRAMNVPROC)GetProcAddress((const GLubyte *)"glExecuteProgramNV"))) return false;
+	if(!(glGenProgramsNV= (PFNGLGENPROGRAMSNVPROC)GetProcAddress((const GLubyte *)"glGenProgramsNV"))) return false;
+	if(!(glGetProgramParameterdvNV= (PFNGLGETPROGRAMPARAMETERDVNVPROC)GetProcAddress((const GLubyte *)"glGetProgramParameterdvNV"))) return false;
+	if(!(glGetProgramParameterfvNV= (PFNGLGETPROGRAMPARAMETERFVNVPROC)GetProcAddress((const GLubyte *)"glGetProgramParameterfvNV"))) return false;
+	if(!(glGetProgramivNV= (PFNGLGETPROGRAMIVNVPROC)GetProcAddress((const GLubyte *)"glGetProgramivNV"))) return false;
+	if(!(glGetProgramStringNV= (PFNGLGETPROGRAMSTRINGNVPROC)GetProcAddress((const GLubyte *)"glGetProgramStringNV"))) return false;
+	if(!(glGetTrackMatrixivNV= (PFNGLGETTRACKMATRIXIVNVPROC)GetProcAddress((const GLubyte *)"glGetTrackMatrixivNV"))) return false;
+	if(!(glGetVertexAttribdvNV= (PFNGLGETVERTEXATTRIBDVNVPROC)GetProcAddress((const GLubyte *)"glGetVertexAttribdvNV"))) return false;
+	if(!(glGetVertexAttribfvNV= (PFNGLGETVERTEXATTRIBFVNVPROC)GetProcAddress((const GLubyte *)"glGetVertexAttribfvNV"))) return false;
+	if(!(glGetVertexAttribivNV= (PFNGLGETVERTEXATTRIBIVNVPROC)GetProcAddress((const GLubyte *)"glGetVertexAttribivNV"))) return false;
+	if(!(glGetVertexAttribPointervNV= (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)GetProcAddress((const GLubyte *)"glGetVertexAttribPointervNV"))) return false;
+	if(!(glIsProgramNV= (PFNGLISPROGRAMNVPROC)GetProcAddress((const GLubyte *)"glIsProgramNV"))) return false;
+	if(!(glLoadProgramNV= (PFNGLLOADPROGRAMNVPROC)GetProcAddress((const GLubyte *)"glLoadProgramNV"))) return false;
+	if(!(glProgramParameter4dNV= (PFNGLPROGRAMPARAMETER4DNVPROC)GetProcAddress((const GLubyte *)"glProgramParameter4dNV"))) return false;
+	if(!(glProgramParameter4dvNV= (PFNGLPROGRAMPARAMETER4DVNVPROC)GetProcAddress((const GLubyte *)"glProgramParameter4dvNV"))) return false;
+	if(!(glProgramParameter4fNV= (PFNGLPROGRAMPARAMETER4FNVPROC)GetProcAddress((const GLubyte *)"glProgramParameter4fNV"))) return false;
+	if(!(glProgramParameter4fvNV= (PFNGLPROGRAMPARAMETER4FVNVPROC)GetProcAddress((const GLubyte *)"glProgramParameter4fvNV"))) return false;
+	if(!(glProgramParameters4dvNV= (PFNGLPROGRAMPARAMETERS4DVNVPROC)GetProcAddress((const GLubyte *)"glProgramParameters4dvNV"))) return false;
+	if(!(glProgramParameters4fvNV= (PFNGLPROGRAMPARAMETERS4FVNVPROC)GetProcAddress((const GLubyte *)"glProgramParameters4fvNV"))) return false;
+	if(!(glRequestResidentProgramsNV= (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)GetProcAddress((const GLubyte *)"glRequestResidentProgramsNV"))) return false;
+	if(!(glTrackMatrixNV= (PFNGLTRACKMATRIXNVPROC)GetProcAddress((const GLubyte *)"glTrackMatrixNV"))) return false;
+	if(!(glVertexAttribPointerNV= (PFNGLVERTEXATTRIBPOINTERNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribPointerNV"))) return false;
+	if(!(glVertexAttrib1dNV= (PFNGLVERTEXATTRIB1DNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib1dNV"))) return false;
+	if(!(glVertexAttrib1dvNV= (PFNGLVERTEXATTRIB1DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib1dvNV"))) return false;
+	if(!(glVertexAttrib1fNV= (PFNGLVERTEXATTRIB1FNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib1fNV"))) return false;
+	if(!(glVertexAttrib1fvNV= (PFNGLVERTEXATTRIB1FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib1fvNV"))) return false;
+	if(!(glVertexAttrib1sNV= (PFNGLVERTEXATTRIB1SNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib1sNV"))) return false;
+	if(!(glVertexAttrib1svNV= (PFNGLVERTEXATTRIB1SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib1svNV"))) return false;
+	if(!(glVertexAttrib2dNV= (PFNGLVERTEXATTRIB2DNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib2dNV"))) return false;
+	if(!(glVertexAttrib2dvNV= (PFNGLVERTEXATTRIB2DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib2dvNV"))) return false;
+	if(!(glVertexAttrib2fNV= (PFNGLVERTEXATTRIB2FNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib2fNV"))) return false;
+	if(!(glVertexAttrib2fvNV= (PFNGLVERTEXATTRIB2FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib2fvNV"))) return false;
+	if(!(glVertexAttrib2sNV= (PFNGLVERTEXATTRIB2SNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib2sNV"))) return false;
+	if(!(glVertexAttrib2svNV= (PFNGLVERTEXATTRIB2SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib2svNV"))) return false;
+	if(!(glVertexAttrib3dNV= (PFNGLVERTEXATTRIB3DNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib3dNV"))) return false;
+	if(!(glVertexAttrib3dvNV= (PFNGLVERTEXATTRIB3DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib3dvNV"))) return false;
+	if(!(glVertexAttrib3fNV= (PFNGLVERTEXATTRIB3FNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib3fNV"))) return false;
+	if(!(glVertexAttrib3fvNV= (PFNGLVERTEXATTRIB3FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib3fvNV"))) return false;
+	if(!(glVertexAttrib3sNV= (PFNGLVERTEXATTRIB3SNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib3sNV"))) return false;
+	if(!(glVertexAttrib3svNV= (PFNGLVERTEXATTRIB3SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib3svNV"))) return false;
+	if(!(glVertexAttrib4dNV= (PFNGLVERTEXATTRIB4DNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4dNV"))) return false;
+	if(!(glVertexAttrib4dvNV= (PFNGLVERTEXATTRIB4DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4dvNV"))) return false;
+	if(!(glVertexAttrib4fNV= (PFNGLVERTEXATTRIB4FNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4fNV"))) return false;
+	if(!(glVertexAttrib4fvNV= (PFNGLVERTEXATTRIB4FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4fvNV"))) return false;
+	if(!(glVertexAttrib4sNV= (PFNGLVERTEXATTRIB4SNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4sNV"))) return false;
+	if(!(glVertexAttrib4svNV= (PFNGLVERTEXATTRIB4SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4svNV"))) return false;
+	if(!(glVertexAttrib4ubvNV= (PFNGLVERTEXATTRIB4UBVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttrib4ubvNV"))) return false;
+	if(!(glVertexAttribs1dvNV= (PFNGLVERTEXATTRIBS1DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs1dvNV"))) return false;
+	if(!(glVertexAttribs1fvNV= (PFNGLVERTEXATTRIBS1FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs1fvNV"))) return false;
+	if(!(glVertexAttribs1svNV= (PFNGLVERTEXATTRIBS1SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs1svNV"))) return false;
+	if(!(glVertexAttribs2dvNV= (PFNGLVERTEXATTRIBS2DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs2dvNV"))) return false;
+	if(!(glVertexAttribs2fvNV= (PFNGLVERTEXATTRIBS2FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs2fvNV"))) return false;
+	if(!(glVertexAttribs2svNV= (PFNGLVERTEXATTRIBS2SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs2svNV"))) return false;
+	if(!(glVertexAttribs3dvNV= (PFNGLVERTEXATTRIBS3DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs3dvNV"))) return false;
+	if(!(glVertexAttribs3fvNV= (PFNGLVERTEXATTRIBS3FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs3fvNV"))) return false;
+	if(!(glVertexAttribs3svNV= (PFNGLVERTEXATTRIBS3SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs3svNV"))) return false;
+	if(!(glVertexAttribs4dvNV= (PFNGLVERTEXATTRIBS4DVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs4dvNV"))) return false;
+	if(!(glVertexAttribs4fvNV= (PFNGLVERTEXATTRIBS4FVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs4fvNV"))) return false;
+	if(!(glVertexAttribs4svNV= (PFNGLVERTEXATTRIBS4SVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs4svNV"))) return false;
+	if(!(glVertexAttribs4ubvNV= (PFNGLVERTEXATTRIBS4UBVNVPROC)GetProcAddress((const GLubyte *)"glVertexAttribs4ubvNV"))) return false;
 
 	return true;
 }
@@ -494,26 +494,23 @@
 	if(strstr(glext, "GL_EXT_secondary_color")==NULL)
 		return false;
 
-#ifdef NL_OS_WINDOWS
-	if(!(glSecondaryColor3bEXT= (PFNGLSECONDARYCOLOR3BEXTPROC)wglGetProcAddress("glSecondaryColor3bEXT"))) return false;
-	if(!(glSecondaryColor3bvEXT= (PFNGLSECONDARYCOLOR3BVEXTPROC)wglGetProcAddress("glSecondaryColor3bvEXT"))) return false;
-	if(!(glSecondaryColor3dEXT= (PFNGLSECONDARYCOLOR3DEXTPROC)wglGetProcAddress("glSecondaryColor3dEXT"))) return false;
-	if(!(glSecondaryColor3dvEXT= (PFNGLSECONDARYCOLOR3DVEXTPROC)wglGetProcAddress("glSecondaryColor3dvEXT"))) return false;
-	if(!(glSecondaryColor3fEXT= (PFNGLSECONDARYCOLOR3FEXTPROC)wglGetProcAddress("glSecondaryColor3fEXT"))) return false;
-	if(!(glSecondaryColor3fvEXT= (PFNGLSECONDARYCOLOR3FVEXTPROC)wglGetProcAddress("glSecondaryColor3fvEXT"))) return false;
-	if(!(glSecondaryColor3iEXT= (PFNGLSECONDARYCOLOR3IEXTPROC)wglGetProcAddress("glSecondaryColor3iEXT"))) return false;
-	if(!(glSecondaryColor3ivEXT= (PFNGLSECONDARYCOLOR3IVEXTPROC)wglGetProcAddress("glSecondaryColor3ivEXT"))) return false;
-	if(!(glSecondaryColor3sEXT= (PFNGLSECONDARYCOLOR3SEXTPROC)wglGetProcAddress("glSecondaryColor3sEXT"))) return false;
-	if(!(glSecondaryColor3svEXT= (PFNGLSECONDARYCOLOR3SVEXTPROC)wglGetProcAddress("glSecondaryColor3svEXT"))) return false;
-	if(!(glSecondaryColor3ubEXT= (PFNGLSECONDARYCOLOR3UBEXTPROC)wglGetProcAddress("glSecondaryColor3ubEXT"))) return false;
-	if(!(glSecondaryColor3ubvEXT= (PFNGLSECONDARYCOLOR3UBVEXTPROC)wglGetProcAddress("glSecondaryColor3ubvEXT"))) return false;
-	if(!(glSecondaryColor3uiEXT= (PFNGLSECONDARYCOLOR3UIEXTPROC)wglGetProcAddress("glSecondaryColor3uiEXT"))) return false;
-	if(!(glSecondaryColor3uivEXT= (PFNGLSECONDARYCOLOR3UIVEXTPROC)wglGetProcAddress("glSecondaryColor3uivEXT"))) return false;
-	if(!(glSecondaryColor3usEXT= (PFNGLSECONDARYCOLOR3USEXTPROC)wglGetProcAddress("glSecondaryColor3usEXT"))) return false;
-	if(!(glSecondaryColor3usvEXT= (PFNGLSECONDARYCOLOR3USVEXTPROC)wglGetProcAddress("glSecondaryColor3usvEXT"))) return false;
-	if(!(glSecondaryColorPointerEXT= (PFNGLSECONDARYCOLORPOINTEREXTPROC)wglGetProcAddress("glSecondaryColorPointerEXT"))) return false;
-
-#endif
+	if(!(glSecondaryColor3bEXT= (PFNGLSECONDARYCOLOR3BEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3bEXT"))) return false;
+	if(!(glSecondaryColor3bvEXT= (PFNGLSECONDARYCOLOR3BVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3bvEXT"))) return false;
+	if(!(glSecondaryColor3dEXT= (PFNGLSECONDARYCOLOR3DEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3dEXT"))) return false;
+	if(!(glSecondaryColor3dvEXT= (PFNGLSECONDARYCOLOR3DVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3dvEXT"))) return false;
+	if(!(glSecondaryColor3fEXT= (PFNGLSECONDARYCOLOR3FEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3fEXT"))) return false;
+	if(!(glSecondaryColor3fvEXT= (PFNGLSECONDARYCOLOR3FVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3fvEXT"))) return false;
+	if(!(glSecondaryColor3iEXT= (PFNGLSECONDARYCOLOR3IEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3iEXT"))) return false;
+	if(!(glSecondaryColor3ivEXT= (PFNGLSECONDARYCOLOR3IVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3ivEXT"))) return false;
+	if(!(glSecondaryColor3sEXT= (PFNGLSECONDARYCOLOR3SEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3sEXT"))) return false;
+	if(!(glSecondaryColor3svEXT= (PFNGLSECONDARYCOLOR3SVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3svEXT"))) return false;
+	if(!(glSecondaryColor3ubEXT= (PFNGLSECONDARYCOLOR3UBEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3ubEXT"))) return false;
+	if(!(glSecondaryColor3ubvEXT= (PFNGLSECONDARYCOLOR3UBVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3ubvEXT"))) return false;
+	if(!(glSecondaryColor3uiEXT= (PFNGLSECONDARYCOLOR3UIEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3uiEXT"))) return false;
+	if(!(glSecondaryColor3uivEXT= (PFNGLSECONDARYCOLOR3UIVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3uivEXT"))) return false;
+	if(!(glSecondaryColor3usEXT= (PFNGLSECONDARYCOLOR3USEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3usEXT"))) return false;
+	if(!(glSecondaryColor3usvEXT= (PFNGLSECONDARYCOLOR3USVEXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColor3usvEXT"))) return false;
+	if(!(glSecondaryColorPointerEXT= (PFNGLSECONDARYCOLORPOINTEREXTPROC)GetProcAddress((const GLubyte *)"glSecondaryColorPointerEXT"))) return false;
 
 	return true;
 }
@@ -525,12 +522,12 @@
 		return false;
 
 #ifdef NL_OS_WINDOWS
-	if(!(wglCreatePbufferARB= (PFNWGLCREATEPBUFFERARBPROC)wglGetProcAddress("wglCreatePbufferARB"))) return false;
-	if(!(wglGetPbufferDCARB= (PFNWGLGETPUFFERDCARBPROC)wglGetProcAddress("wglGetPbufferDCARB"))) return false;
-	if(!(wglReleasePbufferDCARB= (PFNWGLRELEASEPUFFERDCARBPROC)wglGetProcAddress("wglReleasePbufferDCARB"))) return false;
-	if(!(wglDestroyPbufferARB= (PFNWGLDESTROYPUFFERARBPROC)wglGetProcAddress("wglDestroyPbufferARB"))) return false;
-	if(!(wglQueryPbufferARB= (PFNWGLQUERYPBUFFERARBPROC)wglGetProcAddress("wglQueryPbufferARB"))) return false;
-#endif
+	if(!(wglCreatePbufferARB= (PFNWGLCREATEPBUFFERARBPROC)GetProcAddress((const GLubyte *)"wglCreatePbufferARB"))) return false;
+	if(!(wglGetPbufferDCARB= (PFNWGLGETPUFFERDCARBPROC)GetProcAddress((const GLubyte *)"wglGetPbufferDCARB"))) return false;
+	if(!(wglReleasePbufferDCARB= (PFNWGLRELEASEPUFFERDCARBPROC)GetProcAddress((const GLubyte *)"wglReleasePbufferDCARB"))) return false;
+	if(!(wglDestroyPbufferARB= (PFNWGLDESTROYPUFFERARBPROC)GetProcAddress((const GLubyte *)"wglDestroyPbufferARB"))) return false;
+	if(!(wglQueryPbufferARB= (PFNWGLQUERYPBUFFERARBPROC)GetProcAddress((const GLubyte *)"wglQueryPbufferARB"))) return false;
+#endif // NL_OS_WINDOWS
 
 	return true;
 }
@@ -542,10 +539,10 @@
 		return false;
 
 #ifdef NL_OS_WINDOWS
-	if(!(wglGetPixelFormatAttribivARB= (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB"))) return false;
-	if(!(wglGetPixelFormatAttribfvARB= (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribfvARB"))) return false;
-	if(!(wglChoosePixelFormatARB= (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB"))) return false;
-#endif
+	if(!(wglGetPixelFormatAttribivARB= (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)GetProcAddress((const GLubyte *)"wglGetPixelFormatAttribivARB"))) return false;
+	if(!(wglGetPixelFormatAttribfvARB= (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)GetProcAddress((const GLubyte *)"wglGetPixelFormatAttribfvARB"))) return false;
+	if(!(wglChoosePixelFormatARB= (PFNWGLCHOOSEPIXELFORMATARBPROC)GetProcAddress((const GLubyte *)"wglChoosePixelFormatARB"))) return false;
+#endif // NL_OS_WINDOWS
 
 	return true;
 }
@@ -645,7 +642,7 @@
 void	registerWGlExtensions(CGlExtensions &ext, HDC hDC)
 {
 	// Get proc adress
-	if(!(wglGetExtensionsStringARB=(PFNWGFGETEXTENSIONSSTRINGARB)wglGetProcAddress("wglGetExtensionsStringARB")))
+	if(!(wglGetExtensionsStringARB=(PFNWGFGETEXTENSIONSSTRINGARB)GetProcAddress((const GLubyte *)"wglGetExtensionsStringARB")))
 	{
 		nlwarning ("wglGetExtensionsStringARB not supported");
 		return;
Index: nel/src/3d/driver/opengl/driver_opengl_extension.h
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl_extension.h,v
retrieving revision 1.20
diff -u -r1.20 driver_opengl_extension.h
--- nel/src/3d/driver/opengl/driver_opengl_extension.h	18 Jan 2002 10:08:12 -0000	1.20
+++ nel/src/3d/driver/opengl/driver_opengl_extension.h	7 Feb 2002 00:58:31 -0000
@@ -36,12 +36,10 @@
 
 #else // NL_OS_UNIX
 
-#define	GL_GLEXT_PROTOTYPES
 #include <GL/glx.h>
 
 #endif // NL_OS_UNIX
 
-
 #include <GL/gl.h>
 #include <GL/glext.h>	// Please download it from http://oss.sgi.com/projects/ogl-sample/ABI/"
 
@@ -150,8 +148,6 @@
 
 // ***************************************************************************
 // The exported function names for the windows platform.
-#ifdef NL_OS_WINDOWS
-
 
 // ARB_multitexture
 //=================
@@ -209,8 +205,10 @@
 //====================
 extern PFNGLFLUSHVERTEXARRAYRANGENVPROC		glFlushVertexArrayRangeNV;
 extern PFNGLVERTEXARRAYRANGENVPROC			glVertexArrayRangeNV;
+#ifdef NL_OS_WINDOWS
 extern PFNWGLALLOCATEMEMORYNVPROC			wglAllocateMemoryNV;
 extern PFNWGLFREEMEMORYNVPROC				wglFreeMemoryNV;
+#endif // NL_OS_WINDOWS

 // FenceNV.
@@ -319,6 +317,7 @@
 extern PFNGLSECONDARYCOLORPOINTEREXTPROC	glSecondaryColorPointerEXT;

+#ifdef NL_OS_WINDOWS
 // Pbuffer extension
 //==================
 extern PFNWGLCREATEPBUFFERARBPROC			wglCreatePbufferARB;
@@ -337,9 +336,7 @@
 
 // WGL_ARB_extensions_string
 extern PFNWGFGETEXTENSIONSSTRINGARB			wglGetExtensionsStringARB;
-
-#endif
-
+#endif // NL_OS_WINDOWS
 
 #endif // NL_OPENGL_EXTENSION_H
 
Index: nel/src/3d/driver/opengl/driver_opengl_extension_def.h
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h,v
retrieving revision 1.6
diff -u -r1.6 driver_opengl_extension_def.h
--- nel/src/3d/driver/opengl/driver_opengl_extension_def.h	5 Dec 2001 09:54:38 -0000	1.6
+++ nel/src/3d/driver/opengl/driver_opengl_extension_def.h	7 Feb 2002 00:58:32 -0000
@@ -373,6 +373,7 @@

 /* NV_texture_shader */
+#if GL_GLEXT_VERSION < 9
 #define GL_OFFSET_TEXTURE_RECTANGLE_NV    0x864C
 #define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
 #define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
@@ -447,7 +448,7 @@
 #define GL_TEXTURE_DS_SIZE_NV             0x871D
 #define GL_TEXTURE_DT_SIZE_NV             0x871E
 #define GL_TEXTURE_MAG_SIZE_NV            0x871F
-
+#endif /* GL_GLEXT_VERSION < 9 */

Index: nel/src/3d/driver/opengl/driver_opengl_states.cpp
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp,v
retrieving revision 1.12
diff -u -r1.12 driver_opengl_states.cpp
--- nel/src/3d/driver/opengl/driver_opengl_states.cpp	28 Dec 2001 15:37:02 -0000	1.12
+++ nel/src/3d/driver/opengl/driver_opengl_states.cpp	7 Feb 2002 00:58:32 -0000
@@ -25,7 +25,6 @@
 
 #include "stdopengl.h"
 
-
 // ***************************************************************************
 // define it For Debug purpose only. Normal use is to hide this line
 //#define		NL3D_GLSTATE_DISABLE_CACHE
Index: nel/src/3d/driver/opengl/unix_event_emitter.cpp
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp,v
retrieving revision 1.5
diff -u -r1.5 unix_event_emitter.cpp
--- nel/src/3d/driver/opengl/unix_event_emitter.cpp	13 Dec 2001 18:03:26 -0000	1.5
+++ nel/src/3d/driver/opengl/unix_event_emitter.cpp	7 Feb 2002 00:58:35 -0000
@@ -32,8 +32,6 @@
 
 #include <X11/keysym.h>
 
-#define	GL_GLEXT_PROTOTYPES
-
 #include <GL/gl.h>
 #include <GL/glx.h>
 
Index: nel/src/3d/driver/opengl/unix_event_emitter.h
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/driver/opengl/unix_event_emitter.h,v
retrieving revision 1.2
diff -u -r1.2 unix_event_emitter.h
--- nel/src/3d/driver/opengl/unix_event_emitter.h	8 Feb 2001 10:02:29 -0000	1.2
+++ nel/src/3d/driver/opengl/unix_event_emitter.h	7 Feb 2002 00:58:35 -0000
@@ -31,8 +31,6 @@
 
 #ifdef NL_OS_UNIX
 
-#define	GL_GLEXT_PROTOTYPES
-
 #include <GL/gl.h>
 #include <GL/glx.h>
 
Index: snowballs2/acinclude.m4
===================================================================
RCS file: /home/cvsroot/code/snowballs2/acinclude.m4,v
retrieving revision 1.7
diff -u -r1.7 acinclude.m4
--- snowballs2/acinclude.m4	29 Jan 2002 13:21:42 -0000	1.7
+++ snowballs2/acinclude.m4	7 Feb 2002 00:58:54 -0000
@@ -364,7 +364,12 @@
                           path to the STLPort library files directory.
                           e.g. /usr/local/stlport/lib])
 
-stlport_lib="stlport_gcc"
+if test "$with_debug" = "full"
+then
+	stlport_lib="stlport_gcc_stldebug"
+else
+	stlport_lib="stlport_gcc"
+fi
 
 if test "$with_stlport" = no
 then

---

From: Vincent Caron <[email-masked]>
Date: 07 Feb 2002 18:14:45 +0100

> 	Any kind of help or advice will be welcome.

OK, so we're in a Mesa bug here, NeL is innocent. I had a peek at your
pb since an OpenGL developer has always a tree of Mesa on his HD :)

Looking at src/X/xm_api.c:XMesaCreateContext(), there's a bunch of
initilization that could failed and ar not checked against :

  /* Initialize the software rasterizer and helper modules.
    */
   _swrast_CreateContext( ctx );
   _ac_CreateContext( ctx );
   _tnl_CreateContext( ctx );
   _swsetup_CreateContext( ctx );

   xmesa_register_swrast_functions( ctx );

In our case, _swrast_CreateContext's task is to setup a SWcontext and
let SWRAST_CONTEXT(ctx) point at it. Since
xmesa_register_swrast_functions() fails on a null SWcontext, we guess
something went wrong in _swrast_CreateContext(). If we have a look at
this function in src/swrast/s_context.c, we see a SWcontext creation can
only fail from OOM (out of memory) : callees are CALLOC and
_mesa_alloc_pb which CALLOCs too.

Conclusion : seems you're running out of memory, but I'm pretty
surprised since only small structs are involved during this init. I
guess you should try to step from the call to _swrast_CreateContext() in
xm_api.C to see what's really happening to our SWRAST_CONTEXT(ctx) (or
namely ctx->swrast_context). Then we could decide if we should get in
touch with the Mesa guys.

Hopes this help.

---

From: "Lionel Berenguier" <[email-masked]>
Date: Mon, 11 Feb 2002 16:24:50 +0100

Tank you for this patch.

We have decided to use our own GL extension function declaration (eg: use
NEL_PFNGLACTIVETEXTUREARBPROC instead of PFNGLACTIVETEXTUREARBPROC, and use
nglMultiTexCoord1sARB() instead of glMultiTexCoord1sARB()) to avoid
conflicts with differents version of gl.h  (I think GL extnesion is a mess
here since extensions defined in gl.h do not define function typedef but
still define GL_ARB_multitexture for example).

Cheers

Lionel

----- Original Message -----
From: "Loic Dachary" <[email-masked]>
To: <[email-masked]>
Sent: Thursday, February 07, 2002 2:24 AM
Subject: [Nel] patch to compile on GNU/Linux

> a solution to include them although I can't currently figure out how.
[.....]

---

From: Loic Dachary <[email-masked]>
Date: Mon, 11 Feb 2002 22:58:27 +0100

Hi,

	I do agree that nglMultiTexCoord1sARB() instead of
glMultiTexCoord1sARB() is a good idea. From a strictly technical point
of view this is not really needed, but it's a trap in which we
would fall over and over. Conflicts with the symbols existing in 
the GL library during dynamic linking are tricky enough. However,
I tend to think that renaming all the symbols is not necessary since
we can rely on namespaces to do the job. Simply including the declaration
and definitions in the NL3D namespace gives the same result as renaming
without the trouble of actually changing all functions in the sources.

	Regarding prototypes renaming, I'm not very enthusiastic. Name
clashes are not the main concern. I prefered to add a small stanza in
the acinclude.m4 to detect the problem and define a symbol that allows
the sources to cope with it in a clean way. 

	The patch below summarizes all the changes I've done on the 
nel tree to get it to work (I mean up to the loading landscape segfault
but no more compilation or linking troubles). I think it solves issues
in a reasonable way.

	Patch summary:

	- Define AM_GL_VERIFY to cope with Mesa-3.4.2 & 4.0.1 lossage
	  on multitexture declaration. Gave it a generic name so that
	  we can add more tests if needs be.

	  The following file should be added to the distribution:
code/nel/acconfig.h

	  I also nuked NEL_GL_VERSION_1_2_IN_GL_H since it was supposed
	  to cope with the problem.
	
	- Removed spurious dots in various Makefile.am SUBDIRS declarations

	- Re-generated code/nel/src/3d/Makefile.am SOURCES and added
	  noinst_HEADERS for headers. I never tried to make dist but
	  I suspect there are other issues like this one that would
	  prevent it to succeed.

	- Fixed nel/src/3d/layered_ordering_table.cpp include and then
	  figured it was not finished and therefore not used. Linking
	  proved me right on this one.

	- Fixed scope issues in nel/src/3d/. Typical case is
	  for(int i;;) ; 
	  i = 0;
	  Using "i" must not be used after the loop, its scope is limited
	  to the loop and it may contain an undefined value. Not all compilers
	  bark on this error.

	- nel/src/3d/static_quad_grid.h fixed an unqualified CMatrix

	- Added a 

#ifdef HAVE_CONFIG_H
#include "nelconfig.h"
#endif // HAVE_CONFIG_H

	  to all .cpp files in nel/src/3d/driver/opengl. This is a must,
	  otherwise we might as well drop autoheader and friends ;-)
	  Although redundant it should not be added to headers. 
	
	- Reduced hairy includes. For no particular reason gl.h, glx.h
	  glext.h were included in multiple places. Only the
	  driver_opengl_extension.h includes were kept, other includes
	  were removed.  The is not scrictly needed, I did it because
	  I spent countless minutes figuring out where to look for
	  actual inclusion and pulling my hairs when playing with them
	  had no effect ;-)

	- Defined nelglGetProcAddress as a cpp function in order to 
	  add the necessary (const GLubyte *) cast for GNU/Linux.

	- Include ARB symbols in NL3D namespace.

	Cheers,

-- 
Loic   Dachary         http://www.dachary.org/  [email-masked]
12 bd  Magenta         http://www.senga.org/      [email-masked]
75010    Paris         T: 33 1 42 45 07 97          [email-masked]
        GPG Public Key: http://www.dachary.org/loic/gpg.txt