From 61948d59d77ea8dc6214531379c0321f82f4d237 Mon Sep 17 00:00:00 2001 From: omniavinco Date: Sun, 7 Feb 2016 02:44:35 +0900 Subject: [PATCH] Generate Sources of origin/master updated at Sat Feb 6 17:44:35 GMT 2016 --- doc/glew.html | 353 ++++++++++++++++++++++----------------------- include/GL/eglew.h | 205 ++++++++++++++++++++++++++ include/GL/glew.h | 34 +---- include/GL/glxew.h | 16 +- include/GL/wglew.h | 15 +- src/glew.c | 153 ++++++++++++++++---- src/glewinfo.c | 223 +++++++++++++++++++++++++--- 7 files changed, 722 insertions(+), 277 deletions(-) create mode 100644 include/GL/eglew.h diff --git a/doc/glew.html b/doc/glew.html index 55d54df..6d341aa 100644 --- a/doc/glew.html +++ b/doc/glew.html @@ -494,198 +494,195 @@ THE POSSIBILITY OF SUCH DAMAGE. 377 MESA_window_pos 378 MESA_ycbcr_texture
-394 NVX_conditional_render -395 NVX_gpu_memory_info -396 NVX_linked_gpu_multicast +379 NVX_conditional_render +380 NVX_gpu_memory_info
-397 NV_bindless_multi_draw_indirect -398 NV_bindless_multi_draw_indirect_count -399 NV_bindless_texture -400 NV_blend_equation_advanced -401 NV_blend_equation_advanced_coherent -402 NV_blend_square -403 NV_command_list -404 NV_compute_program5 -405 NV_conditional_render -406 NV_conservative_raster -407 NV_conservative_raster_dilate -408 NV_copy_depth_to_color -409 NV_copy_image -410 NV_deep_texture3D -411 NV_depth_buffer_float -412 NV_depth_clamp -413 NV_depth_range_unclamped -414 NV_draw_texture -415 NV_evaluators -416 NV_explicit_multisample -417 NV_fence -418 NV_fill_rectangle -419 NV_float_buffer -420 NV_fog_distance -421 NV_fragment_coverage_to_color -422 NV_fragment_program -423 NV_fragment_program2 -424 NV_fragment_program4 -425 NV_fragment_program_option -426 NV_fragment_shader_interlock -427 NV_framebuffer_mixed_samples -428 NV_framebuffer_multisample_coverage -429 NV_geometry_program4 -430 NV_geometry_shader4 -431 NV_geometry_shader_passthrough -432 NV_gpu_program4 -433 NV_gpu_program5 -434 NV_gpu_program5_mem_extended -435 NV_gpu_program_fp64 -436 NV_gpu_shader5 -437 NV_half_float -438 NV_internalformat_sample_query -439 NV_light_max_exponent -440 NV_multisample_coverage -441 NV_multisample_filter_hint -442 NV_occlusion_query -443 NV_packed_depth_stencil -444 NV_parameter_buffer_object -445 NV_parameter_buffer_object2 -446 NV_path_rendering -447 NV_path_rendering_shared_edge -448 NV_pixel_data_range -449 NV_point_sprite -450 NV_present_video -451 NV_primitive_restart -452 NV_register_combiners -453 NV_register_combiners2 -454 NV_sample_locations -455 NV_sample_mask_override_coverage -456 NV_shader_atomic_counters -457 NV_shader_atomic_float -458 NV_shader_atomic_fp16_vector -459 NV_shader_atomic_int64 -460 NV_shader_buffer_load -461 NV_shader_storage_buffer_object -462 NV_shader_thread_group -463 NV_shader_thread_shuffle -464 NV_tessellation_program5 -465 NV_texgen_emboss -466 NV_texgen_reflection -467 NV_texture_barrier -468 NV_texture_compression_vtc -469 NV_texture_env_combine4 -470 NV_texture_expand_normal -471 NV_texture_multisample -472 NV_texture_rectangle -473 NV_texture_shader -474 NV_texture_shader2 -475 NV_texture_shader3 -476 NV_transform_feedback -477 NV_transform_feedback2 -478 NV_uniform_buffer_unified_memory -479 NV_vdpau_interop -480 NV_vertex_array_range -481 NV_vertex_array_range2 -482 NV_vertex_attrib_integer_64bit -483 NV_vertex_buffer_unified_memory -484 NV_vertex_program -485 NV_vertex_program1_1 -486 NV_vertex_program2 -487 NV_vertex_program2_option -488 NV_vertex_program3 -489 NV_vertex_program4 -490 NV_video_capture -491 NV_viewport_array2 +381 NV_bindless_multi_draw_indirect +382 NV_bindless_multi_draw_indirect_count +383 NV_bindless_texture +384 NV_blend_equation_advanced +385 NV_blend_equation_advanced_coherent +386 NV_blend_square +387 NV_compute_program5 +388 NV_conditional_render +389 NV_conservative_raster +390 NV_copy_depth_to_color +391 NV_copy_image +392 NV_deep_texture3D +393 NV_depth_buffer_float +394 NV_depth_clamp +395 NV_depth_range_unclamped +396 NV_draw_texture +397 NV_evaluators +398 NV_explicit_multisample +399 NV_fence +400 NV_fill_rectangle +401 NV_float_buffer +402 NV_fog_distance +403 NV_fragment_coverage_to_color +404 NV_fragment_program +405 NV_fragment_program2 +406 NV_fragment_program4 +407 NV_fragment_program_option +408 NV_fragment_shader_interlock +409 NV_framebuffer_mixed_samples +410 NV_framebuffer_multisample_coverage +411 NV_geometry_program4 +412 NV_geometry_shader4 +413 NV_geometry_shader_passthrough +414 NV_gpu_program4 +415 NV_gpu_program5 +416 NV_gpu_program5_mem_extended +417 NV_gpu_program_fp64 +418 NV_gpu_shader5 +419 NV_half_float +420 NV_internalformat_sample_query +421 NV_light_max_exponent +422 NV_multisample_coverage +423 NV_multisample_filter_hint +424 NV_occlusion_query +425 NV_packed_depth_stencil +426 NV_parameter_buffer_object +427 NV_parameter_buffer_object2 +428 NV_path_rendering +429 NV_path_rendering_shared_edge +430 NV_pixel_data_range +431 NV_point_sprite +432 NV_present_video +433 NV_primitive_restart +434 NV_register_combiners +435 NV_register_combiners2 +436 NV_sample_locations +437 NV_sample_mask_override_coverage +438 NV_shader_atomic_counters +439 NV_shader_atomic_float +440 NV_shader_atomic_fp16_vector +441 NV_shader_atomic_int64 +442 NV_shader_buffer_load +443 NV_shader_storage_buffer_object +444 NV_shader_thread_group +445 NV_shader_thread_shuffle +446 NV_tessellation_program5 +447 NV_texgen_emboss +448 NV_texgen_reflection +449 NV_texture_barrier +450 NV_texture_compression_vtc +451 NV_texture_env_combine4 +452 NV_texture_expand_normal +453 NV_texture_multisample +454 NV_texture_rectangle +455 NV_texture_shader +456 NV_texture_shader2 +457 NV_texture_shader3 +458 NV_transform_feedback +459 NV_transform_feedback2 +460 NV_uniform_buffer_unified_memory +461 NV_vdpau_interop +462 NV_vertex_array_range +463 NV_vertex_array_range2 +464 NV_vertex_attrib_integer_64bit +465 NV_vertex_buffer_unified_memory +466 NV_vertex_program +467 NV_vertex_program1_1 +468 NV_vertex_program2 +469 NV_vertex_program2_option +470 NV_vertex_program3 +471 NV_vertex_program4 +472 NV_video_capture +473 NV_viewport_array2
-492 OES_byte_coordinates -493 OES_compressed_paletted_texture -494 OES_read_format -495 OES_single_precision +474 OES_byte_coordinates +475 OES_compressed_paletted_texture +476 OES_read_format +477 OES_single_precision
-496 OML_interlace -497 OML_resample -498 OML_subsample +478 OML_interlace +479 OML_resample +480 OML_subsample
-499 OVR_multiview -500 OVR_multiview2 +481 OVR_multiview +482 OVR_multiview2
-501 PGI_misc_hints -502 PGI_vertex_hints +483 PGI_misc_hints +484 PGI_vertex_hints
-503 REGAL_ES1_0_compatibility -504 REGAL_ES1_1_compatibility -505 REGAL_enable -506 REGAL_error_string -507 REGAL_extension_query -508 REGAL_log -509 REGAL_proc_address +485 REGAL_ES1_0_compatibility +486 REGAL_ES1_1_compatibility +487 REGAL_enable +488 REGAL_error_string +489 REGAL_extension_query +490 REGAL_log +491 REGAL_proc_address
-510 REND_screen_coordinates +492 REND_screen_coordinates
-511 S3_s3tc +493 S3_s3tc
-512 SGIS_color_range -513 SGIS_detail_texture -514 SGIS_fog_function -515 SGIS_generate_mipmap -516 SGIS_multisample -517 SGIS_pixel_texture -518 SGIS_point_line_texgen -519 SGIS_sharpen_texture -520 SGIS_texture4D -521 SGIS_texture_border_clamp -522 SGIS_texture_edge_clamp -523 SGIS_texture_filter4 -524 SGIS_texture_lod -525 SGIS_texture_select +494 SGIS_color_range +495 SGIS_detail_texture +496 SGIS_fog_function +497 SGIS_generate_mipmap +498 SGIS_multisample +499 SGIS_pixel_texture +500 SGIS_point_line_texgen +501 SGIS_sharpen_texture +502 SGIS_texture4D +503 SGIS_texture_border_clamp +504 SGIS_texture_edge_clamp +505 SGIS_texture_filter4 +506 SGIS_texture_lod +507 SGIS_texture_select
-526 SGIX_async -527 SGIX_async_histogram -528 SGIX_async_pixel -529 SGIX_blend_alpha_minmax -530 SGIX_clipmap -531 SGIX_convolution_accuracy -532 SGIX_depth_texture -533 SGIX_flush_raster -534 SGIX_fog_offset -535 SGIX_fog_texture -536 SGIX_fragment_specular_lighting -537 SGIX_framezoom -538 SGIX_interlace -539 SGIX_ir_instrument1 -540 SGIX_list_priority -541 SGIX_pixel_texture -542 SGIX_pixel_texture_bits -543 SGIX_reference_plane -544 SGIX_resample -545 SGIX_shadow -546 SGIX_shadow_ambient -547 SGIX_sprite -548 SGIX_tag_sample_buffer -549 SGIX_texture_add_env -550 SGIX_texture_coordinate_clamp -551 SGIX_texture_lod_bias -552 SGIX_texture_multi_buffer -553 SGIX_texture_range -554 SGIX_texture_scale_bias -555 SGIX_vertex_preclip -556 SGIX_vertex_preclip_hint -557 SGIX_ycrcb +508 SGIX_async +509 SGIX_async_histogram +510 SGIX_async_pixel +511 SGIX_blend_alpha_minmax +512 SGIX_clipmap +513 SGIX_convolution_accuracy +514 SGIX_depth_texture +515 SGIX_flush_raster +516 SGIX_fog_offset +517 SGIX_fog_texture +518 SGIX_fragment_specular_lighting +519 SGIX_framezoom +520 SGIX_interlace +521 SGIX_ir_instrument1 +522 SGIX_list_priority +523 SGIX_pixel_texture +524 SGIX_pixel_texture_bits +525 SGIX_reference_plane +526 SGIX_resample +527 SGIX_shadow +528 SGIX_shadow_ambient +529 SGIX_sprite +530 SGIX_tag_sample_buffer +531 SGIX_texture_add_env +532 SGIX_texture_coordinate_clamp +533 SGIX_texture_lod_bias +534 SGIX_texture_multi_buffer +535 SGIX_texture_range +536 SGIX_texture_scale_bias +537 SGIX_vertex_preclip +538 SGIX_vertex_preclip_hint +539 SGIX_ycrcb
-558 SGI_color_matrix -559 SGI_color_table -560 SGI_texture_color_table +540 SGI_color_matrix +541 SGI_color_table +542 SGI_texture_color_table
-561 SUNX_constant_data +543 SUNX_constant_data
-562 SUN_convolution_border_modes -563 SUN_global_alpha -564 SUN_mesh_array -565 SUN_read_video_pixels -566 SUN_slice_accum -567 SUN_triangle_list -568 SUN_vertex +544 SUN_convolution_border_modes +545 SUN_global_alpha +546 SUN_mesh_array +547 SUN_read_video_pixels +548 SUN_slice_accum +549 SUN_triangle_list +550 SUN_vertex
-569 WIN_phong_shading -570 WIN_specular_fog -571 WIN_swap_hint +551 WIN_phong_shading +552 WIN_specular_fog +553 WIN_swap_hint diff --git a/include/GL/eglew.h b/include/GL/eglew.h new file mode 100644 index 0000000..d74e048 --- /dev/null +++ b/include/GL/eglew.h @@ -0,0 +1,205 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2008-2015, Nigel Stewart +** Copyright (C) 2002-2008, Milan Ikits +** Copyright (C) 2002-2008, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Mesa 3-D graphics library + * Version: 7.0 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __eglew_h__ +#define __eglew_h__ +#define __EGLEW_H__ + +#ifdef __eglext_h_ +#error eglext.h included before eglew.h +#endif + +#if defined(__egl_h_) +#error egl.h included before eglew.h +#endif + +#define __eglext_h_ + +#define __egl_h_ + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY +#endif +#ifndef EGLAPI +#define EGLAPI extern +#endif + +/* EGL Types */ +#include + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int32_t EGLint; + +typedef unsigned int EGLBoolean; +typedef void *EGLDisplay; +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; +typedef void (*__eglMustCastToProperFunctionPointerType)(void); + +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; + +typedef void *EGLSync; +typedef intptr_t EGLAttrib; +typedef khronos_utime_nanoseconds_t EGLTime; +typedef void *EGLImage; + +typedef void *EGLSyncKHR; +typedef intptr_t EGLAttribKHR; +typedef void *EGLLabelKHR; +typedef void *EGLObjectKHR; +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); +typedef khronos_utime_nanoseconds_t EGLTimeKHR; +typedef void *EGLImageKHR; +typedef void *EGLStreamKHR; +typedef khronos_uint64_t EGLuint64KHR; +typedef int EGLNativeFileDescriptorKHR; +typedef khronos_ssize_t EGLsizeiANDROID; +typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); +typedef void *EGLDeviceEXT; +typedef void *EGLOutputLayerEXT; +typedef void *EGLOutputPortEXT; +typedef void *EGLSyncNV; +typedef khronos_utime_nanoseconds_t EGLTimeNV; +typedef khronos_utime_nanoseconds_t EGLuint64NV; + +struct EGLClientPixmapHI; + +#define EGL_DONT_CARE ((EGLint)-1) + +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_IMAGE ((EGLImage)0) +#define EGL_NO_SURFACE ((EGLSurface)0) +#define EGL_NO_SYNC ((EGLSync)0) + +#define EGL_UNKNOWN ((EGLint)-1) + +#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) + +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); +/* ------------------------------------ ----------------------------------- */ + +#ifndef +#define 1 + +#define EGLEW_GET_VAR() + +#endif /* */ + +/* ------------------------------------ ----------------------------------- */ + +#ifndef +#define 1 + +#define EGLEW_GET_VAR() + +#endif /* */ + +/* ------------------------------------------------------------------------- */ + +#define EGLEW_FUN_EXPORT GLEW_FUN_EXPORT +#define EGLEW_VAR_EXPORT GLEW_VAR_EXPORT +EGLEW_VAR_EXPORT GLboolean ; +EGLEW_VAR_EXPORT GLboolean ; +/* ------------------------------------------------------------------------ */ + +GLEWAPI GLenum GLEWAPIENTRY eglewInit (EGLDisplay display); +GLEWAPI GLboolean GLEWAPIENTRY eglewIsSupported (const char *name); + +#define EGLEW_GET_VAR(x) (*(const GLboolean*)&x) +#define EGLEW_GET_FUN(x) x + +GLEWAPI GLboolean GLEWAPIENTRY eglewGetExtension (const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* __eglew_h__ */ diff --git a/include/GL/glew.h b/include/GL/glew.h index 3b152b8..608fa2e 100644 --- a/include/GL/glew.h +++ b/include/GL/glew.h @@ -263,6 +263,9 @@ typedef _W64 int ptrdiff_t; #define GLEWAPIENTRY #endif +#define GLEW_VAR_EXPORT GLEWAPI +#define GLEW_FUN_EXPORT GLEWAPI + #ifdef __cplusplus extern "C" { #endif @@ -15498,22 +15501,7 @@ typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, /* ------------------------------------------------------------------------- */ -#if defined(GLEW_MX) && defined(_WIN32) -#define GLEW_FUN_EXPORT -#else -#define GLEW_FUN_EXPORT GLEWAPI -#endif /* GLEW_MX */ -#if defined(GLEW_MX) -#define GLEW_VAR_EXPORT -#else -#define GLEW_VAR_EXPORT GLEWAPI -#endif /* GLEW_MX */ - -#if defined(GLEW_MX) && defined(_WIN32) -struct GLEWContextStruct -{ -#endif /* GLEW_MX */ GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D; GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements; @@ -18030,12 +18018,6 @@ GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fCo GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN; - -#if defined(GLEW_MX) && !defined(_WIN32) -struct GLEWContextStruct -{ -#endif /* GLEW_MX */ - GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1; @@ -18607,11 +18589,6 @@ GLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; - -#ifdef GLEW_MX -}; /* GLEWContextStruct */ -#endif /* GLEW_MX */ - /* ------------------------------------------------------------------------- */ /* error codes */ @@ -18643,8 +18620,13 @@ GLEWAPI GLenum GLEWAPIENTRY glewInit (void); GLEWAPI GLboolean GLEWAPIENTRY glewIsSupported (const char *name); #define glewIsExtensionSupported(x) glewIsSupported(x) +#ifndef GLEW_GET_VAR #define GLEW_GET_VAR(x) (*(const GLboolean*)&x) +#endif + +#ifndef GLEW_GET_FUN #define GLEW_GET_FUN(x) x +#endif GLEWAPI GLboolean glewExperimental; GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name); diff --git a/include/GL/glxew.h b/include/GL/glxew.h index 992fcaf..e5addda 100644 --- a/include/GL/glxew.h +++ b/include/GL/glxew.h @@ -1509,12 +1509,6 @@ GLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI; GLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN; GLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN; - -#if defined(GLEW_MX) -struct GLXEWContextStruct -{ -#endif /* GLEW_MX */ - GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0; GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1; GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2; @@ -1585,18 +1579,18 @@ GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync; GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index; GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize; - -#ifdef GLEW_MX -}; /* GLXEWContextStruct */ -#endif /* GLEW_MX */ - /* ------------------------------------------------------------------------ */ GLEWAPI GLenum GLEWAPIENTRY glxewInit (); GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name); +#ifndef GLXEW_GET_VAR #define GLXEW_GET_VAR(x) (*(const GLboolean*)&x) +#endif + +#ifndef GLXEW_GET_FUN #define GLXEW_GET_FUN(x) x +#endif GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name); diff --git a/include/GL/wglew.h b/include/GL/wglew.h index af7b5f4..380b58e 100644 --- a/include/GL/wglew.h +++ b/include/GL/wglew.h @@ -1116,11 +1116,6 @@ typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT6 #define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT #define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT -#ifdef GLEW_MX -struct WGLEWContextStruct -{ -#endif /* GLEW_MX */ - WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD; @@ -1307,18 +1302,18 @@ WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output; WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control; - -#ifdef GLEW_MX -}; /* WGLEWContextStruct */ -#endif /* GLEW_MX */ - /* ------------------------------------------------------------------------- */ GLEWAPI GLenum GLEWAPIENTRY wglewInit (); GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); +#ifndef WGLEW_GET_VAR #define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) +#endif + +#ifndef WGLEW_GET_FUN #define WGLEW_GET_FUN(x) x +#endif GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); diff --git a/src/glew.c b/src/glew.c index 576f70b..abe41ad 100644 --- a/src/glew.c +++ b/src/glew.c @@ -35,6 +35,8 @@ #if defined(GLEW_OSMESA) # define GLAPI extern # include +#elif defined(GLEW_EGL) +# include #elif defined(_WIN32) # include #elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) @@ -45,7 +47,8 @@ #include /* For bsearch */ #include /* For memset */ -#if defined(GLEW_REGAL) +#if defined(GLEW_EGL) +#elif defined(GLEW_REGAL) /* In GLEW_REGAL mode we call direcly into the linked libRegal.so glGetProcAddressREGAL for looking up @@ -149,6 +152,8 @@ void* NSGLGetProcAddress (const GLubyte *name) # define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name) #elif defined(GLEW_OSMESA) # define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name) +#elif defined(GLEW_EGL) +# define glewGetProcAddress(name) eglGetProcAddress((const char *)name) #elif defined(_WIN32) # define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) @@ -180,6 +185,11 @@ void* NSGLGetProcAddress (const GLubyte *name) # define GLXEW_GET_VAR(x) (x) #endif /* GLXEW_GET_VAR */ +#ifdef EGLEW_GET_VAR +# undef EGLEW_GET_VAR +# define EGLEW_GET_VAR(x) (x) +#endif /* EGLEW_GET_VAR */ + /* * GLEW, just like OpenGL or GLU, does not rely on the standard C library. * These functions implement the functionality required in this file. @@ -300,8 +310,6 @@ static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, c #endif #endif -#if !defined(_WIN32) || !defined(GLEW_MX) - PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL; PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL; PFNGLTEXIMAGE3DPROC __glewTexImage3D = NULL; @@ -2818,10 +2826,6 @@ PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVe PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN = NULL; PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN = NULL; -#endif /* !WIN32 || !GLEW_MX */ - -#if !defined(GLEW_MX) - GLboolean __GLEW_VERSION_1_1 = GL_FALSE; GLboolean __GLEW_VERSION_1_2 = GL_FALSE; GLboolean __GLEW_VERSION_1_2_1 = GL_FALSE; @@ -3394,9 +3398,6 @@ GLboolean __GLEW_WIN_phong_shading = GL_FALSE; GLboolean __GLEW_WIN_specular_fog = GL_FALSE; GLboolean __GLEW_WIN_swap_hint = GL_FALSE; -#endif /* !GLEW_MX */ - - static const char * _glewExtensionLookup[] = { #ifdef GL_VERSION_1_2 "GL_VERSION_1_2", @@ -5111,8 +5112,6 @@ static const char * _glewExtensionLookup[] = { NULL }; - -#if !defined(GLEW_MX) /* Detected in the extension string or strings */ static GLboolean _glewExtensionString[570]; /* Detected via extension string or experimental mode */ @@ -6829,9 +6828,6 @@ static GLboolean* _glewExtensionEnabled[] = { #endif NULL }; - -#endif /* !GLEW_MX */ - static GLboolean _glewInit_GL_VERSION_1_2 (); static GLboolean _glewInit_GL_VERSION_1_3 (); static GLboolean _glewInit_GL_VERSION_1_4 (); @@ -16772,14 +16768,22 @@ GLboolean GLEWAPIENTRY glewGetExtension (const char* name) /* ------------------------------------------------------------------------- */ +typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGPROC) (GLenum name); +typedef void (GLAPIENTRY * PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params); + static GLenum GLEWAPIENTRY glewContextInit () { + PFNGLGETSTRINGPROC getString; const GLubyte* s; GLuint dot; GLint major, minor; /* query opengl version */ - s = glGetString(GL_VERSION); + getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString"); + if (!getString) + return GLEW_ERROR_NO_GL_VERSION; + + s = getString(GL_VERSION); dot = _glewStrCLen(s, '.'); if (dot == 0) return GLEW_ERROR_NO_GL_VERSION; @@ -16824,11 +16828,14 @@ static GLenum GLEWAPIENTRY glewContextInit () { GLint n = 0; GLint i; + PFNGLGETINTEGERVPROC getIntegerv; PFNGLGETSTRINGIPROC getStringi; const char *ext; GLboolean *enable; - glGetIntegerv(GL_NUM_EXTENSIONS, &n); + getIntegerv = (PFNGLGETINTEGERVPROC) glewGetProcAddress((const GLubyte*)"glGetIntegerv"); + if (getIntegerv) + getIntegerv(GL_NUM_EXTENSIONS, &n); /* glGetStringi is OpenGL 3.0 */ getStringi = (PFNGLGETSTRINGIPROC) glewGetProcAddress((const GLubyte*)"glGetStringi"); @@ -16857,7 +16864,7 @@ static GLenum GLEWAPIENTRY glewContextInit () char ext[128]; GLboolean *enable; - extensions = (const char *) glGetString(GL_EXTENSIONS); + extensions = (const char *) getString(GL_EXTENSIONS); if (extensions) { @@ -17657,9 +17664,61 @@ static GLenum GLEWAPIENTRY glewContextInit () } -#if defined(_WIN32) && ! defined(GLEW_OSMESA) +#if defined(GLEW_OSMESA) -#if !defined(GLEW_MX) +#elif defined(GLEW_EGL) +GLboolean = GL_FALSE; +GLboolean = GL_FALSE; + /* ------------------------------------------------------------------------ */ + +GLboolean eglewGetExtension (const char* name) +{ + const GLubyte* start; + const GLubyte* end; + + start = (const GLubyte*) eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS); + if (0 == start) return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +GLenum eglewInit (EGLDisplay display) +{ + EGLint major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; + PFNEGLINITIALIZEPROC initialize = NULL; + PFNEGLQUERYSTRINGPROC queryString = NULL; + + /* Load necessary entry points */ + initialize = (PFNEGLINITIALIZEPROC) glewGetProcAddress("eglInitialize"); + queryString = (PFNEGLQUERYSTRINGPROC) glewGetProcAddress("eglQueryString"); + if (!initialize || !queryString) + return 1; + + /* query EGK version */ + if (initialize(display, &major, &minor) != EGL_TRUE) + return 1; + + EGLEW_VERSION_1_5 = ( major > 1 ) || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_4 = EGLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_3 = EGLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_2 = EGLEW_VERSION_1_3 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_1 = EGLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_0 = EGLEW_VERSION_1_1 == GL_TRUE || ( major == 1 && minor >= 0 ) ? GL_TRUE : GL_FALSE; + + /* query EGL extension string */ + extStart = (const GLubyte*) queryString(display, EGL_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte *)""; + extEnd = extStart + _glewStrLen(extStart); + + /* initialize extensions */ + + return GLEW_OK; +} + +#elif defined(_WIN32) PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL; @@ -17847,9 +17906,6 @@ GLboolean __WGLEW_NV_vertex_array_range = GL_FALSE; GLboolean __WGLEW_NV_video_capture = GL_FALSE; GLboolean __WGLEW_NV_video_output = GL_FALSE; GLboolean __WGLEW_OML_sync_control = GL_FALSE; - -#endif /* !GLEW_MX */ - #ifdef WGL_3DFX_multisample static GLboolean _glewInit_WGL_3DFX_multisample () @@ -19014,7 +19070,7 @@ GLenum GLEWAPIENTRY wglewInit () return GLEW_OK; } -#elif !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay = NULL; @@ -19139,8 +19195,6 @@ PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI = NULL; PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN = NULL; PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN = NULL; -#if !defined(GLEW_MX) - GLboolean __GLXEW_VERSION_1_0 = GL_FALSE; GLboolean __GLXEW_VERSION_1_1 = GL_FALSE; GLboolean __GLXEW_VERSION_1_2 = GL_FALSE; @@ -19211,9 +19265,6 @@ GLboolean __GLXEW_SGI_swap_control = GL_FALSE; GLboolean __GLXEW_SGI_video_sync = GL_FALSE; GLboolean __GLXEW_SUN_get_transparent_index = GL_FALSE; GLboolean __GLXEW_SUN_video_resize = GL_FALSE; - -#endif /* !GLEW_MX */ - #ifdef GLX_VERSION_1_2 static GLboolean _glewInit_GLX_VERSION_1_2 () @@ -20709,9 +20760,15 @@ GLboolean glewExperimental = GL_FALSE; GLenum GLEWAPIENTRY glewInit (void) { GLenum r; +#if defined(GLEW_EGL) + PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL; +#endif r = glewContextInit(); if ( r != 0 ) return r; -#if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__) +#if defined(GLEW_EGL) + getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay"); + return eglewInit(getCurrentDisplay()); +#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__) return r; #elif defined(_WIN32) return wglewInit(); @@ -24825,7 +24882,7 @@ GLboolean GLEWAPIENTRY glewIsSupported (const char* name) return ret; } -#if defined(_WIN32) && !defined(GLEW_OSMESA) +#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA) GLboolean GLEWAPIENTRY wglewIsSupported (const char* name) { @@ -25247,7 +25304,7 @@ GLboolean GLEWAPIENTRY wglewIsSupported (const char* name) return ret; } -#elif !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) +#elif !defined(GLEW_OSMESA) && !defined(GLEW_EGL) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) GLboolean glxewIsSupported (const char* name) { @@ -25782,4 +25839,36 @@ GLboolean glxewIsSupported (const char* name) return ret; } +#elif defined(GLEW_EGL) + +GLboolean eglewIsSupported (const char* name) +{ + const GLubyte* pos = (const GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if(_glewStrSame1(&pos, &len, (const GLubyte*)"EGL_", 4)) + { +#ifdef + if (_glewStrSame3(&pos, &len, (const GLubyte*)"", )) + { + ret = ; + continue; + } +#endif +#ifdef + if (_glewStrSame3(&pos, &len, (const GLubyte*)"", )) + { + ret = ; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + #endif /* _WIN32 */ diff --git a/src/glewinfo.c b/src/glewinfo.c index c6fb6b8..efbdf90 100644 --- a/src/glewinfo.c +++ b/src/glewinfo.c @@ -34,7 +34,9 @@ #include #include #include -#if defined(GLEW_OSMESA) +#if defined(GLEW_EGL) +#include +#elif defined(GLEW_OSMESA) #define GLAPI extern #include #elif defined(_WIN32) @@ -58,6 +60,7 @@ static FILE* f; struct createParams { #if defined(GLEW_OSMESA) +#elif defined(GLEW_EGL) #elif defined(_WIN32) int pixelformat; #elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX) @@ -7763,7 +7766,27 @@ static void _glewInfo_GL_WIN_swap_hint (void) #endif /* GL_WIN_swap_hint */ -#ifdef _WIN32 +#if defined(GLEW_EGL) + +#ifdef + +static void _glewInfo_ (void) +{ + glewPrintExt("", , ewIsSupported(""), ewGetExtension("")); +} + +#endif /* */ + +#ifdef + +static void _glewInfo_ (void) +{ + glewPrintExt("", , ewIsSupported(""), ewGetExtension("")); +} + +#endif /* */ + +#elif _WIN32 #ifdef WGL_3DFX_multisample @@ -10844,7 +10867,7 @@ static void glewInfo (void) /* ------------------------------------------------------------------------ */ -#if defined(_WIN32) && !defined(GLEW_OSMESA) +#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA) static void wglewInfo () { @@ -11012,7 +11035,7 @@ static void wglewInfo () #endif /* WGL_OML_sync_control */ } -#elif !defined(GLEW_OSMESA) /* _UNIX */ +#elif !defined(GLEW_EGL) && !defined(GLEW_OSMESA) /* _UNIX */ static void glxewInfo () { @@ -11222,6 +11245,18 @@ static void glxewInfo () #endif /* GLX_SUN_video_resize */ } +#elif defined(GLEW_EGL) + +static void eglewInfo () +{ +#ifdef + _glewInfo_(); +#endif /* */ +#ifdef + _glewInfo_(); +#endif /* */ +} + #endif /* _WIN32 */ /* ------------------------------------------------------------------------ */ @@ -11229,9 +11264,10 @@ static void glxewInfo () int main (int argc, char** argv) { GLuint err; - struct createParams params = + struct createParams params = { #if defined(GLEW_OSMESA) +#elif defined(GLEW_EGL) #elif defined(_WIN32) -1, /* pixelformat */ #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) @@ -11244,20 +11280,26 @@ int main (int argc, char** argv) 0 /* flags */ }; +#if defined(GLEW_EGL) + typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGPROC) (GLenum name); + PFNGLGETSTRINGPROC getString; +#endif + if (glewParseArgs(argc-1, argv+1, ¶ms)) { fprintf(stderr, "Usage: glewinfo " #if defined(GLEW_OSMESA) +#elif defined(GLEW_EGL) #elif defined(_WIN32) - "[-pf ] " + "[-pf ] " #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) - "[-display ] " - "[-visual ] " + "[-display ] " + "[-visual ] " #endif - "[-version ] " - "[-profile core|compatibility] " - "[-flag debug|forward]" - "\n"); + "[-version ] " + "[-profile core|compatibility] " + "[-flag debug|forward]" + "\n"); return 1; } @@ -11275,6 +11317,17 @@ int main (int argc, char** argv) glewDestroyContext(); return 1; } + +#if defined(GLEW_EGL) + getString = (PFNGLGETSTRINGPROC) eglGetProcAddress("glGetString"); + if (!getString) + { + fprintf(stderr, "Error: eglGetProcAddress failed to fetch glGetString\n"); + glewDestroyContext(); + return 1; + } +#endif + #if defined(_WIN32) #if defined(_MSC_VER) && (_MSC_VER >= 1400) if (fopen_s(&f, "glewinfo.txt", "w") != 0) @@ -11291,17 +11344,26 @@ int main (int argc, char** argv) fprintf(f, "---------------------------\n\n"); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); #if defined(GLEW_OSMESA) +#elif defined(GLEW_EGL) #elif defined(_WIN32) fprintf(f, "Reporting capabilities of pixelformat %d\n", params.pixelformat); #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) - fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", + fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", params.display == NULL ? getenv("DISPLAY") : params.display, params.visual); #endif - fprintf(f, "Running on a %s from %s\n", - glGetString(GL_RENDERER), glGetString(GL_VENDOR)); +#if defined(GLEW_EGL) + fprintf(f, "Running on a %s from %s\n", + getString(GL_RENDERER), getString(GL_VENDOR)); + fprintf(f, "OpenGL version %s is supported\n", getString(GL_VERSION)); +#else + fprintf(f, "Running on a %s from %s\n", + glGetString(GL_RENDERER), glGetString(GL_VENDOR)); fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION)); +#endif glewInfo(); #if defined(GLEW_OSMESA) +#elif defined(GLEW_EGL) + eglewInfo(); #elif defined(_WIN32) wglewInfo(); #else @@ -11341,6 +11403,7 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params) ++p; } #if defined(GLEW_OSMESA) +#elif defined(GLEW_EGL) #elif defined(_WIN32) else if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat")) { @@ -11352,7 +11415,7 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params) { if (++p >= argc) return GL_TRUE; params->display = argv[p++]; - } + } else if (!strcmp(argv[p], "-visual")) { if (++p >= argc) return GL_TRUE; @@ -11367,7 +11430,127 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params) /* ------------------------------------------------------------------------ */ -#if defined(GLEW_OSMESA) +#if defined(GLEW_EGL) +EGLDisplay display; +EGLContext ctx; + +/* See: http://stackoverflow.com/questions/12662227/opengl-es2-0-offscreen-context-for-fbo-rendering */ + +GLboolean glewCreateContext (struct createParams *params) +{ + EGLDeviceEXT devices[1]; + EGLint numDevices; + EGLSurface surface; + EGLint majorVersion, minorVersion; + EGLint configAttribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RED_SIZE, 1, + EGL_GREEN_SIZE, 1, + EGL_BLUE_SIZE, 1, + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, + EGL_NONE + }; + static const EGLint contextAttribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + static const EGLint pBufferAttribs[] = { + EGL_WIDTH, 128, + EGL_HEIGHT, 128, + EGL_NONE + }; + EGLConfig config; + EGLint numConfig; + EGLBoolean pBuffer; + + PFNEGLQUERYDEVICESEXTPROC queryDevices = NULL; + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay = NULL; + PFNEGLGETERRORPROC getError = NULL; + PFNEGLGETDISPLAYPROC getDisplay = NULL; + PFNEGLINITIALIZEPROC initialize = NULL; + PFNEGLBINDAPIPROC bindAPI = NULL; + PFNEGLCHOOSECONFIGPROC chooseConfig = NULL; + PFNEGLCREATEWINDOWSURFACEPROC createWindowSurface = NULL; + PFNEGLCREATECONTEXTPROC createContext = NULL; + PFNEGLMAKECURRENTPROC makeCurrent = NULL; + PFNEGLCREATEPBUFFERSURFACEPROC createPbufferSurface = NULL; + + /* Load necessary entry points */ + queryDevices = (PFNEGLQUERYDEVICESEXTPROC) eglGetProcAddress("eglQueryDevicesEXT"); + getPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYEXTPROC) eglGetProcAddress("eglGetPlatformDisplayEXT"); + getError = (PFNEGLGETERRORPROC) eglGetProcAddress("eglGetError"); + getDisplay = (PFNEGLGETDISPLAYPROC) eglGetProcAddress("eglGetDisplay"); + initialize = (PFNEGLINITIALIZEPROC) eglGetProcAddress("eglInitialize"); + bindAPI = (PFNEGLBINDAPIPROC) eglGetProcAddress("eglBindAPI"); + chooseConfig = (PFNEGLCHOOSECONFIGPROC) eglGetProcAddress("eglChooseConfig"); + createWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC) eglGetProcAddress("eglCreateWindowSurface"); + createPbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC) eglGetProcAddress("eglCreatePbufferSurface"); + createContext = (PFNEGLCREATECONTEXTPROC) eglGetProcAddress("eglCreateContext"); + makeCurrent = (PFNEGLMAKECURRENTPROC) eglGetProcAddress("eglMakeCurrent"); + if (!getError || !getDisplay || !initialize || !bindAPI || !chooseConfig || !createWindowSurface || !createContext || !makeCurrent) + return GL_TRUE; + + pBuffer = 0; + display = EGL_NO_DISPLAY; + if (queryDevices && getPlatformDisplay) + { + queryDevices(1, devices, &numDevices); + if (numDevices==1) + { + /* Nvidia EGL doesn't need X11 for p-buffer surface */ + display = getPlatformDisplay(EGL_PLATFORM_DEVICE_EXT, devices[0], 0); + configAttribs[1] = EGL_PBUFFER_BIT; + pBuffer = 1; + } + } + if (display==EGL_NO_DISPLAY) + { + /* Fall-back to X11 surface, works on Mesa */ + display = getDisplay(EGL_DEFAULT_DISPLAY); + } + if (display == EGL_NO_DISPLAY) + return GL_TRUE; + + eglewInit(display); + + if (bindAPI(EGL_OPENGL_API) != EGL_TRUE) + return GL_TRUE; + + if (chooseConfig(display, configAttribs, &config, 1, &numConfig) != EGL_TRUE || (numConfig != 1)) + return GL_TRUE; + + ctx = createContext(display, config, EGL_NO_CONTEXT, pBuffer ? contextAttribs : NULL); + if (NULL == ctx) + return GL_TRUE; + + surface = EGL_NO_SURFACE; + /* Create a p-buffer surface if possible */ + if (pBuffer && createPbufferSurface) + { + surface = createPbufferSurface(display, config, pBufferAttribs); + } + /* Create a generic surface without a native window, if necessary */ + if (surface==EGL_NO_SURFACE) + { + surface = createWindowSurface(display, config, (EGLNativeWindowType) NULL, NULL); + } +#if 0 + if (surface == EGL_NO_SURFACE) + return GL_TRUE; +#endif + + if (makeCurrent(display, surface, surface, ctx) != EGL_TRUE) + return GL_TRUE; + + return GL_FALSE; +} + +void glewDestroyContext () +{ + if (NULL != ctx) eglDestroyContext(display, ctx); +} + +#elif defined(GLEW_OSMESA) OSMesaContext ctx; static const GLint osmFormat = GL_UNSIGNED_BYTE; @@ -11412,7 +11595,7 @@ GLboolean glewCreateContext (struct createParams* params) wc.lpszClassName = "GLEW"; if (0 == RegisterClass(&wc)) return GL_TRUE; /* create window */ - wnd = CreateWindow("GLEW", "GLEW", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + wnd = CreateWindow("GLEW", "GLEW", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), NULL); if (NULL == wnd) return GL_TRUE; /* get the device context */ @@ -11600,8 +11783,8 @@ GLboolean glewCreateContext (struct createParams *params) cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); swa.border_pixel = 0; swa.colormap = cmap; - wnd = XCreateWindow(dpy, RootWindow(dpy, vi->screen), - 0, 0, 1, 1, 0, vi->depth, InputOutput, vi->visual, + wnd = XCreateWindow(dpy, RootWindow(dpy, vi->screen), + 0, 0, 1, 1, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap, &swa); /* make context current */ if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;