merge incoming

This commit is contained in:
sfb 2012-05-15 13:52:33 -05:00
commit a1e65ad691
135 changed files with 11667 additions and 872 deletions

View file

@ -21,7 +21,7 @@ FIND_PATH(CPPTEST_INCLUDE_DIR
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cppunit
PATH_SUFFIXES cppunit cpptest
)
SET(LIBRARY_NAME_RELEASE cpptest)

View file

@ -16,6 +16,7 @@ IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql
/usr/include/mysql
/usr/local/include/mysql
/opt/local/include/mysql5/mysql

View file

@ -0,0 +1,49 @@
# - Try to find OpenGL ES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGL ES
# OPENGLES_EGL_FOUND - system has EGL
# OPENGLES_LIBRARIES - Link these to use OpenGL ES and EGL
#
# If you want to use just GL ES you can use these values
# OPENGLES_GLES_LIBRARY - Path to OpenGL ES Library
# OPENGLES_EGL_LIBRARY - Path to EGL Library
FIND_LIBRARY(OPENGLES_GLES_LIBRARY
NAMES GLESv1_CM libGLESv1_CM gles_cm libgles_cm
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(OPENGLES_EGL_LIBRARY
NAMES EGL libEGL
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(OPENGLES_GLES_LIBRARY)
SET(OPENGLES_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_GLES_LIBRARY} ${OPENGLES_LIBRARIES})
IF(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES})
ELSE(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "NO")
ENDIF(OPENGLES_EGL_LIBRARY)
ENDIF(OPENGLES_GLES_LIBRARY)

View file

@ -355,7 +355,7 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(HOST_CPU ${CMAKE_SYSTEM_PROCESSOR})
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
IF(HOST_CPU MATCHES "amd64")
SET(HOST_CPU "x86_64")
@ -382,6 +382,16 @@ MACRO(NL_SETUP_BUILD)
# DEB_HOST_ARCH_ENDIAN is 'little' or 'big'
# DEB_HOST_ARCH_BITS is '32' or '64'
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON)
MESSAGE(STATUS "Using Clang compiler")
ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
IF(CMAKE_GENERATOR MATCHES "Xcode")
SET(XCODE ON)
MESSAGE(STATUS "Generating Xcode project")
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
# If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
# x86-compatible CPU
@ -397,8 +407,13 @@ MACRO(NL_SETUP_BUILD)
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(TARGET_CPU "x86")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSEIF(HOST_CPU MATCHES "arm")
SET(TARGET_CPU "arm")
ELSE(HOST_CPU MATCHES "x86")
SET(TARGET_CPU "unknown")
MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}")
ENDIF(HOST_CPU MATCHES "x86")
# TODO: add checks for ARM and PPC
# TODO: add checks for PPC
ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}")
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
@ -409,6 +424,9 @@ MACRO(NL_SETUP_BUILD)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86")
ELSEIF(TARGET_CPU STREQUAL "arm")
SET(TARGET_ARM 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM")
ENDIF(TARGET_CPU STREQUAL "x86_64")
# Fix library paths suffixes for Debian MultiArch
@ -478,6 +496,19 @@ MACRO(NL_SETUP_BUILD)
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}")
ELSE(MSVC)
IF(WIN32)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32")
ENDIF(WIN32)
IF(APPLE)
IF(TARGET_CPU STREQUAL "x86")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386")
ENDIF(TARGET_CPU STREQUAL "x86")
IF(TARGET_CPU STREQUAL "x86_64")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64")
ENDIF(TARGET_CPU STREQUAL "x86_64")
ELSE(APPLE)
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686")
ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
@ -485,6 +516,7 @@ MACRO(NL_SETUP_BUILD)
IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64")
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ENDIF(APPLE)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -ftemplate-depth-48 -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing")
@ -500,6 +532,41 @@ MACRO(NL_SETUP_BUILD)
SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}")
ENDIF(APPLE)
IF(APPLE AND XCODE)
SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE)
ELSEIF(APPLE AND NOT XCODE)
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
FOREACH(_SDK ${_CMAKE_OSX_SDKS})
IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE)
ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
ENDFOREACH(_SDK)
IF(CMAKE_OSX_SYSROOT)
SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}")
ELSE(CMAKE_OSX_SYSROOT)
MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated")
ENDIF(CMAKE_OSX_SYSROOT)
IF(CMAKE_OSX_ARCHITECTURES)
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}")
ENDFOREACH(_ARCH)
ENDIF(CMAKE_OSX_ARCHITECTURES)
IF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}")
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(APPLE AND XCODE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
SET(PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}")
@ -514,9 +581,11 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
ELSE(WITH_SYMBOLS)
IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
IF(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip -Wl,-x ${NL_RELEASE_LINKFLAGS}")
ELSE(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
ENDIF(APPLE)
ENDIF(WITH_SYMBOLS)
SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
@ -710,7 +779,7 @@ MACRO(SETUP_EXTERNAL)
ELSE(WIN32)
IF(APPLE)
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ELSE(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
ENDIF(WITH_STATIC_EXTERNAL)

View file

@ -18,19 +18,6 @@ ENDIF(WIN32)
IF(WITH_3D)
FIND_PACKAGE(FreeType)
IF(WITH_DRIVER_OPENGL)
FIND_PACKAGE(OpenGL)
IF(NOT WIN32)
IF(APPLE)
FIND_LIBRARY(CARBON NAMES Carbon)
FIND_LIBRARY(COCOA NAMES Cocoa)
ELSE(APPLE)
FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode)
ENDIF(APPLE)
ENDIF(NOT WIN32)
ENDIF(WITH_DRIVER_OPENGL)
IF(WITH_NEL_CEGUI)
FIND_PACKAGE(CEGUI)
ENDIF(WITH_NEL_CEGUI)

View file

@ -123,7 +123,7 @@ public:
/// \name Object
// @{
CDriverUser (uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
virtual ~CDriverUser();
// @}

View file

@ -27,9 +27,11 @@
#ifdef NL_OS_WINDOWS
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"
#elif defined (NL_OS_UNIX)
# define NL3D_GL_DLL_NAME "nel_drv_opengl"
# define NL3D_GLES_DLL_NAME "nel_drv_opengles"
#else
# error "Unknown system"
#endif
@ -43,6 +45,7 @@ struct EDru : public NLMISC::Exception
EDru(const std::string &reason) : Exception(reason) {}
};
// OpenGL
struct EDruOpenglDriverNotFound : public EDru
{
EDruOpenglDriverNotFound() : EDru( NL3D_GL_DLL_NAME " not found" ) {}
@ -68,7 +71,34 @@ struct EDruOpenglDriverCantCreateDriver : public EDru
EDruOpenglDriverCantCreateDriver() : EDru( NL3D_GL_DLL_NAME " can't create driver" ) {}
};
// OpenGL ES
struct EDruOpenglEsDriverNotFound : public EDru
{
EDruOpenglEsDriverNotFound() : EDru( NL3D_GLES_DLL_NAME " not found" ) {}
};
struct EDruOpenglEsDriverCorrupted : public EDru
{
EDruOpenglEsDriverCorrupted() : EDru( "Can't get NL3D_createIDriverInstance from " NL3D_GLES_DLL_NAME " (Bad dll?)" ) {}
};
struct EDruOpenglEsDriverOldVersion : public EDru
{
EDruOpenglEsDriverOldVersion() : EDru( NL3D_GLES_DLL_NAME " is a too old version. Ask for a more recent file" ) {}
};
struct EDruOpenglEsDriverUnknownVersion : public EDru
{
EDruOpenglEsDriverUnknownVersion() : EDru( NL3D_GLES_DLL_NAME " is more recent than the application" ) {}
};
struct EDruOpenglEsDriverCantCreateDriver : public EDru
{
EDruOpenglEsDriverCantCreateDriver() : EDru( NL3D_GLES_DLL_NAME " can't create driver" ) {}
};
#ifdef NL_OS_WINDOWS
// Direct3D
struct EDruDirect3dDriverNotFound : public EDru
{
EDruDirect3dDriverNotFound() : EDru( NL3D_D3D_DLL_NAME " not found" ) {}
@ -103,6 +133,9 @@ public:
/// Portable Function which create a GL Driver (using gl dll...).
static IDriver *createGlDriver() throw(EDru);
/// Portable Function which create a GL ES Driver (using gl dll...).
static IDriver *createGlEsDriver() throw(EDru);
#ifdef NL_OS_WINDOWS
/// Windows Function which create a Direct3d Driver.
static IDriver *createD3DDriver() throw(EDru);

View file

@ -139,6 +139,9 @@ public:
enum TStencilOp { keep = 0, zero, replace, incr, decr, invert };
enum TStencilFunc { never = 0, less, lessequal, equal, notequal, greaterequal, greater, always};
// Existing drivers
enum TDriver { Direct3d = 0, OpenGl, OpenGlEs };
public:
/// The EventServer of this driver. Init after setDisplay()!!
NLMISC::CEventServer EventServer;
@ -844,6 +847,7 @@ public:
* This is the static function which build a UDriver, the root for all 3D functions.
*/
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0);
/**
* Purge static memory

View file

@ -94,7 +94,7 @@ public:
// size of used elements must be equal to the vector size minus one, when everything is allocated
nlassert((m_Ids.size() - 1) == m_Size);
idx = m_Ids.size();
idx = (uint16)m_Ids.size();
uint16 verification = rand();
m_Ids.push_back(CIdInfo(verification, m_Next, value));
m_Next = idx;

View file

@ -2,6 +2,10 @@ IF(WITH_DRIVER_OPENGL)
ADD_SUBDIRECTORY(opengl)
ENDIF(WITH_DRIVER_OPENGL)
IF(WITH_DRIVER_OPENGLES)
ADD_SUBDIRECTORY(opengles)
ENDIF(WITH_DRIVER_OPENGLES)
IF(WIN32)
IF(WITH_DRIVER_DIRECT3D)
ADD_SUBDIRECTORY(direct3d)

View file

@ -1,3 +1,15 @@
FIND_PACKAGE(OpenGL REQUIRED)
IF(NOT WIN32)
IF(APPLE)
FIND_LIBRARY(CARBON NAMES Carbon)
FIND_LIBRARY(COCOA NAMES Cocoa)
ELSE(APPLE)
FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode)
ENDIF(APPLE)
ENDIF(NOT WIN32)
FILE(GLOB SRC *.cpp *.h *.def)
IF(APPLE)
@ -57,9 +69,9 @@ IF(UNIX AND NOT APPLE)
ENDIF(X11_Xcursor_FOUND)
ENDIF(UNIX AND NOT APPLE)
IF(NOT APPLE AND WITH_PCH)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
ENDIF(NOT APPLE AND WITH_PCH)
ENDIF(WITH_PCH)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)

View file

@ -0,0 +1,329 @@
/* -*- mode: c; tab-width: 8; -*- */
/* vi: set sw=4 ts=8: */
/* Reference version of egl.h for EGL 1.4.
* $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
*/
/*
** Copyright (c) 2007-2009 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 __egl_h_
#define __egl_h_
/* All platform-dependent types and macro boilerplate (such as EGLAPI
* and EGLAPIENTRY) should go in eglplatform.h.
*/
#include <EGL/eglplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
/* EGL Types */
/* EGLint is defined in eglplatform.h */
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDisplay;
typedef void *EGLSurface;
typedef void *EGLClientBuffer;
/* EGL Versioning */
#define EGL_VERSION_1_0 1
#define EGL_VERSION_1_1 1
#define EGL_VERSION_1_2 1
#define EGL_VERSION_1_3 1
#define EGL_VERSION_1_4 1
/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
* enums are assigned unique values starting at 0x3000.
*/
/* EGL aliases */
#define EGL_FALSE 0
#define EGL_TRUE 1
/* Out-of-band handle values */
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
#define EGL_NO_CONTEXT ((EGLContext)0)
#define EGL_NO_DISPLAY ((EGLDisplay)0)
#define EGL_NO_SURFACE ((EGLSurface)0)
/* Out-of-band attribute value */
#define EGL_DONT_CARE ((EGLint)-1)
/* Errors / GetError return values */
#define EGL_SUCCESS 0x3000
#define EGL_NOT_INITIALIZED 0x3001
#define EGL_BAD_ACCESS 0x3002
#define EGL_BAD_ALLOC 0x3003
#define EGL_BAD_ATTRIBUTE 0x3004
#define EGL_BAD_CONFIG 0x3005
#define EGL_BAD_CONTEXT 0x3006
#define EGL_BAD_CURRENT_SURFACE 0x3007
#define EGL_BAD_DISPLAY 0x3008
#define EGL_BAD_MATCH 0x3009
#define EGL_BAD_NATIVE_PIXMAP 0x300A
#define EGL_BAD_NATIVE_WINDOW 0x300B
#define EGL_BAD_PARAMETER 0x300C
#define EGL_BAD_SURFACE 0x300D
#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
/* Reserved 0x300F-0x301F for additional errors */
/* Config attributes */
#define EGL_BUFFER_SIZE 0x3020
#define EGL_ALPHA_SIZE 0x3021
#define EGL_BLUE_SIZE 0x3022
#define EGL_GREEN_SIZE 0x3023
#define EGL_RED_SIZE 0x3024
#define EGL_DEPTH_SIZE 0x3025
#define EGL_STENCIL_SIZE 0x3026
#define EGL_CONFIG_CAVEAT 0x3027
#define EGL_CONFIG_ID 0x3028
#define EGL_LEVEL 0x3029
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
#define EGL_MAX_PBUFFER_PIXELS 0x302B
#define EGL_MAX_PBUFFER_WIDTH 0x302C
#define EGL_NATIVE_RENDERABLE 0x302D
#define EGL_NATIVE_VISUAL_ID 0x302E
#define EGL_NATIVE_VISUAL_TYPE 0x302F
#define EGL_SAMPLES 0x3031
#define EGL_SAMPLE_BUFFERS 0x3032
#define EGL_SURFACE_TYPE 0x3033
#define EGL_TRANSPARENT_TYPE 0x3034
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
#define EGL_TRANSPARENT_RED_VALUE 0x3037
#define EGL_NONE 0x3038 /* Attrib list terminator */
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
#define EGL_MIN_SWAP_INTERVAL 0x303B
#define EGL_MAX_SWAP_INTERVAL 0x303C
#define EGL_LUMINANCE_SIZE 0x303D
#define EGL_ALPHA_MASK_SIZE 0x303E
#define EGL_COLOR_BUFFER_TYPE 0x303F
#define EGL_RENDERABLE_TYPE 0x3040
#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
#define EGL_CONFORMANT 0x3042
/* Reserved 0x3041-0x304F for additional config attributes */
/* Config attribute values */
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
/* More config attribute values, for EGL_TEXTURE_FORMAT */
#define EGL_NO_TEXTURE 0x305C
#define EGL_TEXTURE_RGB 0x305D
#define EGL_TEXTURE_RGBA 0x305E
#define EGL_TEXTURE_2D 0x305F
/* Config attribute mask bits */
#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
/* QueryString targets */
#define EGL_VENDOR 0x3053
#define EGL_VERSION 0x3054
#define EGL_EXTENSIONS 0x3055
#define EGL_CLIENT_APIS 0x308D
/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
#define EGL_HEIGHT 0x3056
#define EGL_WIDTH 0x3057
#define EGL_LARGEST_PBUFFER 0x3058
#define EGL_TEXTURE_FORMAT 0x3080
#define EGL_TEXTURE_TARGET 0x3081
#define EGL_MIPMAP_TEXTURE 0x3082
#define EGL_MIPMAP_LEVEL 0x3083
#define EGL_RENDER_BUFFER 0x3086
#define EGL_VG_COLORSPACE 0x3087
#define EGL_VG_ALPHA_FORMAT 0x3088
#define EGL_HORIZONTAL_RESOLUTION 0x3090
#define EGL_VERTICAL_RESOLUTION 0x3091
#define EGL_PIXEL_ASPECT_RATIO 0x3092
#define EGL_SWAP_BEHAVIOR 0x3093
#define EGL_MULTISAMPLE_RESOLVE 0x3099
/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
#define EGL_BACK_BUFFER 0x3084
#define EGL_SINGLE_BUFFER 0x3085
/* OpenVG color spaces */
#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
/* OpenVG alpha formats */
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
/* Constant scale factor by which fractional display resolutions &
* aspect ratio are scaled when queried as integer values.
*/
#define EGL_DISPLAY_SCALING 10000
/* Unknown display resolution/aspect ratio */
#define EGL_UNKNOWN ((EGLint)-1)
/* Back buffer swap behaviors */
#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
/* CreatePbufferFromClientBuffer buffer types */
#define EGL_OPENVG_IMAGE 0x3096
/* QueryContext targets */
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
/* CreateContext attributes */
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
/* Multisample resolution behaviors */
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
/* BindAPI/QueryAPI targets */
#define EGL_OPENGL_ES_API 0x30A0
#define EGL_OPENVG_API 0x30A1
#define EGL_OPENGL_API 0x30A2
/* GetCurrentSurface targets */
#define EGL_DRAW 0x3059
#define EGL_READ 0x305A
/* WaitNative engines */
#define EGL_CORE_NATIVE_ENGINE 0x305B
/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
#define EGL_COLORSPACE EGL_VG_COLORSPACE
#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
/* EGL extensions must request enum blocks from the Khronos
* API Registrar, who maintains the enumerant registry. Submit
* a bug in Khronos Bugzilla against task "Registry".
*/
/* EGL Functions */
EGLAPI EGLint EGLAPIENTRY eglGetError(void);
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
EGLint config_size, EGLint *num_config);
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
EGLConfig *configs, EGLint config_size,
EGLint *num_config);
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value);
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
EGLNativeWindowType win,
const EGLint *attrib_list);
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
const EGLint *attrib_list);
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
EGLNativePixmapType pixmap,
const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint value);
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
EGLSurface read, EGLContext ctx);
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
EGLint attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
EGLNativePixmapType target);
/* This is a generic function pointer type, whose name indicates it must
* be cast to the proper type *and calling convention* before use.
*/
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
/* Now, define eglGetProcAddress using the generic function ptr. type */
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
eglGetProcAddress(const char *procname);
#ifdef __cplusplus
}
#endif
#endif /* __egl_h_ */

View file

@ -0,0 +1,428 @@
#ifndef __eglext_h_
#define __eglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2012 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.
*/
#include <EGL/eglplatform.h>
/*************************************************************/
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
/* $Revision: 17614 $ on $Date: 2012-04-26 06:56:02 -0700 (Thu, 26 Apr 2012) $ */
#define EGL_EGLEXT_VERSION 12
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
#endif
#ifndef EGL_KHR_lock_surface
#define EGL_KHR_lock_surface 1
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
#endif
#ifndef EGL_KHR_image
#define EGL_KHR_image 1
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
typedef void *EGLImageKHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
#endif
#ifndef EGL_KHR_vg_parent_image
#define EGL_KHR_vg_parent_image 1
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_2D_image
#define EGL_KHR_gl_texture_2D_image 1
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_texture_cubemap_image
#define EGL_KHR_gl_texture_cubemap_image 1
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_3D_image
#define EGL_KHR_gl_texture_3D_image 1
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_renderbuffer_image
#define EGL_KHR_gl_renderbuffer_image 1
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
#ifndef EGL_KHR_reusable_sync
#define EGL_KHR_reusable_sync 1
typedef void* EGLSyncKHR;
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
#define EGL_SYNC_STATUS_KHR 0x30F1
#define EGL_SIGNALED_KHR 0x30F2
#define EGL_UNSIGNALED_KHR 0x30F3
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
#define EGL_SYNC_TYPE_KHR 0x30F7
#define EGL_SYNC_REUSABLE_KHR 0x30FA
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif
#endif
#ifndef EGL_KHR_image_base
#define EGL_KHR_image_base 1
/* Most interfaces defined by EGL_KHR_image_pixmap above */
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_image_pixmap
#define EGL_KHR_image_pixmap 1
/* Interfaces defined by EGL_KHR_image above */
#endif
#ifndef EGL_IMG_context_priority
#define EGL_IMG_context_priority 1
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
#endif
#ifndef EGL_KHR_lock_surface2
#define EGL_KHR_lock_surface2 1
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
#endif
#ifndef EGL_NV_coverage_sample
#define EGL_NV_coverage_sample 1
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
#endif
#ifndef EGL_NV_depth_nonlinear
#define EGL_NV_depth_nonlinear 1
#define EGL_DEPTH_ENCODING_NV 0x30E2
#define EGL_DEPTH_ENCODING_NONE_NV 0
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
#ifndef EGL_NV_sync
#define EGL_NV_sync 1
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
#define EGL_SYNC_STATUS_NV 0x30E7
#define EGL_SIGNALED_NV 0x30E8
#define EGL_UNSIGNALED_NV 0x30E9
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
#define EGL_ALREADY_SIGNALED_NV 0x30EA
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
#define EGL_CONDITION_SATISFIED_NV 0x30EC
#define EGL_SYNC_TYPE_NV 0x30ED
#define EGL_SYNC_CONDITION_NV 0x30EE
#define EGL_SYNC_FENCE_NV 0x30EF
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
typedef void* EGLSyncNV;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
#ifndef EGL_KHR_fence_sync
#define EGL_KHR_fence_sync 1
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
#define EGL_SYNC_CONDITION_KHR 0x30F8
#define EGL_SYNC_FENCE_KHR 0x30F9
#endif
#endif
#ifndef EGL_HI_clientpixmap
#define EGL_HI_clientpixmap 1
/* Surface Attribute */
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
/*
* Structure representing a client pixmap
* (pixmap's data is in client-space memory).
*/
struct EGLClientPixmapHI
{
void* pData;
EGLint iWidth;
EGLint iHeight;
EGLint iStride;
};
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_HI_clientpixmap */
#ifndef EGL_HI_colorformats
#define EGL_HI_colorformats 1
/* Config Attribute */
#define EGL_COLOR_FORMAT_HI 0x8F70
/* Color Formats */
#define EGL_COLOR_RGB_HI 0x8F71
#define EGL_COLOR_RGBA_HI 0x8F72
#define EGL_COLOR_ARGB_HI 0x8F73
#endif /* EGL_HI_colorformats */
#ifndef EGL_MESA_drm_image
#define EGL_MESA_drm_image 1
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#endif
#ifndef EGL_NV_post_sub_buffer
#define EGL_NV_post_sub_buffer 1
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
#endif
#ifndef EGL_ANGLE_query_surface_pointer
#define EGL_ANGLE_query_surface_pointer 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
#endif
#ifndef EGL_NV_coverage_sample_resolve
#define EGL_NV_coverage_sample_resolve 1
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
typedef khronos_utime_nanoseconds_t EGLuint64NV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
#ifndef EGL_KHR_stream
#define EGL_KHR_stream 1
typedef void* EGLStreamKHR;
typedef khronos_uint64_t EGLuint64KHR;
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
#define EGL_PRODUCER_FRAME_KHR 0x3212
#define EGL_CONSUMER_FRAME_KHR 0x3213
#define EGL_STREAM_STATE_KHR 0x3214
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
#define EGL_BAD_STREAM_KHR 0x321B
#define EGL_BAD_STATE_KHR 0x321C
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStream64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAM64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_consumer_gltexture
#define EGL_KHR_stream_consumer_gltexture 1
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_eglsurface
#define EGL_KHR_stream_producer_eglsurface 1
#define EGL_STREAM_BIT_KHR 0x0800
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_aldatalocator
#define EGL_KHR_stream_producer_aldatalocator 1
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_fifo
#define EGL_KHR_stream_fifo 1
/* reuse EGLTimeKHR */
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif
#endif
#ifndef EGL_EXT_create_context_robustness
#define EGL_EXT_create_context_robustness 1
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
#endif
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,115 @@
#ifndef __eglplatform_h_
#define __eglplatform_h_
/*
** Copyright (c) 2007-2009 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.
*/
/* Platform-specific types and definitions for egl.h
* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "EGL" component "Registry".
*/
#include <KHR/khrplatform.h>
/* Macros used in EGL function prototype declarations.
*
* EGL functions should be prototyped as:
*
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
*
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
*/
#ifndef EGLAPI
#define EGLAPI KHRONOS_APICALL
#endif
#ifndef EGLAPIENTRY
#define EGLAPIENTRY KHRONOS_APIENTRY
#endif
#define EGLAPIENTRYP EGLAPIENTRY*
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
* are aliases of window-system-dependent types, such as X Display * or
* Windows Device Context. They must be defined in platform-specific
* code below. The EGL-prefixed versions of Native*Type are the same
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
*
* Khronos STRONGLY RECOMMENDS that you use the default definitions
* provided below, since these changes affect both binary and source
* portability of applications using EGL running on different EGL
* implementations.
*/
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
typedef int EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
#elif defined(__unix__)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#else
#error "Platform not recognized"
#endif
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
typedef EGLNativeDisplayType NativeDisplayType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeWindowType NativeWindowType;
/* Define EGLint. This must be a signed integral type large enough to contain
* all legal attribute names and values passed into and out of EGL, whether
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
* handle, or other. While in general a 32-bit integer will suffice, if
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
* integer type.
*/
typedef khronos_int32_t EGLint;
#endif /* __eglplatform_h */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,943 @@
#ifndef __wglext_h_
#define __wglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2012 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.
*/
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
#ifndef GLAPI
#define GLAPI extern
#endif
/*************************************************************/
/* Header file version number */
/* wglext.h last updated 2012/01/04 */
/* Current version at http://www.opengl.org/registry/ */
#define WGL_WGLEXT_VERSION 24
#ifndef WGL_ARB_buffer_region
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
#endif
#ifndef WGL_ARB_multisample
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#endif
#ifndef WGL_ARB_extensions_string
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#endif
#ifndef WGL_ARB_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036
#endif
#ifndef WGL_ARB_render_texture
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090
#endif
#ifndef WGL_ARB_pixel_format_float
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
#endif
#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
#endif
#ifndef WGL_ARB_create_context
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#endif
#ifndef WGL_ARB_create_context_robustness
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
#endif
#ifndef WGL_EXT_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
#endif
#ifndef WGL_EXT_depth_float
#define WGL_DEPTH_FLOAT_EXT 0x2040
#endif
#ifndef WGL_3DFX_multisample
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061
#endif
#ifndef WGL_EXT_multisample
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
#endif
#ifndef WGL_I3D_gamma
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
#endif
#ifndef WGL_I3D_genlock
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
#endif
#ifndef WGL_I3D_swap_frame_lock
#endif
#ifndef WGL_NV_render_depth_texture
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
#define WGL_DEPTH_COMPONENT_NV 0x20A7
#endif
#ifndef WGL_NV_render_texture_rectangle
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
#endif
#ifndef WGL_ATI_pixel_format_float
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#endif
#ifndef WGL_NV_float_buffer
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
#endif
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
#endif
#ifndef WGL_NV_present_video
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
#endif
#ifndef WGL_NV_video_out
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define WGL_VIDEO_OUT_FRAME 0x20C8
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
#endif
#ifndef WGL_NV_swap_group
#endif
#ifndef WGL_NV_gpu_affinity
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
#endif
#ifndef WGL_AMD_gpu_association
#define WGL_GPU_VENDOR_AMD 0x1F00
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define WGL_GPU_RAM_AMD 0x21A3
#define WGL_GPU_CLOCK_AMD 0x21A4
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8
#endif
#ifndef WGL_NV_video_capture
#define WGL_UNIQUE_ID_NV 0x20CE
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
#endif
#ifndef WGL_NV_copy_image
#endif
#ifndef WGL_NV_multisample_coverage
#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9
#endif
#ifndef WGL_EXT_create_context_es2_profile
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif
#ifndef WGL_NV_DX_interop
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
#endif
#ifndef WGL_NV_DX_interop2
#endif
#ifndef WGL_EXT_swap_control_tear
#endif
/*************************************************************/
#ifndef WGL_ARB_pbuffer
DECLARE_HANDLE(HPBUFFERARB);
#endif
#ifndef WGL_EXT_pbuffer
DECLARE_HANDLE(HPBUFFEREXT);
#endif
#ifndef WGL_NV_present_video
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
#endif
#ifndef WGL_NV_video_output
DECLARE_HANDLE(HPVIDEODEV);
#endif
#ifndef WGL_NV_gpu_affinity
DECLARE_HANDLE(HPGPUNV);
DECLARE_HANDLE(HGPUNV);
typedef struct _GPU_DEVICE {
DWORD cb;
CHAR DeviceName[32];
CHAR DeviceString[128];
DWORD Flags;
RECT rcVirtualScreen;
} GPU_DEVICE, *PGPU_DEVICE;
#endif
#ifndef WGL_NV_video_capture
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
#endif
#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif
#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1
#endif
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
extern HDC WINAPI wglGetCurrentReadDCARB (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif
#ifndef WGL_ARB_pixel_format_float
#define WGL_ARB_pixel_format_float 1
#endif
#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_ARB_framebuffer_sRGB 1
#endif
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#endif
#ifndef WGL_ARB_create_context_robustness
#define WGL_ARB_create_context_robustness 1
#endif
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
#endif
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
#endif
#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
extern int WINAPI wglGetSwapIntervalEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
#endif
#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1
#endif
#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
extern void WINAPI wglFreeMemoryNV (void *pointer);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
#endif
#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1
#endif
#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1
#endif
#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
#endif
#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif
#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
#endif
#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableFrameLockI3D (void);
extern BOOL WINAPI wglDisableFrameLockI3D (void);
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
#endif
#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif
#ifndef WGL_ATI_pixel_format_float
#define WGL_ATI_pixel_format_float 1
#endif
#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1
#endif
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_EXT_framebuffer_sRGB 1
#endif
#ifndef WGL_NV_present_video
#define WGL_NV_present_video 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
#endif
#ifndef WGL_NV_video_output
#define WGL_NV_video_output 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#ifndef WGL_NV_swap_group
#define WGL_NV_swap_group 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
#endif
#ifndef WGL_NV_gpu_affinity
#define WGL_NV_gpu_affinity 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
#endif
#ifndef WGL_AMD_gpu_association
#define WGL_AMD_gpu_association 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#ifndef WGL_NV_video_capture
#define WGL_NV_video_capture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif
#ifndef WGL_NV_copy_image
#define WGL_NV_copy_image 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#ifndef WGL_NV_multisample_coverage
#define WGL_NV_multisample_coverage 1
#endif
#ifndef WGL_NV_DX_interop
#define WGL_NV_DX_interop 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
extern HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
extern BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
extern HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
extern BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
extern BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
extern BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
extern BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
#endif
#ifndef WGL_NV_DX_interop2
#define WGL_NV_DX_interop2 1
#endif
#ifndef WGL_EXT_swap_control_tear
#define WGL_EXT_swap_control_tear 1
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,15 @@
/*
* Skeleton egl.h to provide compatibility for early GLES 1.0
* applications. Several early implementations included gl.h
* in egl.h leading applications to include only egl.h
*
* $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$
*/
#ifndef __legacy_egl_h_
#define __legacy_egl_h_
#include <EGL/egl.h>
#include <GLES/gl.h>
#endif /* __legacy_egl_h_ */

View file

@ -0,0 +1,770 @@
#ifndef __gl_h_
#define __gl_h_
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
#include <GLES/glplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
typedef void GLvoid;
typedef char GLchar;
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef khronos_int8_t GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef khronos_uint8_t GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef khronos_float_t GLfloat;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
typedef khronos_int32_t GLclampx;
typedef khronos_intptr_t GLintptr;
typedef khronos_ssize_t GLsizeiptr;
/*************************************************************/
/* OpenGL ES core versions */
#define GL_VERSION_ES_CM_1_0 1
#define GL_VERSION_ES_CL_1_0 1
#define GL_VERSION_ES_CM_1_1 1
#define GL_VERSION_ES_CL_1_1 1
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GL_FALSE 0
#define GL_TRUE 1
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* AlphaFunction */
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* ClipPlaneName */
#define GL_CLIP_PLANE0 0x3000
#define GL_CLIP_PLANE1 0x3001
#define GL_CLIP_PLANE2 0x3002
#define GL_CLIP_PLANE3 0x3003
#define GL_CLIP_PLANE4 0x3004
#define GL_CLIP_PLANE5 0x3005
/* ColorMaterialFace */
/* GL_FRONT_AND_BACK */
/* ColorMaterialParameter */
/* GL_AMBIENT_AND_DIFFUSE */
/* ColorPointerType */
/* GL_UNSIGNED_BYTE */
/* GL_FLOAT */
/* GL_FIXED */
/* CullFaceMode */
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GL_FOG 0x0B60
#define GL_LIGHTING 0x0B50
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_ALPHA_TEST 0x0BC0
#define GL_BLEND 0x0BE2
#define GL_COLOR_LOGIC_OP 0x0BF2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
/* GL_LIGHT0 */
/* GL_LIGHT1 */
/* GL_LIGHT2 */
/* GL_LIGHT3 */
/* GL_LIGHT4 */
/* GL_LIGHT5 */
/* GL_LIGHT6 */
/* GL_LIGHT7 */
#define GL_POINT_SMOOTH 0x0B10
#define GL_LINE_SMOOTH 0x0B20
#define GL_SCISSOR_TEST 0x0C11
#define GL_COLOR_MATERIAL 0x0B57
#define GL_NORMALIZE 0x0BA1
#define GL_RESCALE_NORMAL 0x803A
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_VERTEX_ARRAY 0x8074
#define GL_NORMAL_ARRAY 0x8075
#define GL_COLOR_ARRAY 0x8076
#define GL_TEXTURE_COORD_ARRAY 0x8078
#define GL_MULTISAMPLE 0x809D
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
#define GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_STACK_OVERFLOW 0x0503
#define GL_STACK_UNDERFLOW 0x0504
#define GL_OUT_OF_MEMORY 0x0505
/* FogMode */
/* GL_LINEAR */
#define GL_EXP 0x0800
#define GL_EXP2 0x0801
/* FogParameter */
#define GL_FOG_DENSITY 0x0B62
#define GL_FOG_START 0x0B63
#define GL_FOG_END 0x0B64
#define GL_FOG_MODE 0x0B65
#define GL_FOG_COLOR 0x0B66
/* FrontFaceDirection */
#define GL_CW 0x0900
#define GL_CCW 0x0901
/* GetPName */
#define GL_CURRENT_COLOR 0x0B00
#define GL_CURRENT_NORMAL 0x0B02
#define GL_CURRENT_TEXTURE_COORDS 0x0B03
#define GL_POINT_SIZE 0x0B11
#define GL_POINT_SIZE_MIN 0x8126
#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
#define GL_LINE_WIDTH 0x0B21
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_CULL_FACE_MODE 0x0B45
#define GL_FRONT_FACE 0x0B46
#define GL_SHADE_MODEL 0x0B54
#define GL_DEPTH_RANGE 0x0B70
#define GL_DEPTH_WRITEMASK 0x0B72
#define GL_DEPTH_CLEAR_VALUE 0x0B73
#define GL_DEPTH_FUNC 0x0B74
#define GL_STENCIL_CLEAR_VALUE 0x0B91
#define GL_STENCIL_FUNC 0x0B92
#define GL_STENCIL_VALUE_MASK 0x0B93
#define GL_STENCIL_FAIL 0x0B94
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GL_STENCIL_REF 0x0B97
#define GL_STENCIL_WRITEMASK 0x0B98
#define GL_MATRIX_MODE 0x0BA0
#define GL_VIEWPORT 0x0BA2
#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
#define GL_PROJECTION_STACK_DEPTH 0x0BA4
#define GL_TEXTURE_STACK_DEPTH 0x0BA5
#define GL_MODELVIEW_MATRIX 0x0BA6
#define GL_PROJECTION_MATRIX 0x0BA7
#define GL_TEXTURE_MATRIX 0x0BA8
#define GL_ALPHA_TEST_FUNC 0x0BC1
#define GL_ALPHA_TEST_REF 0x0BC2
#define GL_BLEND_DST 0x0BE0
#define GL_BLEND_SRC 0x0BE1
#define GL_LOGIC_OP_MODE 0x0BF0
#define GL_SCISSOR_BOX 0x0C10
#define GL_SCISSOR_TEST 0x0C11
#define GL_COLOR_CLEAR_VALUE 0x0C22
#define GL_COLOR_WRITEMASK 0x0C23
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
#define GL_MAX_LIGHTS 0x0D31
#define GL_MAX_CLIP_PLANES 0x0D32
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_MAX_TEXTURE_UNITS 0x84E2
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
#define GL_BLUE_BITS 0x0D54
#define GL_ALPHA_BITS 0x0D55
#define GL_DEPTH_BITS 0x0D56
#define GL_STENCIL_BITS 0x0D57
#define GL_POLYGON_OFFSET_UNITS 0x2A00
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_POLYGON_OFFSET_FACTOR 0x8038
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_VERTEX_ARRAY_SIZE 0x807A
#define GL_VERTEX_ARRAY_TYPE 0x807B
#define GL_VERTEX_ARRAY_STRIDE 0x807C
#define GL_NORMAL_ARRAY_TYPE 0x807E
#define GL_NORMAL_ARRAY_STRIDE 0x807F
#define GL_COLOR_ARRAY_SIZE 0x8081
#define GL_COLOR_ARRAY_TYPE 0x8082
#define GL_COLOR_ARRAY_STRIDE 0x8083
#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
#define GL_VERTEX_ARRAY_POINTER 0x808E
#define GL_NORMAL_ARRAY_POINTER 0x808F
#define GL_COLOR_ARRAY_POINTER 0x8090
#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
#define GL_POINT_SMOOTH_HINT 0x0C51
#define GL_LINE_SMOOTH_HINT 0x0C52
#define GL_FOG_HINT 0x0C54
#define GL_GENERATE_MIPMAP_HINT 0x8192
/* LightModelParameter */
#define GL_LIGHT_MODEL_AMBIENT 0x0B53
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
/* LightParameter */
#define GL_AMBIENT 0x1200
#define GL_DIFFUSE 0x1201
#define GL_SPECULAR 0x1202
#define GL_POSITION 0x1203
#define GL_SPOT_DIRECTION 0x1204
#define GL_SPOT_EXPONENT 0x1205
#define GL_SPOT_CUTOFF 0x1206
#define GL_CONSTANT_ATTENUATION 0x1207
#define GL_LINEAR_ATTENUATION 0x1208
#define GL_QUADRATIC_ATTENUATION 0x1209
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* LogicOp */
#define GL_CLEAR 0x1500
#define GL_AND 0x1501
#define GL_AND_REVERSE 0x1502
#define GL_COPY 0x1503
#define GL_AND_INVERTED 0x1504
#define GL_NOOP 0x1505
#define GL_XOR 0x1506
#define GL_OR 0x1507
#define GL_NOR 0x1508
#define GL_EQUIV 0x1509
#define GL_INVERT 0x150A
#define GL_OR_REVERSE 0x150B
#define GL_COPY_INVERTED 0x150C
#define GL_OR_INVERTED 0x150D
#define GL_NAND 0x150E
#define GL_SET 0x150F
/* MaterialFace */
/* GL_FRONT_AND_BACK */
/* MaterialParameter */
#define GL_EMISSION 0x1600
#define GL_SHININESS 0x1601
#define GL_AMBIENT_AND_DIFFUSE 0x1602
/* GL_AMBIENT */
/* GL_DIFFUSE */
/* GL_SPECULAR */
/* MatrixMode */
#define GL_MODELVIEW 0x1700
#define GL_PROJECTION 0x1701
#define GL_TEXTURE 0x1702
/* NormalPointerType */
/* GL_BYTE */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* PixelFormat */
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190A
/* PixelStoreParameter */
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
/* ShadingModel */
#define GL_FLAT 0x1D00
#define GL_SMOOTH 0x1D01
/* StencilFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* StencilOp */
/* GL_ZERO */
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
/* GL_INVERT */
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
/* TexCoordPointerType */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* GL_BYTE */
/* TextureEnvMode */
#define GL_MODULATE 0x2100
#define GL_DECAL 0x2101
/* GL_BLEND */
#define GL_ADD 0x0104
/* GL_REPLACE */
/* TextureEnvParameter */
#define GL_TEXTURE_ENV_MODE 0x2200
#define GL_TEXTURE_ENV_COLOR 0x2201
/* TextureEnvTarget */
#define GL_TEXTURE_ENV 0x2300
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
#define GL_GENERATE_MIPMAP 0x8191
/* TextureTarget */
/* GL_TEXTURE_2D */
/* TextureUnit */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
/* TextureWrapMode */
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
/* VertexPointerType */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* GL_BYTE */
/* LightName */
#define GL_LIGHT0 0x4000
#define GL_LIGHT1 0x4001
#define GL_LIGHT2 0x4002
#define GL_LIGHT3 0x4003
#define GL_LIGHT4 0x4004
#define GL_LIGHT5 0x4005
#define GL_LIGHT6 0x4006
#define GL_LIGHT7 0x4007
/* Buffer Objects */
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
/* Texture combine + dot3 */
#define GL_SUBTRACT 0x84E7
#define GL_COMBINE 0x8570
#define GL_COMBINE_RGB 0x8571
#define GL_COMBINE_ALPHA 0x8572
#define GL_RGB_SCALE 0x8573
#define GL_ADD_SIGNED 0x8574
#define GL_INTERPOLATE 0x8575
#define GL_CONSTANT 0x8576
#define GL_PRIMARY_COLOR 0x8577
#define GL_PREVIOUS 0x8578
#define GL_OPERAND0_RGB 0x8590
#define GL_OPERAND1_RGB 0x8591
#define GL_OPERAND2_RGB 0x8592
#define GL_OPERAND0_ALPHA 0x8598
#define GL_OPERAND1_ALPHA 0x8599
#define GL_OPERAND2_ALPHA 0x859A
#define GL_ALPHA_SCALE 0x0D1C
#define GL_SRC0_RGB 0x8580
#define GL_SRC1_RGB 0x8581
#define GL_SRC2_RGB 0x8582
#define GL_SRC0_ALPHA 0x8588
#define GL_SRC1_ALPHA 0x8589
#define GL_SRC2_ALPHA 0x858A
#define GL_DOT3_RGB 0x86AE
#define GL_DOT3_RGBA 0x86AF
/*------------------------------------------------------------------------*
* required OES extension tokens
*------------------------------------------------------------------------*/
/* OES_read_format */
#ifndef GL_OES_read_format
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
#endif
/* GL_OES_compressed_paletted_texture */
#ifndef GL_OES_compressed_paletted_texture
#define GL_PALETTE4_RGB8_OES 0x8B90
#define GL_PALETTE4_RGBA8_OES 0x8B91
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
#define GL_PALETTE4_RGBA4_OES 0x8B93
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
#define GL_PALETTE8_RGB8_OES 0x8B95
#define GL_PALETTE8_RGBA8_OES 0x8B96
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
#define GL_PALETTE8_RGBA4_OES 0x8B98
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
#endif
/* OES_point_size_array */
#ifndef GL_OES_point_size_array
#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
#endif
/* GL_OES_point_sprite */
#ifndef GL_OES_point_sprite
#define GL_POINT_SPRITE_OES 0x8861
#define GL_COORD_REPLACE_OES 0x8862
#endif
/*************************************************************/
/* Available only in Common profile */
GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glLineWidth (GLfloat width);
GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glPointSize (GLfloat size);
GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
/* Available in both Common and Common-Lite profiles */
GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
GL_API void GL_APIENTRY glClear (GLbitfield mask);
GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
GL_API void GL_APIENTRY glClearStencil (GLint s);
GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_API void GL_APIENTRY glCullFace (GLenum mode);
GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
GL_API void GL_APIENTRY glDepthFunc (GLenum func);
GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
GL_API void GL_APIENTRY glDisable (GLenum cap);
GL_API void GL_APIENTRY glDisableClientState (GLenum array);
GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
GL_API void GL_APIENTRY glEnable (GLenum cap);
GL_API void GL_APIENTRY glEnableClientState (GLenum array);
GL_API void GL_APIENTRY glFinish (void);
GL_API void GL_APIENTRY glFlush (void);
GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glFrontFace (GLenum mode);
GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
GL_API GLenum GL_APIENTRY glGetError (void);
GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params);
GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
GL_API void GL_APIENTRY glLoadIdentity (void);
GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glPointSizex (GLfixed size);
GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
GL_API void GL_APIENTRY glPopMatrix (void);
GL_API void GL_APIENTRY glPushMatrix (void);
GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_API void GL_APIENTRY glShadeModel (GLenum mode);
GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
GL_API void GL_APIENTRY glStencilMask (GLuint mask);
GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
/*------------------------------------------------------------------------*
* Required OES extension functions
*------------------------------------------------------------------------*/
/* GL_OES_read_format */
#ifndef GL_OES_read_format
#define GL_OES_read_format 1
#endif
/* GL_OES_compressed_paletted_texture */
#ifndef GL_OES_compressed_paletted_texture
#define GL_OES_compressed_paletted_texture 1
#endif
/* GL_OES_point_size_array */
#ifndef GL_OES_point_size_array
#define GL_OES_point_size_array 1
GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
#endif
/* GL_OES_point_sprite */
#ifndef GL_OES_point_sprite
#define GL_OES_point_sprite 1
#endif
#ifdef __cplusplus
}
#endif
#endif /* __gl_h_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
#ifndef __glplatform_h_
#define __glplatform_h_
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
#include <KHR/khrplatform.h>
#ifndef GL_API
#define GL_API KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __glplatform_h_ */

View file

@ -0,0 +1,302 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2009 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.
*/
/* Khronos platform-specific types and definitions.
*
* $Revision: 1.5 $ on $Date: 2010/06/03 16:51:55 $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by sending them to the public Khronos Bugzilla
* (http://khronos.org/bugzilla) by filing a bug against product
* "Khronos (general)" component "Registry".
*
* A predefined template which fills in some of the bug fields can be
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
* must create a Bugzilla login first.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if (defined(_WIN32) || defined(__VC32__)) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__)
# if defined (_DLL_EXPORTS)
# define KHRONOS_APICALL __declspec(dllexport)
# else
# define KHRONOS_APICALL __declspec(dllimport)
# endif
#elif defined (__SYMBIAN32__)
# if defined (__GCC32__)
# define KHRONOS_APICALL __declspec(dllexport)
# else
# define KHRONOS_APICALL IMPORT_C
# endif
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if defined(__SYMBIAN32__)
#include <e32def.h>
typedef TInt32 khronos_int32_t;
typedef TUint32 khronos_uint32_t;
typedef TInt64 khronos_int64_t;
typedef TUint64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_UITRON_)
/*
* uITRON
*/
typedef signed int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
typedef long long khronos_int64_t;
typedef unsigned long long khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

View file

@ -21,21 +21,6 @@
// by default, we disable the windows menu keys (F10, ALT and ALT+SPACE key doesn't freeze or open the menu)
#define NL_DISABLE_MENU
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <windows.h>
# include <windowsx.h>
# include <string>
# include <GL/gl.h>
#elif defined(NL_OS_MAC)
#elif defined (NL_OS_UNIX)
# include <GL/gl.h>
# include <GL/glx.h>
#endif // NL_OS_UNIX
#include <vector>
#include "nel/3d/viewport.h"
#include "nel/3d/scissor.h"
#include "nel/3d/u_driver.h"
@ -80,46 +65,50 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
#endif /* NL_OS_WINDOWS */
#ifdef USE_OPENGLES
class CDriverGLEsNelLibrary : public INelLibrary {
void onLibraryLoaded(bool firstTime) { }
void onLibraryUnloaded(bool lastTime) { }
};
NLMISC_DECL_PURE_LIB(CDriverGLEsNelLibrary)
#else
class CDriverGLNelLibrary : public INelLibrary {
void onLibraryLoaded(bool firstTime) { }
void onLibraryUnloaded(bool lastTime) { }
};
NLMISC_DECL_PURE_LIB(CDriverGLNelLibrary)
#endif
#endif /* #ifndef NL_STATIC */
namespace NL3D
{
CMaterial::CTexEnv CDriverGL::_TexEnvReplace;
#ifdef NL_OS_WINDOWS
uint CDriverGL::_Registered=0;
#endif // NL_OS_WINDOWS
// Version of the driver. Not the interface version!! Increment when implementation of the driver change.
const uint32 CDriverGL::ReleaseVersion = 0x11;
// Number of register to allocate for the EXTVertexShader extension
const uint CDriverGL::_EVSNumConstant = 97;
#ifdef NL_OS_WINDOWS
namespace NL3D {
#ifdef NL_STATIC
# pragma comment(lib, "opengl32")
# pragma comment(lib, "dinput8")
# pragma comment(lib, "dxguid")
#ifdef USE_OPENGLES
IDriver* createGlDriverInstance ()
IDriver* createGlEsDriverInstance ()
{
return new CDriverGL;
return new NLDRIVERGLES::CDriverGL;
}
#else
IDriver* createGlDriverInstance ()
{
return new NLDRIVERGL::CDriverGL;
}
#endif
#else
#ifdef NL_OS_WINDOWS
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
{
return new CDriverGL;
@ -130,19 +119,8 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
return IDriver::InterfaceVersion;
}
#endif
#elif defined (NL_OS_UNIX)
#ifdef NL_STATIC
IDriver* createGlDriverInstance ()
{
return new CDriverGL;
}
#else
extern "C"
{
IDriver* NL3D_createIDriverInstance ()
@ -156,18 +134,48 @@ extern "C"
}
}
#endif // NL_OS_WINDOWS
#endif // NL_STATIC
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
#endif // NL_OS_UNIX
CMaterial::CTexEnv CDriverGL::_TexEnvReplace;
#ifdef NL_OS_WINDOWS
uint CDriverGL::_Registered=0;
#endif // NL_OS_WINDOWS
// Version of the driver. Not the interface version!! Increment when implementation of the driver change.
const uint32 CDriverGL::ReleaseVersion = 0x11;
// Number of register to allocate for the EXTVertexShader extension
const uint CDriverGL::_EVSNumConstant = 97;
GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] =
{
#ifdef USE_OPENGLES
GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
#else
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
#endif
};
// ***************************************************************************
@ -175,7 +183,13 @@ CDriverGL::CDriverGL()
{
H_AUTO_OGL(CDriverGL_CDriverGL)
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
_EglDisplay = 0;
_EglContext = 0;
_EglSurface = 0;
#elif defined(NL_OS_WINDOWS)
_PBuffer = NULL;
_hRC = NULL;
@ -296,7 +310,11 @@ CDriverGL::CDriverGL()
for(i=0; i < IDRV_MAT_MAXTEXTURES; i++)
{
_MaterialAllTextureTouchedFlag|= IDRV_TOUCHED_TEX[i];
#ifdef GL_NONE
_CurrentTexAddrMode[i] = GL_NONE;
#else
_CurrentTexAddrMode[i] = 0;
#endif
}
_UserTexMatEnabled = 0;
@ -381,7 +399,9 @@ bool CDriverGL::setupDisplay()
for(uint i = 0; i < lines.size(); i++)
nlinfo("3D: %s", lines[i].c_str());
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
registerEGlExtensions(_Extensions, _EglDisplay);
#elif defined(NL_OS_WINDOWS)
registerWGlExtensions(_Extensions, _hDC);
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
@ -421,18 +441,30 @@ bool CDriverGL::setupDisplay()
glViewport(0,0,_CurrentMode.Width,_CurrentMode.Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef USE_OPENGLES
glOrthof(0.f,_CurrentMode.Width,_CurrentMode.Height,0.f,-1.0f,1.0f);
#else
glOrtho(0,_CurrentMode.Width,_CurrentMode.Height,0,-1.0f,1.0f);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
#ifndef USE_OPENGLES
glDisable(GL_AUTO_NORMAL);
#endif
glDisable(GL_COLOR_MATERIAL);
#ifndef USE_OPENGLES
glEnable(GL_DITHER);
#endif
glDisable(GL_FOG);
glDisable(GL_LINE_SMOOTH);
#ifndef USE_OPENGLES
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
#endif
glEnable(GL_DEPTH_TEST);
glDisable(GL_NORMALIZE);
#ifndef USE_OPENGLES
glDisable(GL_COLOR_SUM_EXT);
#endif
_CurrViewport.init(0.f, 0.f, 1.f, 1.f);
_CurrScissor.initFullScreen();
@ -451,7 +483,9 @@ bool CDriverGL::setupDisplay()
// Be always in EXTSeparateSpecularColor.
if(_Extensions.EXTSeparateSpecularColor)
{
#ifndef USE_OPENGLES
glLightModeli((GLenum)GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
#endif
}
_VertexProgramEnabled= false;
@ -470,6 +504,7 @@ bool CDriverGL::setupDisplay()
_SupportVBHard= true;
_MaxVerticesByVBHard = std::numeric_limits<uint32>::max(); // cant' know the value..
}
#ifndef USE_OPENGLES
// Next with NVidia ext
else if(_Extensions.NVVertexArrayRange)
{
@ -500,6 +535,7 @@ bool CDriverGL::setupDisplay()
// tmp fix for ati
_MaxVerticesByVBHard= 16777216;
}
#endif
// Reset VertexArrayRange.
_CurrentVertexArrayRange= NULL;
@ -559,6 +595,7 @@ bool CDriverGL::setupDisplay()
// set All TexGen by default to identity matrix (prefer use the textureMatrix scheme)
_DriverGLStates.activeTextureARB(stage);
#ifndef USE_OPENGLES
GLfloat params[4];
params[0]=1; params[1]=0; params[2]=0; params[3]=0;
glTexGenfv(GL_S, GL_OBJECT_PLANE, params);
@ -572,6 +609,7 @@ bool CDriverGL::setupDisplay()
params[0]=0; params[1]=0; params[2]=0; params[3]=1;
glTexGenfv(GL_Q, GL_OBJECT_PLANE, params);
glTexGenfv(GL_Q, GL_EYE_PLANE, params);
#endif
}
resetTextureShaders();
@ -603,6 +641,7 @@ bool CDriverGL::setupDisplay()
// check whether per pixel lighting shader is supported
checkForPerPixelLightingSupport();
#ifndef USE_OPENGLES
// if EXTVertexShader is used, bind the standard GL arrays, and allocate constant
if (!_Extensions.NVVertexProgram && !_Extensions.ARBVertexProgram && _Extensions.EXTVertexShader)
{
@ -639,6 +678,7 @@ bool CDriverGL::setupDisplay()
}
}
}
#endif
// Reset the vbl interval
setSwapVBLInterval(_Interval);
@ -685,7 +725,11 @@ bool CDriverGL::activeFrameBufferObject(ITexture * tex)
}
else
{
#ifdef USE_OPENGLES
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
#else
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
#endif
return true;
}
}
@ -717,7 +761,9 @@ void CDriverGL::disableHardwareTextureShader()
// --------------------------------------------------
void CDriverGL::resetTextureShaders()
{
H_AUTO_OGL(CDriverGL_resetTextureShaders)
H_AUTO_OGL(CDriverGL_resetTextureShaders);
#ifndef USE_OPENGLES
if (_Extensions.NVTextureShader)
{
glEnable(GL_TEXTURE_SHADER_NV);
@ -739,6 +785,7 @@ void CDriverGL::resetTextureShaders()
_NVTextureShaderEnabled = false;
}
#endif
}
// --------------------------------------------------
@ -773,8 +820,13 @@ bool CDriverGL::clear2D(CRGBA rgba)
// --------------------------------------------------
bool CDriverGL::clearZBuffer(float zval)
{
H_AUTO_OGL(CDriverGL_clearZBuffer)
H_AUTO_OGL(CDriverGL_clearZBuffer);
#ifdef USE_OPENGLES
glClearDepthf(zval);
#else
glClearDepth(zval);
#endif
_DriverGLStates.enableZWrite(true);
glClear(GL_DEPTH_BUFFER_BIT);
@ -810,6 +862,7 @@ bool CDriverGL::swapBuffers()
//resetTextureShaders();
activeVertexProgram(NULL);
#ifndef USE_OPENGLES
/* Yoyo: must do this (GeForce bug ??) else weird results if end render with a VBHard.
Setup a std vertex buffer to ensure NVidia synchronisation.
*/
@ -872,6 +925,7 @@ bool CDriverGL::swapBuffers()
itVBHard++;
}
}
#endif
#ifdef NL_OS_WINDOWS
if (_EventEmitter.getNumEmitters() > 1) // is direct input running ?
@ -887,7 +941,11 @@ bool CDriverGL::swapBuffers()
if (_VRAMVertexArrayRange) _VRAMVertexArrayRange->updateLostBuffers();
}
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
eglSwapBuffers (_EglDisplay, _EglSurface);
#elif defined(NL_OS_WINDOWS)
SwapBuffers(_hDC);
@ -908,6 +966,7 @@ bool CDriverGL::swapBuffers()
#endif // NL_OS_WINDOWS
#ifndef USE_OPENGLES
// Activate the default texture environnments for all stages.
//===========================================================
// This is not a requirement, but it ensure a more stable state each frame.
@ -935,6 +994,8 @@ bool CDriverGL::swapBuffers()
glDisable(GL_TEXTURE_SHADER_NV);
_NVTextureShaderEnabled = false;
}
#endif
_CurrentMaterial= NULL;
// Reset the profiling counter.
@ -1184,9 +1245,14 @@ void CDriverGL::getZBufferPart (std::vector<float> &zbuffer, NLMISC::CRect &rec
if(clipRect(rect))
{
zbuffer.resize(rect.Width*rect.Height);
#ifdef USE_OPENGLES
glReadPixels (rect.X, rect.Y, rect.Width, rect.Height, GL_DEPTH_COMPONENT16_OES, GL_FLOAT, &(zbuffer[0]));
#else
glPixelTransferf(GL_DEPTH_SCALE, 1.0f) ;
glPixelTransferf(GL_DEPTH_BIAS, 0.f) ;
glReadPixels (rect.X, rect.Y, rect.Width, rect.Height, GL_DEPTH_COMPONENT , GL_FLOAT, &(zbuffer[0]));
#endif
}
}
@ -1215,8 +1281,23 @@ bool CDriverGL::fillBuffer (CBitmap &bitmap)
if( rect.Width!=bitmap.getWidth() || rect.Height!=bitmap.getHeight() || bitmap.getPixelFormat()!=CBitmap::RGBA )
return false;
#ifdef USE_OPENGLES
GLuint textureId;
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rect.Width, rect.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &(bitmap.getPixels()[0]));
// glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, smBackgroundCrop,0);
nglDrawTexfOES(0.f, 0.f, 0.f, 1.f, 1.f);
#else
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glDrawPixels (rect.Width, rect.Height, GL_RGBA, GL_UNSIGNED_BYTE, &(bitmap.getPixels()[0]) );
#endif
return true;
}
@ -1245,15 +1326,22 @@ void CDriverGL::copyFrameBufferToTexture(ITexture *tex,
_DriverGLStates.activeTextureARB(0);
// setup texture mode, after activeTextureARB()
CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D;
#ifndef USE_OPENGLES
if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV)
textureMode = CDriverGLStates::TextureRect;
#endif
_DriverGLStates.setTextureMode(textureMode);
if (tex->isTextureCube())
{
if(_Extensions.ARBTextureCubeMap)
{
#ifdef USE_OPENGLES
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
#else
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
#endif
glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height);
}
}
@ -1276,6 +1364,7 @@ void CDriverGL::setPolygonMode (TPolygonMode mode)
H_AUTO_OGL(CDriverGL_setPolygonMode )
IDriver::setPolygonMode (mode);
#ifndef USE_OPENGLES
// Set the polygon mode
switch (_PolygonMode)
{
@ -1289,6 +1378,7 @@ void CDriverGL::setPolygonMode (TPolygonMode mode)
glPolygonMode (GL_FRONT_AND_BACK, GL_POINT);
break;
}
#endif
}
// ***************************************************************************
@ -1488,7 +1578,10 @@ void CDriverGL::setMatrix2DForTextureOffsetAddrMode(const uint stage, const floa
//nlassert(supportTextureShaders());
nlassert(stage < inlGetNumTextStages() );
_DriverGLStates.activeTextureARB(stage);
#ifndef USE_OPENGLES
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat);
#endif
}
@ -1499,7 +1592,7 @@ void CDriverGL::enableNVTextureShader(bool enabled)
if (enabled != _NVTextureShaderEnabled)
{
#ifndef USE_OPENGLES
if (enabled)
{
glEnable(GL_TEXTURE_SHADER_NV);
@ -1508,6 +1601,7 @@ void CDriverGL::enableNVTextureShader(bool enabled)
{
glDisable(GL_TEXTURE_SHADER_NV);
}
#endif
_NVTextureShaderEnabled = enabled;
}
}
@ -1568,8 +1662,11 @@ void CDriverGL::setBlendConstantColor(NLMISC::CRGBA col)
// update GL
if(!_Extensions.EXTBlendColor)
return;
#ifndef USE_OPENGLES
static const float OO255= 1.0f/255;
nglBlendColorEXT(col.R*OO255, col.G*OO255, col.B*OO255, col.A*OO255);
#endif
}
// ***************************************************************************
@ -1623,6 +1720,7 @@ void CDriverGL::setEMBMMatrix(const uint stage,const float mat[4])
{
H_AUTO_OGL(CDriverGL_setEMBMMatrix)
#ifndef USE_OPENGLES
nlassert(supportEMBM());
nlassert(stage < IDRV_MAT_MAXTEXTURES);
//
@ -1631,13 +1729,15 @@ void CDriverGL::setEMBMMatrix(const uint stage,const float mat[4])
_DriverGLStates.activeTextureARB(stage);
nglTexBumpParameterfvATI(GL_BUMP_ROT_MATRIX_ATI, const_cast<float *>(mat));
}
#endif
}
// ***************************************************************************
void CDriverGL::initEMBM()
{
H_AUTO_OGL(CDriverGL_initEMBM)
H_AUTO_OGL(CDriverGL_initEMBM);
#ifndef USE_OPENGLES
if (supportEMBM())
{
std::fill(_StageSupportEMBM, _StageSupportEMBM + IDRV_MAT_MAXTEXTURES, false);
@ -1687,6 +1787,7 @@ void CDriverGL::initEMBM()
_DriverGLStates.activeTextureARB(0);
}
}
#endif
}
// ***************************************************************************
@ -1832,6 +1933,8 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra
nlwarning("The param 'prog' is null, cannot load");
return 0;
}
#ifndef USE_OPENGLES
GLuint progID;
nglGenProgramsARB(1, &progID);
if (!progID)
@ -1859,6 +1962,8 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra
{
nlwarning("init fragment program failed: errorPos: %d isNative: %d: %s", errorPos, isNative, (const char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
#endif
return 0;
}
@ -1869,11 +1974,12 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra
*/
static void fetchPerturbedEnvMapR200()
{
H_AUTO_OGL(CDriverGL_fetchPerturbedEnvMapR200)
H_AUTO_OGL(CDriverGL_fetchPerturbedEnvMapR200);
#ifndef USE_OPENGLES
////////////
// PASS 1 //
////////////
nglSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI); // sample bump map 0
nglSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI); // sample bump map 1
nglPassTexCoordATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI); // get texcoord for envmap
@ -1885,6 +1991,7 @@ static void fetchPerturbedEnvMapR200()
// PASS 2 //
////////////
nglSampleMapATI(GL_REG_2_ATI, GL_REG_2_ATI, GL_SWIZZLE_STR_ATI); // fetch envmap at perturbed texcoords
#endif
}
// ***************************************************************************
@ -1896,8 +2003,9 @@ void CDriverGL::forceNativeFragmentPrograms(bool nativeOnly)
// ***************************************************************************
void CDriverGL::initFragmentShaders()
{
H_AUTO_OGL(CDriverGL_initFragmentShaders)
H_AUTO_OGL(CDriverGL_initFragmentShaders);
#ifndef USE_OPENGLES
///////////////////
// WATER SHADERS //
///////////////////
@ -2006,13 +2114,15 @@ void CDriverGL::initFragmentShaders()
}
// if none of the previous programs worked, fallback on NV_texture_shader, or (todo) simpler shader
#endif
}
// ***************************************************************************
void CDriverGL::deleteARBFragmentPrograms()
{
H_AUTO_OGL(CDriverGL_deleteARBFragmentPrograms)
H_AUTO_OGL(CDriverGL_deleteARBFragmentPrograms);
#ifndef USE_OPENGLES
for(uint k = 0; k < 4; ++k)
{
if (ARBWaterShader[k])
@ -2022,6 +2132,7 @@ void CDriverGL::deleteARBFragmentPrograms()
ARBWaterShader[k] = 0;
}
}
#endif
}
// ***************************************************************************
@ -2029,6 +2140,7 @@ void CDriverGL::deleteFragmentShaders()
{
H_AUTO_OGL(CDriverGL_deleteFragmentShaders)
#ifndef USE_OPENGLES
deleteARBFragmentPrograms();
if (ATIWaterShaderHandleNoDiffuseMap)
@ -2046,6 +2158,7 @@ void CDriverGL::deleteFragmentShaders()
nglDeleteFragmentShaderATI((GLuint) ATICloudShaderHandle);
ATICloudShaderHandle = 0;
}
#endif
}
// ***************************************************************************
@ -2072,7 +2185,9 @@ void CDriverGL::setSwapVBLInterval(uint interval)
bool res = true;
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
res = eglSwapInterval(_EglDisplay, _Interval) == EGL_TRUE;
#elif defined(NL_OS_WINDOWS)
if(_Extensions.WGLEXTSwapControl)
{
res = nwglSwapIntervalEXT(_Interval) == TRUE;
@ -2108,7 +2223,8 @@ uint CDriverGL::getSwapVBLInterval()
{
H_AUTO_OGL(CDriverGL_getSwapVBLInterval)
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
#elif defined(NL_OS_WINDOWS)
if(_Extensions.WGLEXTSwapControl)
{
return nwglGetSwapIntervalEXT();
@ -2135,12 +2251,14 @@ uint CDriverGL::getSwapVBLInterval()
// ***************************************************************************
void CDriverGL::enablePolygonSmoothing(bool smooth)
{
H_AUTO_OGL(CDriverGL_enablePolygonSmoothing)
H_AUTO_OGL(CDriverGL_enablePolygonSmoothing);
#ifndef USE_OPENGLES
if(smooth)
glEnable(GL_POLYGON_SMOOTH);
else
glDisable(GL_POLYGON_SMOOTH);
#endif
_PolygonSmooth= smooth;
}
@ -2576,6 +2694,8 @@ IOcclusionQuery *CDriverGL::createOcclusionQuery()
{
H_AUTO_OGL(CDriverGL_createOcclusionQuery)
nlassert(_Extensions.NVOcclusionQuery);
#ifndef USE_OPENGLES
GLuint id;
nglGenOcclusionQueriesNV(1, &id);
if (id == 0) return NULL;
@ -2587,12 +2707,17 @@ IOcclusionQuery *CDriverGL::createOcclusionQuery()
oqgl->Iterator = _OcclusionQueryList.begin();
oqgl->VisibleCount = 0;
return oqgl;
#else
return NULL;
#endif
}
// ***************************************************************************
void CDriverGL::deleteOcclusionQuery(IOcclusionQuery *oq)
{
H_AUTO_OGL(CDriverGL_deleteOcclusionQuery)
H_AUTO_OGL(CDriverGL_deleteOcclusionQuery);
#ifndef USE_OPENGLES
if (!oq) return;
COcclusionQueryGL *oqgl = NLMISC::safe_cast<COcclusionQueryGL *>(oq);
nlassert((CDriverGL *) oqgl->Driver == this); // should come from the same driver
@ -2606,12 +2731,15 @@ void CDriverGL::deleteOcclusionQuery(IOcclusionQuery *oq)
_CurrentOcclusionQuery = NULL;
}
delete oqgl;
#endif
}
// ***************************************************************************
void COcclusionQueryGL::begin()
{
H_AUTO_OGL(COcclusionQueryGL_begin)
H_AUTO_OGL(COcclusionQueryGL_begin);
#ifndef USE_OPENGLES
nlassert(Driver);
nlassert(Driver->_CurrentOcclusionQuery == NULL); // only one query at a time
nlassert(ID);
@ -2619,23 +2747,29 @@ void COcclusionQueryGL::begin()
Driver->_CurrentOcclusionQuery = this;
OcclusionType = NotAvailable;
VisibleCount = 0;
#endif
}
// ***************************************************************************
void COcclusionQueryGL::end()
{
H_AUTO_OGL(COcclusionQueryGL_end)
H_AUTO_OGL(COcclusionQueryGL_end);
#ifndef USE_OPENGLES
nlassert(Driver);
nlassert(Driver->_CurrentOcclusionQuery == this); // only one query at a time
nlassert(ID);
nglEndOcclusionQueryNV();
Driver->_CurrentOcclusionQuery = NULL;
#endif
}
// ***************************************************************************
IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType()
{
H_AUTO_OGL(COcclusionQueryGL_getOcclusionType)
H_AUTO_OGL(COcclusionQueryGL_getOcclusionType);
#ifndef USE_OPENGLES
nlassert(Driver);
nlassert(ID);
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
@ -2652,6 +2786,7 @@ IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType()
// Note : we could return the exact number of pixels that passed the z-test, but this value is not supported by all implementation (Direct3D ...)
}
}
#endif
return OcclusionType;
}
@ -2799,8 +2934,6 @@ void CDriverGL::endDialogMode()
{
}
} // NL3D
// ***************************************************************************
void displayGLError(GLenum error)
{
@ -2818,3 +2951,9 @@ void displayGLError(GLenum error)
break;
}
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -26,21 +26,10 @@
# define H_AUTO_OGL(label)
#endif
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <windows.h>
# include <GL/gl.h>
#elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY
#ifdef NL_OS_MAC
# import <Cocoa/Cocoa.h>
# include <OpenGL/gl.h>
# include "mac/glext.h"
# import "mac/cocoa_opengl_view.h"
#elif defined (NL_OS_UNIX)
# define GLX_GLXEXT_PROTOTYPES
# include <GL/gl.h>
# include <GL/glx.h>
# ifdef XF86VIDMODE
# include <X11/extensions/xf86vmode.h>
# endif //XF86VIDMODE
@ -87,8 +76,6 @@
#define NL3D_DRV_MAX_LIGHTMAP 256
void displayGLError(GLenum error);
/*
#define CHECK_GL_ERROR { \
GLenum error = glGetError(); \
@ -102,17 +89,26 @@ void displayGLError(GLenum error);
#define UNSUPPORTED_INDEX_OFFSET_MSG "Unsupported by driver, check IDriver::supportIndexOffset."
namespace NL3D {
using NLMISC::CMatrix;
using NLMISC::CVector;
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
class CDriverGL;
class IVertexArrayRange;
class IVertexBufferHardGL;
class COcclusionQueryGL;
void displayGLError(GLenum error);
#ifdef NL_OS_WINDOWS
bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
@ -683,26 +679,28 @@ public:
virtual void stencilOp(TStencilOp fail, TStencilOp zfail, TStencilOp zpass);
virtual void stencilMask(uint mask);
GfxMode _CurrentMode;
sint32 _WindowX;
sint32 _WindowY;
#ifdef NL_OS_MAC
NLMISC::CCocoaEventEmitter _EventEmitter;
#endif
private:
virtual class IVertexBufferHardGL *createVertexBufferHard(uint size, uint numVertices, CVertexBuffer::TPreferredMemory vbType, CVertexBuffer *vb);
friend class CTextureDrvInfosGL;
friend class CVertexProgamDrvInfosGL;
private:
// Version of the driver. Not the interface version!! Increment when implementation of the driver change.
static const uint32 ReleaseVersion;
// Windows
nlWindow _win;
sint32 _WindowX;
sint32 _WindowY;
bool _WindowVisible;
bool _DestroyWindow;
bool _Maximized;
GfxMode _CurrentMode;
uint _Interval;
bool _Resizable;
@ -764,31 +762,37 @@ private:
TCursorMap _Cursors;
#ifdef USE_OPENGLES
EGLDisplay _EglDisplay;
EGLContext _EglContext;
EGLSurface _EglSurface;
#elif defined(NL_OS_WINDOWS)
HGLRC _hRC;
HDC _hDC;
PIXELFORMATDESCRIPTOR _pfd;
// Off-screen rendering in Dib section
HPBUFFERARB _PBuffer;
#elif defined(NL_OS_MAC)
NSOpenGLContext* _ctx;
#elif defined(NL_OS_UNIX)
GLXContext _ctx;
#endif
#ifdef NL_OS_WINDOWS
bool convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col = NLMISC::CRGBA::White, sint hotSpotX = 0, sint hotSpotY = 0, bool cursor = false);
friend bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
HDC _hDC;
PIXELFORMATDESCRIPTOR _pfd;
HGLRC _hRC;
static uint _Registered;
DEVMODE _OldScreenMode;
NLMISC::CEventEmitterMulti _EventEmitter; // this can contains a win emitter and eventually a direct input emitter
// Off-screen rendering in Dib section
HPBUFFERARB _PBuffer;
#elif defined(NL_OS_MAC)
friend bool GlWndProc(CDriverGL*, const void*);
friend void windowDidMove(NSWindow*, CDriverGL*);
friend void viewDidResize(NSView*, CDriverGL*);
friend NSApplicationTerminateReply applicationShouldTerminate(CDriverGL*);
NLMISC::CCocoaEventEmitter _EventEmitter;
NSOpenGLContext* _ctx;
CocoaOpenGLView* _glView;
NSAutoreleasePool* _autoreleasePool;
uint16 _backBufferHeight;
@ -804,7 +808,6 @@ private:
friend bool GlWndProc(CDriverGL *driver, XEvent &e);
Display* _dpy;
GLXContext _ctx;
NLMISC::CUnixEventEmitter _EventEmitter;
XVisualInfo* _visual_info;
uint32 _xrandr_version;
@ -963,6 +966,7 @@ private:
bool _CurrentGlNormalize;
private:
bool createContext();
bool setupDisplay();
bool unInit();
@ -1511,6 +1515,10 @@ public:
CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it);
};
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D
#endif // NL_DRIVER_OPENGL_H

View file

@ -16,18 +16,20 @@
#include "stdopengl.h"
#include "driver_opengl.h"
#include "driver_opengl_extension.h"
#include "nel/misc/common.h"
#include "driver_opengl.h"
#include "driver_opengl_extension.h"
#include "nel/3d/material.h"
using namespace std;
using namespace NLMISC;
// ***************************************************************************
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
#define nglGetProcAddress eglGetProcAddress
#elif defined(NL_OS_WINDOWS)
#define nglGetProcAddress wglGetProcAddress
#elif defined(NL_OS_MAC)
// #include <mach-o/dyld.h>
@ -63,6 +65,47 @@ void (*nglGetProcAddress(const char *procName))()
// ***************************************************************************
// The exported function names
#ifdef USE_OPENGLES
// GL_OES_mapbuffer
NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES;
NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData;
PFNGLDRAWTEXFOESPROC nglDrawTexfOES;
// GL_OES_framebuffer_object
NEL_PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES;
NEL_PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES;
NEL_PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES;
NEL_PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES;
NEL_PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES;
NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES;
NEL_PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES;
NEL_PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES;
NEL_PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES;
NEL_PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES;
NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES;
NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES;
NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES;
NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES;
NEL_PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES;
// GL_OES_texture_cube_map
NEL_PFNGLTEXGENFOESPROC nglTexGenfOES;
NEL_PFNGLTEXGENFVOESPROC nglTexGenfvOES;
NEL_PFNGLTEXGENIOESPROC nglTexGeniOES;
NEL_PFNGLTEXGENIVOESPROC nglTexGenivOES;
NEL_PFNGLTEXGENXOESPROC nglTexGenxOES;
NEL_PFNGLTEXGENXVOESPROC nglTexGenxvOES;
NEL_PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES;
NEL_PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES;
NEL_PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES;
#else
// ARB_multitexture
NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
NEL_PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB;
@ -468,14 +511,23 @@ NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
#endif
#endif // USE_OPENGLES
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
#define CHECK_EXT(ext_str) \
if(strstr(glext, ext_str)==NULL) { nlwarning("3D: OpengGL extension '%s' was not found", ext_str); return false; } else { nldebug("3D: OpengGL Extension '%s' found", ext_str); }
@ -493,6 +545,8 @@ namespace NL3D
static bool setupARBMultiTexture(const char *glext)
{
H_AUTO_OGL(setupARBMultiTexture);
#ifndef USE_OPENGLES
CHECK_EXT("GL_ARB_multitexture");
CHECK_ADDRESS(NEL_PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB);
@ -531,16 +585,21 @@ static bool setupARBMultiTexture(const char *glext)
CHECK_ADDRESS(NEL_PFNGLMULTITEXCOORD4IVARBPROC, glMultiTexCoord4ivARB);
CHECK_ADDRESS(NEL_PFNGLMULTITEXCOORD4FVARBPROC, glMultiTexCoord4fvARB);
CHECK_ADDRESS(NEL_PFNGLMULTITEXCOORD4DVARBPROC, glMultiTexCoord4dvARB);
#endif
return true;
}
// *********************************
static bool setupEXTTextureEnvCombine(const char *glext)
{
H_AUTO_OGL(setupEXTTextureEnvCombine);
#ifdef USE_OPENGLES
return true;
#else
return (strstr(glext, "GL_EXT_texture_env_combine")!=NULL || strstr(glext, "GL_ARB_texture_env_combine")!=NULL);
#endif
}
@ -548,6 +607,8 @@ static bool setupEXTTextureEnvCombine(const char *glext)
static bool setupARBTextureCompression(const char *glext)
{
H_AUTO_OGL(setupARBTextureCompression);
#ifndef USE_OPENGLES
CHECK_EXT("GL_ARB_texture_compression");
CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC, glCompressedTexImage3DARB);
@ -557,20 +618,52 @@ static bool setupARBTextureCompression(const char *glext)
CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC, glCompressedTexSubImage2DARB);
CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC, glCompressedTexSubImage1DARB);
CHECK_ADDRESS(NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC, glGetCompressedTexImageARB);
#endif
return true;
}
// *********************************
static bool setupARBTextureNonPowerOfTwo(const char *glext)
{
H_AUTO_OGL(setupARBTextureCompression);
#ifndef USE_OPENGL_ES
CHECK_EXT("GL_ARB_texture_non_power_of_two");
#endif
return true;
}
// ***************************************************************************
static bool setupOESMapBuffer(const char *glext)
{
H_AUTO_OGL(setupOESMapBuffer);
CHECK_EXT("OES_mapbuffer");
#ifdef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLMAPBUFFEROESPROC, glMapBufferOES);
CHECK_ADDRESS(NEL_PFNGLUNMAPBUFFEROESPROC, glUnmapBufferOES);
CHECK_ADDRESS(NEL_PFNGLGETBUFFERPOINTERVOESPROC, glGetBufferPointervOES);
#endif
return true;
}
// ***************************************************************************
static bool setupOESDrawTexture(const char *glext)
{
H_AUTO_OGL(setupOESDrawTexture);
CHECK_EXT("OES_draw_texture");
#ifdef USE_OPENGLES
CHECK_ADDRESS(PFNGLDRAWTEXFOESPROC, glDrawTexfOES);
#endif
return true;
}
// *********************************
static bool setupNVVertexArrayRange(const char *glext)
@ -583,6 +676,7 @@ static bool setupNVVertexArrayRange(const char *glext)
// Tess Fence too.
CHECK_EXT("GL_NV_fence");
#ifndef USE_OPENGLES
// Get VAR address.
CHECK_ADDRESS(NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC, glFlushVertexArrayRangeNV);
CHECK_ADDRESS(NEL_PFNGLVERTEXARRAYRANGENVPROC, glVertexArrayRangeNV);
@ -603,29 +697,38 @@ static bool setupNVVertexArrayRange(const char *glext)
CHECK_ADDRESS(NEL_PFNGLGETFENCEIVNVPROC, glGetFenceivNV);
CHECK_ADDRESS(NEL_PFNGLFINISHFENCENVPROC, glFinishFenceNV);
CHECK_ADDRESS(NEL_PFNGLSETFENCENVPROC, glSetFenceNV);
#endif
return true;
}
// *********************************
static bool setupEXTTextureCompressionS3TC(const char *glext)
{
H_AUTO_OGL(setupEXTTextureCompressionS3TC);
#ifdef USE_OPENGLES
CHECK_EXT("EXT_texture_compression_s3tc");
// TODO: check also for EXT_texture_compression_dxt1
#else
CHECK_EXT("GL_EXT_texture_compression_s3tc");
// TODO: check also for GL_S3_s3tc, GL_EXT_texture_compression_dxt1
#endif
return true;
}
// *********************************
static bool setupEXTVertexWeighting(const char *glext)
{
H_AUTO_OGL(setupEXTVertexWeighting);
CHECK_EXT("GL_EXT_vertex_weighting");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLVERTEXWEIGHTFEXTPROC, glVertexWeightfEXT);
CHECK_ADDRESS(NEL_PFNGLVERTEXWEIGHTFVEXTPROC, glVertexWeightfvEXT);
CHECK_ADDRESS(NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC, glVertexWeightPointerEXT);
#endif
return true;
}
@ -679,6 +782,9 @@ static bool setupATIEnvMapBumpMap(const char *glext)
H_AUTO_OGL(setupATIEnvMapBumpMap);
CHECK_EXT("GL_ATI_envmap_bumpmap");
GLint num = -1;
#ifndef USE_OPENGLES
CHECK_ADDRESS(PFNGLTEXBUMPPARAMETERIVATIPROC, glTexBumpParameterivATI);
CHECK_ADDRESS(PFNGLTEXBUMPPARAMETERFVATIPROC, glTexBumpParameterfvATI);
CHECK_ADDRESS(PFNGLGETTEXBUMPPARAMETERIVATIPROC, glGetTexBumpParameterivATI);
@ -686,8 +792,8 @@ static bool setupATIEnvMapBumpMap(const char *glext)
// Check for broken ATI drivers and disable EMBM if we caught one.
// Reminder: This code crashes with Catalyst 7.11 fglrx drivers!
GLint num = -1;
nglGetTexBumpParameterivATI(GL_BUMP_NUM_TEX_UNITS_ATI, &num);
#endif
return num > 0;
}
@ -696,7 +802,23 @@ static bool setupATIEnvMapBumpMap(const char *glext)
static bool setupARBTextureCubeMap(const char *glext)
{
H_AUTO_OGL(setupARBTextureCubeMap);
#ifdef USE_OPENGLES
CHECK_EXT("OES_texture_cube_map");
#else
CHECK_EXT("GL_ARB_texture_cube_map");
#endif
// CHECK_ADDRESS(NEL_PFNGLTEXGENFOESPROC, glTexGenfOES);
// CHECK_ADDRESS(NEL_PFNGLTEXGENFVOESPROC, glTexGenfvOES);
// CHECK_ADDRESS(NEL_PFNGLTEXGENIOESPROC, glTexGeniOES);
// CHECK_ADDRESS(NEL_PFNGLTEXGENIVOESPROC, glTexGenivOES);
// CHECK_ADDRESS(NEL_PFNGLTEXGENXOESPROC, glTexGenxOES);
// CHECK_ADDRESS(NEL_PFNGLTEXGENXVOESPROC, glTexGenxvOES);
// CHECK_ADDRESS(NEL_PFNGLGETTEXGENFVOESPROC, glGetTexGenfvOES);
// CHECK_ADDRESS(NEL_PFNGLGETTEXGENIVOESPROC, glGetTexGenivOES);
// CHECK_ADDRESS(NEL_PFNGLGETTEXGENXVOESPROC, glGetTexGenxvOES);
return true;
}
@ -714,6 +836,8 @@ static bool setupNVVertexProgram(const char *glext)
// #endif
CHECK_EXT("GL_NV_vertex_program");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLAREPROGRAMSRESIDENTNVPROC, glAreProgramsResidentNV);
CHECK_ADDRESS(NEL_PFNGLBINDPROGRAMNVPROC, glBindProgramNV);
CHECK_ADDRESS(NEL_PFNGLDELETEPROGRAMSNVPROC, glDeleteProgramsNV);
@ -777,6 +901,7 @@ static bool setupNVVertexProgram(const char *glext)
CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBS4FVNVPROC, glVertexAttribs4fvNV);
CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBS4SVNVPROC, glVertexAttribs4svNV);
CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBS4UBVNVPROC, glVertexAttribs4ubvNV);
#endif
return true;
}
@ -787,6 +912,7 @@ static bool setupEXTVertexShader(const char *glext)
H_AUTO_OGL(setupEXTVertexShader);
CHECK_EXT("GL_EXT_vertex_shader");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLBEGINVERTEXSHADEREXTPROC, glBeginVertexShaderEXT);
CHECK_ADDRESS(NEL_PFNGLENDVERTEXSHADEREXTPROC, glEndVertexShaderEXT);
CHECK_ADDRESS(NEL_PFNGLBINDVERTEXSHADEREXTPROC, glBindVertexShaderEXT);
@ -849,6 +975,7 @@ static bool setupEXTVertexShader(const char *glext)
GLint numVSVariants;
glGetIntegerv(GL_MAX_VERTEX_SHADER_VARIANTS_EXT, &numVSVariants);
if (numVSInvariants < 4) return false;
#endif
return true;
@ -861,6 +988,7 @@ static bool setupEXTSecondaryColor(const char *glext)
H_AUTO_OGL(setupEXTSecondaryColor);
CHECK_EXT("GL_EXT_secondary_color");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3BEXTPROC, glSecondaryColor3bEXT);
CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3BVEXTPROC, glSecondaryColor3bvEXT);
CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3DEXTPROC, glSecondaryColor3dEXT);
@ -878,6 +1006,7 @@ static bool setupEXTSecondaryColor(const char *glext)
CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3USEXTPROC, glSecondaryColor3usEXT);
CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3USVEXTPROC, glSecondaryColor3usvEXT);
CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT);
#endif
return true;
}
@ -888,12 +1017,14 @@ static bool setupWGLARBPBuffer(const char *glext)
H_AUTO_OGL(setupWGLARBPBuffer);
CHECK_EXT("WGL_ARB_pbuffer");
#ifndef USE_OPENGLES
#ifdef NL_OS_WINDOWS
CHECK_ADDRESS(PFNWGLCREATEPBUFFERARBPROC, wglCreatePbufferARB);
CHECK_ADDRESS(PFNWGLGETPBUFFERDCARBPROC, wglGetPbufferDCARB);
CHECK_ADDRESS(PFNWGLRELEASEPBUFFERDCARBPROC, wglReleasePbufferDCARB);
CHECK_ADDRESS(PFNWGLDESTROYPBUFFERARBPROC, wglDestroyPbufferARB);
CHECK_ADDRESS(PFNWGLQUERYPBUFFERARBPROC, wglQueryPbufferARB);
#endif
#endif
return true;
@ -905,7 +1036,9 @@ static bool setupARBMultisample(const char *glext)
H_AUTO_OGL(setupARBMultisample);
CHECK_EXT("GL_ARB_multisample");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLSAMPLECOVERAGEARBPROC, glSampleCoverageARB);
#endif
return true;
}
@ -917,9 +1050,11 @@ static bool setupWGLARBPixelFormat (const char *glext)
H_AUTO_OGL(setupWGLARBPixelFormat);
CHECK_EXT("WGL_ARB_pixel_format");
#ifndef USE_OPENGLES
CHECK_ADDRESS(PFNWGLGETPIXELFORMATATTRIBIVARBPROC, wglGetPixelFormatAttribivARB);
CHECK_ADDRESS(PFNWGLGETPIXELFORMATATTRIBFVARBPROC, wglGetPixelFormatAttribfvARB);
CHECK_ADDRESS(PFNWGLCHOOSEPIXELFORMATARBPROC, wglChoosePixelFormatARB);
#endif
return true;
}
@ -947,7 +1082,11 @@ static bool setupEXTBlendColor(const char *glext)
{
H_AUTO_OGL(setupEXTBlendColor);
CHECK_EXT("GL_EXT_blend_color");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLBLENDCOLOREXTPROC, glBlendColorEXT);
#endif
return true;
}
@ -966,6 +1105,7 @@ static bool setupATIVertexArrayObject(const char *glext)
H_AUTO_OGL(setupATIVertexArrayObject);
CHECK_EXT("GL_ATI_vertex_array_object");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLNEWOBJECTBUFFERATIPROC, glNewObjectBufferATI);
CHECK_ADDRESS(NEL_PFNGLISOBJECTBUFFERATIPROC, glIsObjectBufferATI);
CHECK_ADDRESS(NEL_PFNGLUPDATEOBJECTBUFFERATIPROC, glUpdateObjectBufferATI);
@ -992,6 +1132,8 @@ static bool setupATIVertexArrayObject(const char *glext)
CHECK_ADDRESS(NEL_PFNGLGETVARIANTARRAYOBJECTFVATIPROC, glGetVariantArrayObjectfvATI);
CHECK_ADDRESS(NEL_PFNGLGETVARIANTARRAYOBJECTIVATIPROC, glGetVariantArrayObjectivATI);
}
#endif
return true;
}
@ -1000,8 +1142,12 @@ static bool setupATIMapObjectBuffer(const char *glext)
{
H_AUTO_OGL(setupATIMapObjectBuffer);
CHECK_EXT("GL_ATI_map_object_buffer");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLMAPOBJECTBUFFERATIPROC, glMapObjectBufferATI);
CHECK_ADDRESS(NEL_PFNGLUNMAPOBJECTBUFFERATIPROC, glUnmapObjectBufferATI);
#endif
return true;
}
@ -1013,6 +1159,7 @@ static bool setupATIFragmentShader(const char *glext)
H_AUTO_OGL(setupATIFragmentShader);
CHECK_EXT("GL_ATI_fragment_shader");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLGENFRAGMENTSHADERSATIPROC, glGenFragmentShadersATI);
CHECK_ADDRESS(NEL_PFNGLBINDFRAGMENTSHADERATIPROC, glBindFragmentShaderATI);
CHECK_ADDRESS(NEL_PFNGLDELETEFRAGMENTSHADERATIPROC, glDeleteFragmentShaderATI);
@ -1027,6 +1174,7 @@ static bool setupATIFragmentShader(const char *glext)
CHECK_ADDRESS(NEL_PFNGLALPHAFRAGMENTOP2ATIPROC, glAlphaFragmentOp2ATI);
CHECK_ADDRESS(NEL_PFNGLALPHAFRAGMENTOP3ATIPROC, glAlphaFragmentOp3ATI);
CHECK_ADDRESS(NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC, glSetFragmentShaderConstantATI);
#endif
return true;
}
@ -1037,9 +1185,11 @@ static bool setupATIVertexAttribArrayObject(const char *glext)
H_AUTO_OGL(setupATIVertexAttribArrayObject);
CHECK_EXT("GL_ATI_vertex_attrib_array_object");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC, glVertexAttribArrayObjectATI);
CHECK_ADDRESS(NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC, glGetVertexAttribArrayObjectfvATI);
CHECK_ADDRESS(NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC, glGetVertexAttribArrayObjectivATI);
#endif
return true;
}
@ -1050,6 +1200,7 @@ static bool setupARBFragmentProgram(const char *glext)
H_AUTO_OGL(setupARBFragmentProgram);
CHECK_EXT("GL_ARB_fragment_program");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLPROGRAMSTRINGARBPROC, glProgramStringARB);
CHECK_ADDRESS(NEL_PFNGLBINDPROGRAMARBPROC, glBindProgramARB);
CHECK_ADDRESS(NEL_PFNGLDELETEPROGRAMSARBPROC, glDeleteProgramsARB);
@ -1069,6 +1220,7 @@ static bool setupARBFragmentProgram(const char *glext)
CHECK_ADDRESS(NEL_PFNGLGETPROGRAMIVARBPROC, glGetProgramivARB);
CHECK_ADDRESS(NEL_PFNGLGETPROGRAMSTRINGARBPROC, glGetProgramStringARB);
CHECK_ADDRESS(NEL_PFNGLISPROGRAMARBPROC, glIsProgramARB);
#endif
return true;
}
@ -1077,6 +1229,8 @@ static bool setupARBFragmentProgram(const char *glext)
static bool setupARBVertexBufferObject(const char *glext)
{
H_AUTO_OGL(setupARBVertexBufferObject);
#ifndef USE_OPENGLES
CHECK_EXT("GL_ARB_vertex_buffer_object");
CHECK_ADDRESS(PFNGLBINDBUFFERARBPROC, glBindBufferARB);
@ -1090,6 +1244,7 @@ static bool setupARBVertexBufferObject(const char *glext)
CHECK_ADDRESS(PFNGLUNMAPBUFFERARBPROC, glUnmapBufferARB);
CHECK_ADDRESS(PFNGLGETBUFFERPARAMETERIVARBPROC, glGetBufferParameterivARB);
CHECK_ADDRESS(PFNGLGETBUFFERPOINTERVARBPROC, glGetBufferPointervARB);
#endif
return true;
}
@ -1100,6 +1255,7 @@ static bool setupARBVertexProgram(const char *glext)
H_AUTO_OGL(setupARBVertexProgram);
CHECK_EXT("GL_ARB_vertex_program");
#ifndef USE_OPENGLES
CHECK_ADDRESS(PFNGLVERTEXATTRIB1SARBPROC, glVertexAttrib1sARB);
CHECK_ADDRESS(PFNGLVERTEXATTRIB1FARBPROC, glVertexAttrib1fARB);
CHECK_ADDRESS(PFNGLVERTEXATTRIB1DARBPROC, glVertexAttrib1dARB);
@ -1162,6 +1318,7 @@ static bool setupARBVertexProgram(const char *glext)
CHECK_ADDRESS(PFNGLGETVERTEXATTRIBIVARBPROC, glGetVertexAttribivARB);
CHECK_ADDRESS(PFNGLGETVERTEXATTRIBPOINTERVARBPROC, glGetVertexAttribPointervARB);
CHECK_ADDRESS(PFNGLISPROGRAMARBPROC, glIsProgramARB);
#endif
return true;
}
@ -1172,6 +1329,7 @@ static bool setupNVOcclusionQuery(const char *glext)
H_AUTO_OGL(setupNVOcclusionQuery);
CHECK_EXT("GL_NV_occlusion_query");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLGENOCCLUSIONQUERIESNVPROC, glGenOcclusionQueriesNV);
CHECK_ADDRESS(NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC, glDeleteOcclusionQueriesNV);
CHECK_ADDRESS(NEL_PFNGLISOCCLUSIONQUERYNVPROC, glIsOcclusionQueryNV);
@ -1179,6 +1337,7 @@ static bool setupNVOcclusionQuery(const char *glext)
CHECK_ADDRESS(NEL_PFNGLENDOCCLUSIONQUERYNVPROC, glEndOcclusionQueryNV);
CHECK_ADDRESS(NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC, glGetOcclusionQueryivNV);
CHECK_ADDRESS(NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC, glGetOcclusionQueryuivNV);
#endif
return true;
}
@ -1204,7 +1363,11 @@ static bool setupEXTTextureRectangle(const char *glext)
static bool setupARBTextureRectangle(const char *glext)
{
H_AUTO_OGL(setupARBTextureRectangle);
#ifndef USE_OPENGLES
CHECK_EXT("GL_ARB_texture_rectangle");
#endif
return true;
}
@ -1220,6 +1383,26 @@ static bool setupEXTTextureFilterAnisotropic(const char *glext)
static bool setupFrameBufferObject(const char *glext)
{
H_AUTO_OGL(setupFrameBufferObject);
#ifdef USE_OPENGLES
CHECK_EXT("GL_OES_framebuffer_object");
CHECK_ADDRESS(NEL_PFNGLISRENDERBUFFEROESPROC, glIsRenderbufferOES);
CHECK_ADDRESS(NEL_PFNGLBINDRENDERBUFFEROESPROC, glBindRenderbufferOES);
CHECK_ADDRESS(NEL_PFNGLDELETERENDERBUFFERSOESPROC, glDeleteRenderbuffersOES);
CHECK_ADDRESS(NEL_PFNGLGENRENDERBUFFERSOESPROC, glGenRenderbuffersOES);
CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEOESPROC, glRenderbufferStorageOES);
CHECK_ADDRESS(NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC, glGetRenderbufferParameterivOES);
CHECK_ADDRESS(NEL_PFNGLISFRAMEBUFFEROESPROC, glIsFramebufferOES);
CHECK_ADDRESS(NEL_PFNGLBINDFRAMEBUFFEROESPROC, glBindFramebufferOES);
CHECK_ADDRESS(NEL_PFNGLDELETEFRAMEBUFFERSOESPROC, glDeleteFramebuffersOES);
CHECK_ADDRESS(NEL_PFNGLGENFRAMEBUFFERSOESPROC, glGenFramebuffersOES);
CHECK_ADDRESS(NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC, glCheckFramebufferStatusOES);
CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC, glFramebufferRenderbufferOES);
CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC, glFramebufferTexture2DOES);
CHECK_ADDRESS(NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC, glGetFramebufferAttachmentParameterivOES);
CHECK_ADDRESS(NEL_PFNGLGENERATEMIPMAPOESPROC, glGenerateMipmapOES);
#else
CHECK_EXT("GL_EXT_framebuffer_object");
CHECK_ADDRESS(NEL_PFNGLISRENDERBUFFEREXTPROC, glIsRenderbufferEXT);
@ -1236,6 +1419,7 @@ static bool setupFrameBufferObject(const char *glext)
CHECK_ADDRESS(NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT);
CHECK_ADDRESS(NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC, glGetRenderbufferParameterivEXT);
CHECK_ADDRESS(NEL_PFNGENERATEMIPMAPEXTPROC, glGenerateMipmapEXT);
#endif
return true;
}
@ -1246,7 +1430,9 @@ static bool setupFrameBufferBlit(const char *glext)
H_AUTO_OGL(setupFrameBufferBlit);
CHECK_EXT("GL_EXT_framebuffer_blit");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLBLITFRAMEBUFFEREXTPROC, glBlitFramebufferEXT);
#endif
return true;
}
@ -1257,7 +1443,9 @@ static bool setupFrameBufferMultisample(const char *glext)
H_AUTO_OGL(setupFrameBufferMultisample);
CHECK_EXT("GL_EXT_framebuffer_multisample");
#ifndef USE_OPENGLES
CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT);
#endif
return true;
}
@ -1266,7 +1454,13 @@ static bool setupFrameBufferMultisample(const char *glext)
static bool setupPackedDepthStencil(const char *glext)
{
H_AUTO_OGL(setupPackedDepthStencil);
#ifdef USE_OPENGLES
CHECK_EXT("GL_OES_packed_depth_stencil");
#else
CHECK_EXT("GL_EXT_packed_depth_stencil");
#endif
return true;
}
@ -1305,7 +1499,11 @@ void registerGlExtensions(CGlExtensions &ext)
ext.ARBMultiTexture= setupARBMultiTexture(glext);
if(ext.ARBMultiTexture)
{
#ifdef USE_OPENGLES
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ntext);
#else
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ntext);
#endif
// We could have more than IDRV_MAT_MAXTEXTURES but the interface only
// support IDRV_MAT_MAXTEXTURES texture stages so take min
ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES);
@ -1330,8 +1528,10 @@ void registerGlExtensions(CGlExtensions &ext)
if(ext.NVVertexArrayRange)
{
GLint nverts;
GLint nverts = 10;
#ifndef USE_OPENGLES
glGetIntegerv((GLenum)GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV, &nverts);
#endif
ext.NVVertexArrayRangeMaxVertex= nverts;
}
@ -1365,6 +1565,9 @@ void registerGlExtensions(CGlExtensions &ext)
ext.ARBVertexProgram = false;
}
ext.OESDrawTexture = setupOESDrawTexture(glext);
ext.OESMapBuffer = setupOESMapBuffer(glext);
// Check texture shaders
// Disable feature ???
if(!ext.DisableHardwareTextureShader)
@ -1395,6 +1598,7 @@ void registerGlExtensions(CGlExtensions &ext)
// Check NVVertexArrayRange2
ext.NVVertexArrayRange2= setupNVVertexArrayRange2(glext);
#ifdef GL_NV_vertex_array_range2
// if supported
if(ext.NVVertexArrayRange2)
// VBHard swap without flush of the VAR.
@ -1402,6 +1606,7 @@ void registerGlExtensions(CGlExtensions &ext)
else
// VBHard with useless flush of the VAR.
ext.NVStateVARWithoutFlush= GL_VERTEX_ARRAY_RANGE_NV;
#endif
// Check NV_occlusion_query
ext.NVOcclusionQuery = setupNVOcclusionQuery(glext);
@ -1476,9 +1681,11 @@ static bool setupWGLEXTSwapControl(const char *glext)
H_AUTO_OGL(setupWGLEXTSwapControl);
CHECK_EXT("WGL_EXT_swap_control");
#ifndef USE_OPENGLES
#ifdef NL_OS_WINDOWS
CHECK_ADDRESS(PFNWGLSWAPINTERVALEXTPROC, wglSwapIntervalEXT);
CHECK_ADDRESS(PFNWGLGETSWAPINTERVALEXTPROC, wglGetSwapIntervalEXT);
#endif
#endif
return true;
@ -1524,11 +1731,43 @@ static bool setupGLXMESASwapControl(const char *glext)
return true;
}
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
// ***************************************************************************
bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy)
{
H_AUTO_OGL(registerEGlExtensions);
// Get extension string
const char *glext = eglQueryString(dpy, EGL_EXTENSIONS);
if (glext == NULL)
{
nlwarning ("neglGetExtensionsStringARB failed");
return false;
}
nldebug("3D: Available EGL Extensions:");
if (DebugLog)
{
vector<string> exts;
explode(string(glext), string(" "), exts);
for(uint i = 0; i < exts.size(); i++)
{
if(i%5==0) DebugLog->displayRaw("3D: ");
DebugLog->displayRaw(string(exts[i]+" ").c_str());
if(i%5==4) DebugLog->displayRaw("\n");
}
DebugLog->displayRaw("\n");
}
return true;
}
#elif defined(NL_OS_WINDOWS)
// ***************************************************************************
bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
{
H_AUTO_OGL(registerWGlExtensions);
// Get proc address
CHECK_ADDRESS(PFNWGLGETEXTENSIONSSTRINGARBPROC, wglGetExtensionsStringARB);
@ -1609,6 +1848,10 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen)
return true;
}
#endif // NL_OS_WINDOWS
#endif // USE_OPENGLES
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -21,35 +21,17 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/string_common.h"
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <windows.h>
# include <GL/gl.h>
# include <GL/glext.h> // Please download it from http://www.opengl.org/registry/
#elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY
# include <OpenGL/gl.h>
# include "mac/glext.h"
#elif defined (NL_OS_UNIX)
# include <GL/gl.h>
# include <GL/glext.h> // Please download it from http://www.opengl.org/registry/
# include <GL/glx.h>
# include <GL/glxext.h>
#endif // NL_OS_UNIX
#ifndef GL_GLEXT_VERSION
# error "I need a newer <GL/glext.h>. Please download it from http://www.opengl.org/registry/"
#endif // GL_nGLEXT_VERSION
#if GL_GLEXT_VERSION < 7
# error "I need a newer <GL/glext.h>. Please download it from http://www.opengl.org/registry/"
#endif // GL_nGLEXT_VERSION < 7
#include "driver_opengl_extension_def.h"
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
/// The extensions used by NL3D.
@ -121,6 +103,9 @@ struct CGlExtensions
bool ARBTextureNonPowerOfTwo;
bool ARBMultisample;
bool OESDrawTexture;
bool OESMapBuffer;
public:
/// \name Disable Hardware feature. False by default. setuped by IDriver
@ -184,6 +169,9 @@ public:
NVVertexArrayRange2 = false;
NVStateVARWithoutFlush = 0;
OESDrawTexture = false;
OESMapBuffer = false;
/// \name Disable Hardware feature. False by default. setuped by IDriver
DisableHardwareVertexProgram= false;
DisableHardwareVertexArrayAGP= false;
@ -266,7 +254,10 @@ public:
// ***************************************************************************
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
/// This function will test and register EGL functions before than the gl context is created
bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy);
#elif defined(NL_OS_WINDOWS)
/// This function will test and register WGL functions before than the gl context is created
bool registerWGlExtensions(CGlExtensions &ext, HDC hDC);
#elif defined(NL_OS_MAC)
@ -278,7 +269,11 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen);
/// This function test and register the extensions for the current GL context.
void registerGlExtensions(CGlExtensions &ext);
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D
// ***************************************************************************
// The exported function names
@ -289,6 +284,48 @@ void registerGlExtensions(CGlExtensions &ext);
NB: we do it for all (EXT, NV, ARB extension) even it should be useful only for ARB ones.
*/
#ifdef USE_OPENGLES
// OES_mapbuffer.
//===============
extern NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES;
extern NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
extern NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
extern NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData;
extern PFNGLDRAWTEXFOESPROC nglDrawTexfOES;
// GL_OES_framebuffer_object
extern NEL_PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES;
extern NEL_PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES;
extern NEL_PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES;
extern NEL_PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES;
extern NEL_PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES;
extern NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES;
extern NEL_PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES;
extern NEL_PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES;
extern NEL_PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES;
extern NEL_PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES;
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES;
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES;
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES;
extern NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES;
extern NEL_PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES;
// GL_OES_texture_cube_map
extern NEL_PFNGLTEXGENFOESPROC nglTexGenfOES;
extern NEL_PFNGLTEXGENFVOESPROC nglTexGenfvOES;
extern NEL_PFNGLTEXGENIOESPROC nglTexGeniOES;
extern NEL_PFNGLTEXGENIVOESPROC nglTexGenivOES;
extern NEL_PFNGLTEXGENXOESPROC nglTexGenxOES;
extern NEL_PFNGLTEXGENXVOESPROC nglTexGenxvOES;
extern NEL_PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES;
extern NEL_PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES;
extern NEL_PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES;
#else
// ARB_multitexture
//=================
extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
@ -741,4 +778,6 @@ extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMul
// GL_ARB_multisample
extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
#endif // USE_OPENGLES
#endif // NL_OPENGL_EXTENSION_H

View file

@ -20,23 +20,6 @@
#include "nel/misc/types_nl.h"
#ifdef USE_OPENGLES
# include <GLES/gl.h>
# include <GLES/glext.h>
#else
# ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY
# include <OpenGL/gl.h>
# include "mac/glext.h"
# else
# include <GL/gl.h>
# include <GL/glext.h>
# if defined(NL_OS_WINDOWS)
# include <GL/wglext.h>
# endif
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -79,7 +62,8 @@ typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname,
typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
#endif
#else
// ***************************************************************************
// ***************************************************************************
@ -456,6 +440,8 @@ typedef void (APIENTRY * NEL_PFNGLXFREEMEMORYNVPROC) (void *pointer);
#endif // NL_OS_MAC
#endif // USE_OPENGLES
#ifdef __cplusplus
}
#endif

View file

@ -17,11 +17,7 @@
#include "stdopengl.h"
#include "driver_opengl.h"
#ifdef NL_OS_WINDOWS
# include <windowsx.h>
#elif defined(NL_OS_MAC)
#elif defined (NL_OS_UNIX)
# include <GL/glx.h>
#ifdef NL_OS_UNIX
# include <X11/Xatom.h>
# ifdef HAVE_XRENDER
# include <X11/extensions/Xrender.h>
@ -39,8 +35,15 @@
using namespace std;
using namespace NLMISC;
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// *************************************************************************************
CDriverGL::CCursor::CCursor() : ColorDepth(CDriverGL::ColorDepth32),
@ -1010,4 +1013,8 @@ bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &c
#endif
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -19,9 +19,15 @@
#include "driver_opengl.h"
#include "nel/3d/light.h"
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
uint CDriverGL::getMaxLight () const
@ -357,5 +363,8 @@ void CDriverGL::setupLightMapDynamicLighting(bool enable)
refreshRenderSetup();
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -23,6 +23,14 @@
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
static void convBlend(CMaterial::TBlend blend, GLenum& glenum)
{
H_AUTO_OGL(convBlend)
@ -35,12 +43,7 @@ static void convBlend(CMaterial::TBlend blend, GLenum& glenum)
case CMaterial::srccolor: glenum=GL_SRC_COLOR; break;
case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break;
// Extended Blend modes.
#ifdef USE_OPENGLES
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR; break;
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR; break;
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA; break;
case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA; break;
#else
#ifndef USE_OPENGLES
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break;
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break;
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break;
@ -84,22 +87,30 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode
nlassert(mode < CMaterial::TexAddrCount);
static const GLenum glTex2dAddrModesNV[] =
{
#ifdef USE_OPENGLES
0, GL_TEXTURE_2D
#else
GL_NONE, GL_TEXTURE_2D, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV,
GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV, GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV,
GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV, GL_DOT_PRODUCT_DEPTH_REPLACE_NV
#endif
};
static const GLenum glTexCubeAddrModesNV[] =
{
#ifdef USE_OPENGLES
0, GL_TEXTURE_CUBE_MAP_OES
#else
GL_NONE, GL_TEXTURE_CUBE_MAP_ARB, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV,
GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV, GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV,
GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV, GL_DOT_PRODUCT_DEPTH_REPLACE_NV
#endif
};
if (!tex || !tex->isTextureCube())
@ -136,17 +147,33 @@ void CDriverGL::setTextureEnvFunction(uint stage, CMaterial& mat)
{
// Cubic or normal ?
if (text->isTextureCube ())
#ifdef USE_OPENGLES
_DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_OES);
#else
_DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_ARB);
#endif
else
#ifdef USE_OPENGLES
_DriverGLStates.setTexGenMode (stage, GL_TEXTURE_CUBE_MAP_OES);
#else
_DriverGLStates.setTexGenMode (stage, GL_SPHERE_MAP);
#endif
}
else if(mode==CMaterial::TexCoordGenObjectSpace)
{
#ifdef USE_OPENGLES
_DriverGLStates.setTexGenMode (stage, GL_NORMAL_MAP_OES);
#else
_DriverGLStates.setTexGenMode (stage, GL_OBJECT_LINEAR);
#endif
}
else if(mode==CMaterial::TexCoordGenEyeSpace)
{
#ifdef USE_OPENGLES
_DriverGLStates.setTexGenMode (stage, GL_NORMAL_MAP_OES);
#else
_DriverGLStates.setTexGenMode (stage, GL_EYE_LINEAR);
#endif
}
}
else
@ -850,6 +877,22 @@ void CDriverGL::setupLightMapPass(uint pass)
// TexEnv is special.
_CurrentTexEnvSpecial[stage] = TexEnvSpecialLightMap;
#ifdef USE_OPENGLES
// What we want to setup is Texture*Constant + Previous.
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
// Operator.
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD);
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
// Arg2.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
#else
if (_Extensions.NVTextureEnvCombine4)
{
// What we want to setup is Texture*Constant + Previous*1.
@ -889,6 +932,7 @@ void CDriverGL::setupLightMapPass(uint pass)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
}
#endif
}
}
@ -1196,6 +1240,58 @@ void CDriverGL::setupSpecularPass(uint pass)
return;
}
#ifdef USE_OPENGLES
#if 0
// Ok we can do it in a single pass
// Set Stage 1
// Special: not the same special env if there is or not texture in stage 0.
CTexEnvSpecial newEnvStage1;
if( mat.getTexture(0) == NULL )
newEnvStage1= TexEnvSpecialSpecularStage1NoText;
else
newEnvStage1= TexEnvSpecialSpecularStage1;
// Test if same env as prec.
if(_CurrentTexEnvSpecial[1] != newEnvStage1)
{
// TexEnv is special.
_CurrentTexEnvSpecial[1] = newEnvStage1;
_DriverGLStates.activeTextureARB(1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
// Operator Add (Arg0*Arg2+Arg1)
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD);
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
// Arg2.
if( newEnvStage1 == TexEnvSpecialSpecularStage1NoText)
{
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_ONE_MINUS_SRC_COLOR);
}
else
{
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
}
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
// Result : Texture*Previous.Alpha+Previous
// Setup Alpha Diffuse Copy
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
// Arg2.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_ZERO );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
}
#endif
#else
/// Support NVidia combine 4 extension to do specular map in a single pass
if( _Extensions.NVTextureEnvCombine4 )
{ // Ok we can do it in a single pass
@ -1258,7 +1354,7 @@ void CDriverGL::setupSpecularPass(uint pass)
// Ok we can do it in a single pass
// Set Stage 1
// Special: not the same sepcial env if there is or not texture in stage 0.
// Special: not the same special env if there is or not texture in stage 0.
CTexEnvSpecial newEnvStage1;
if( mat.getTexture(0) == NULL )
newEnvStage1= TexEnvSpecialSpecularStage1NoText;
@ -1305,11 +1401,13 @@ void CDriverGL::setupSpecularPass(uint pass)
}
}
else
#endif
{
// We have to do it in 2 passes
// For Both Pass, setup correct Env.
if( pass == 0 )
{ // Just display the texture
{
// Just display the texture
_DriverGLStates.enableBlend(false);
_DriverGLStates.activeTextureARB(1);
_DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled);
@ -1542,6 +1640,20 @@ void CDriverGL::setupPPLPass(uint pass)
_CurrentTexEnvSpecial[0] = TexEnvSpecialPPLStage0;
_DriverGLStates.activeTextureARB(0);
#ifdef USE_OPENGLES
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
// Arg0 = Diffuse read in cube map
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
// Arg1 = Light color
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
// Arg2 = Primary color (other light diffuse and
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
#else
if (_Extensions.NVTextureEnvCombine4)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
@ -1575,6 +1687,7 @@ void CDriverGL::setupPPLPass(uint pass)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
}
#endif
}
activateTexEnvColor(0, _PPLightDiffuseColor);
@ -1592,6 +1705,32 @@ void CDriverGL::setupPPLPass(uint pass)
_CurrentTexEnvSpecial[2] = TexEnvSpecialPPLStage2;
_DriverGLStates.activeTextureARB(2);
#ifdef USE_OPENGLES
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
//== colors ==
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
// Arg0 = Specular read in cube map
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
// Arg2 = Light color
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
// Arg1 = Primary color ( + other light diffuse)
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
//== alpha ==
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
// Arg0 = PREVIOUS ALPHA
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR);
// Arg2 = 1
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_COLOR);
// Arg1 = 0
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR);
#else
if (_Extensions.NVTextureEnvCombine4)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
@ -1652,6 +1791,7 @@ void CDriverGL::setupPPLPass(uint pass)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_COLOR);
}
#endif
}
activateTexEnvColor(2, _PPLightSpecularColor);
@ -1707,6 +1847,20 @@ void CDriverGL::setupPPLNoSpecPass(uint pass)
_CurrentTexEnvSpecial[0] = TexEnvSpecialPPLStage0;
_DriverGLStates.activeTextureARB(0);
#ifdef USE_OPENGLES
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
// Arg0 = Diffuse read in cube map alpha
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
// Arg2 = Light color
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
// Arg1 = Primary color (other light diffuse and
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
#else
if (_Extensions.NVTextureEnvCombine4)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
@ -1740,6 +1894,7 @@ void CDriverGL::setupPPLNoSpecPass(uint pass)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
}
#endif
}
activateTexEnvColor(0, _PPLightDiffuseColor);
@ -1852,6 +2007,7 @@ void CDriverGL::setupCloudPass (uint /* pass */)
if (_CurrentTexEnvSpecial[0] != TexEnvSpecialCloudStage0)
{
#ifndef USE_OPENGLES
if (_Extensions.NVTextureEnvCombine4)
{
_CurrentTexEnvSpecial[0] = TexEnvSpecialCloudStage0;
@ -1969,6 +2125,7 @@ void CDriverGL::setupCloudPass (uint /* pass */)
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_ALPHA);
*/
}
#endif
}
if (_Extensions.NVTextureEnvCombine4)
activateTexEnvColor (1, mat.getColor());
@ -2323,4 +2480,8 @@ void CDriverGL::endWaterMultiPass()
#endif
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -19,6 +19,14 @@
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective)
{
@ -204,5 +212,8 @@ void CDriverGL::doRefreshRenderSetup()
_RenderSetupDirty= false;
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -22,8 +22,15 @@
// define it For Debug purpose only. Normal use is to hide this line
//#define NL3D_GLSTATE_DISABLE_CACHE
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
CDriverGLStates::CDriverGLStates()
@ -642,6 +649,8 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
{
_TexGenMode[stage] = mode;
if (!_TextureCubeMapSupported) return;
if(mode==0)
{
#ifdef USE_OPENGLES
@ -655,15 +664,31 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
}
else
{
#ifdef USE_OPENGLES
// nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode);
#else
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, mode);
glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, mode);
glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, mode);
#endif
/* Object or Eye Space ? => enable W generation. VERY IMPORTANT because
was a bug with VegetableRender and ShadowRender:
- Vegetable use the TexCoord1.w in his VertexProgram
- Shadow Render don't use any TexCoord in VB (since projected)
=> TexCoord1.w dirty!!
*/
#ifdef USE_OPENGLES
// if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR)
// {
nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode);
glEnable(GL_TEXTURE_GEN_STR_OES);
// }
// else
// {
// glDisable(GL_TEXTURE_GEN_STR_OES);
// }
#else
if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR)
{
glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, mode);
@ -673,6 +698,7 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
{
glDisable( GL_TEXTURE_GEN_Q );
}
#endif
// Enable All.
#ifdef USE_OPENGLES
@ -686,8 +712,6 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
}
}
// ***************************************************************************
void CDriverGLStates::resetTextureMode()
{
@ -994,6 +1018,7 @@ void CDriverGLStates::enableVertexAttribArrayARB(uint glIndex,bool enable)
void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants)
{
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayForEXTVertexShader)
if(_VertexAttribArrayEnabled[glIndex] != enable)
{
switch(glIndex)
@ -1002,10 +1027,12 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo
enableVertexArray(enable);
break;
case 1: // skin weight
#ifndef USE_OPENGLES
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL::EVSSkinWeightVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL::EVSSkinWeightVariant]);
#endif
break;
case 2: // normal
enableNormalArray(enable);
@ -1014,22 +1041,28 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo
enableColorArray(enable);
break;
case 4: // secondary color
#ifndef USE_OPENGLES
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL::EVSSecondaryColorVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL::EVSSecondaryColorVariant]);
#endif
break;
case 5: // fog coordinate
#ifndef USE_OPENGLES
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL::EVSFogCoordsVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL::EVSFogCoordsVariant]);
#endif
break;
case 6: // palette skin
#ifndef USE_OPENGLES
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL::EVSPaletteSkinVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL::EVSPaletteSkinVariant]);
#endif
break;
case 7: // empty
nlstop;
@ -1051,8 +1084,6 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo
}
_VertexAttribArrayEnabled[glIndex]= enable;
}
}
@ -1123,6 +1154,8 @@ CDriverGLStates::TCullMode CDriverGLStates::getCullMode() const
return _CullMode;
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -20,21 +20,16 @@
#include "nel/misc/types_nl.h"
#include "nel/3d/vertex_buffer.h"
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
# include <GLES/gl.h>
namespace NLDRIVERGLES {
#else
# ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY
# include <OpenGL/gl.h>
# else
# include <GL/gl.h>
namespace NLDRIVERGL {
#endif
#endif
namespace NL3D
{
// ***************************************************************************
/**
* Class for optimizing calls to openGL states, by caching old ones.
@ -255,6 +250,9 @@ private:
bool _CurLight[MaxLight];
};
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -41,9 +41,15 @@ using namespace std;
#define NEL_MEASURE_UPLOAD_TIME_END
#endif
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDriverGL *drvGl, bool isRectangleTexture) : ITextureDrvInfos(drv, it)
@ -60,7 +66,11 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri
// Nb: at Driver dtor, all tex infos are deleted, so _Driver is always valid.
_Driver= drvGl;
#ifdef USE_OPENGLES
TextureMode = GL_TEXTURE_2D;
#else
TextureMode = isRectangleTexture?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D;
#endif
FBOId = 0;
DepthFBOId = 0;
@ -85,6 +95,15 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
if(InitFBO)
{
#ifdef USE_OPENGLES
nglDeleteFramebuffersOES(1, &FBOId);
if(AttachDepthStencil)
{
nglDeleteRenderbuffersOES(1, &DepthFBOId);
if(!UsePackedDepthStencil)
nglDeleteRenderbuffersOES(1, &StencilFBOId);
}
#else
nglDeleteFramebuffersEXT(1, &FBOId);
if(AttachDepthStencil)
{
@ -92,6 +111,7 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
if(!UsePackedDepthStencil)
nglDeleteRenderbuffersEXT(1, &StencilFBOId);
}
#endif
}
}
@ -104,6 +124,54 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
{
AttachDepthStencil = !((CTextureBloom*)tex)->isMode2D();
}
#ifdef USE_OPENGLES
// generate IDs
nglGenFramebuffersOES(1, &FBOId);
if(AttachDepthStencil)
{
nglGenRenderbuffersOES(1, &DepthFBOId);
if(UsePackedDepthStencil)
StencilFBOId = DepthFBOId;
else
nglGenRenderbuffersOES(1, &StencilFBOId);
}
//nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId);
// initialize FBO
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId);
nglFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, TextureMode, ID, 0);
// attach depth/stencil render to FBO
// note: for some still unkown reason it's impossible to add
// a stencil buffer as shown in the respective docs (see
// opengl.org extension registry). Until a safe approach to add
// them is found, there will be no attached stencil for the time
// being, aside of using packed depth+stencil buffers.
if(AttachDepthStencil)
{
if(UsePackedDepthStencil)
{
//nldebug("3D: using packed depth stencil");
nglBindRenderbufferOES(GL_RENDERBUFFER_OES, StencilFBOId);
nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, tex->getWidth(), tex->getHeight());
}
else
{
nglBindRenderbufferOES(GL_RENDERBUFFER_OES, DepthFBOId);
nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, tex->getWidth(), tex->getHeight());
/*
nglBindRenderbufferEXT(GL_RENDERBUFFER_OES, StencilFBOId);
nglRenderbufferStorageEXT(GL_RENDERBUFFER_OES, GL_STENCIL_INDEX8_EXT, tex->getWidth(), tex->getHeight());
*/
}
nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, DepthFBOId);
nldebug("3D: glFramebufferRenderbufferExt(depth:24) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, StencilFBOId);
nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
}
#else
// generate IDs
nglGenFramebuffersEXT(1, &FBOId);
if(AttachDepthStencil)
@ -119,8 +187,7 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
// initialize FBO
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId);
nglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TextureMode, ID, 0);
nglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, TextureMode, ID, 0);
// attach depth/stencil render to FBO
// note: for some still unkown reason it's impossible to add
@ -152,6 +219,7 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
GL_RENDERBUFFER_EXT, StencilFBOId);
nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
}
#endif
// check status
GLenum status;
@ -161,44 +229,95 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
#endif
switch(status) {
#ifdef GL_FRAMEBUFFER_COMPLETE_EXT
case GL_FRAMEBUFFER_COMPLETE_EXT:
InitFBO = true;
break;
#endif
#ifdef GL_FRAMEBUFFER_COMPLETE_OES
case GL_FRAMEBUFFER_COMPLETE_OES:
InitFBO = true;
break;
#endif
#ifdef GL_FRAMEBUFFER_UNSUPPORTED_EXT
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
nlwarning("Unsupported framebuffer format");
break;
#endif
#ifdef GL_FRAMEBUFFER_UNSUPPORTED_OES
case GL_FRAMEBUFFER_UNSUPPORTED_OES:
nlwarning("Unsupported framebuffer format");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
nlwarning("Framebuffer incomplete attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES:
nlwarning("Framebuffer incomplete attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
nlwarning("Framebuffer incomplete, missing attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES:
nlwarning("Framebuffer incomplete, missing attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT
case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
nlwarning("Framebuffer incomplete, duplicate attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
nlwarning("Framebuffer incomplete, attached images must have same dimensions");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES:
nlwarning("Framebuffer incomplete, attached images must have same dimensions");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
nlwarning("Framebuffer incomplete, attached images must have same format");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES:
nlwarning("Framebuffer incomplete, attached images must have same format");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
nlwarning("Framebuffer incomplete, missing draw buffer");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
nlwarning("Framebuffer incomplete, missing read buffer");
break;
#endif
#ifdef GL_FRAMEBUFFER_BINDING_EXT
case GL_FRAMEBUFFER_BINDING_EXT:
nlwarning("Framebuffer BINDING_EXT");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
nlwarning("Framebuffer incomplete multisample");
break;
#endif
#ifdef GL_FRAMEBUFFER_BINDING_OES
case GL_FRAMEBUFFER_BINDING_OES:
nlwarning("Framebuffer BINDING_EXT");
break;
#endif
default:
nlwarning("Framebuffer incomplete status %d", (sint)status);
@ -310,10 +429,18 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed)
// Try Compressed ones.
switch(texfmt)
{
#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
case ITexture::DXTC1: return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
case ITexture::DXTC1Alpha: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
case ITexture::DXTC3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
case ITexture::DXTC5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
#endif
default: break;
}
}
@ -322,6 +449,16 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed)
compressed= false;
switch(texfmt)
{
#ifdef USE_OPENGLES
case ITexture::RGBA8888: return GL_RGBA;
// case ITexture::RGBA4444: return GL_RGBA4_OES;
// case ITexture::RGBA5551: return GL_RGB5_A1_OES;
case ITexture::RGB888: return GL_RGB;
// case ITexture::RGB565: return GL_RGB5_OES;
case ITexture::Luminance: return GL_LUMINANCE;
case ITexture::Alpha: return GL_ALPHA;
case ITexture::AlphaLuminance: return GL_LUMINANCE_ALPHA;
#else
case ITexture::RGBA8888: return GL_RGBA8;
case ITexture::RGBA4444: return GL_RGBA4;
case ITexture::RGBA5551: return GL_RGB5_A1;
@ -342,8 +479,16 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed)
return 0;
}
break;
default: return GL_RGBA8;
#endif
default:
break;
}
#ifdef USE_OPENGLES
return GL_RGBA;
#else
return GL_RGBA8;
#endif
}
// ***************************************************************************
@ -352,7 +497,11 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt)
H_AUTO_OGL(getGlSrcTextureFormat)
// Is destination format is alpha or lumiance ?
#ifdef USE_OPENGLES
if ((glfmt==GL_ALPHA)||(glfmt==GL_LUMINANCE_ALPHA)||(glfmt==GL_LUMINANCE))
#else
if ((glfmt==GL_ALPHA8)||(glfmt==GL_LUMINANCE8_ALPHA8)||(glfmt==GL_LUMINANCE8))
#endif
{
switch(tex.getPixelFormat())
{
@ -363,6 +512,7 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt)
}
}
#ifndef USE_OPENGLES
if (glfmt == GL_DSDT_NV)
{
return GL_DSDT_NV;
@ -372,6 +522,7 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt)
{
return GL_DUDV_ATI;
}
#endif
// Else, not a Src format for upload, or RGBA.
return GL_RGBA;
@ -380,7 +531,9 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt)
// ***************************************************************************
static GLenum getGlSrcTextureComponentType(GLint texSrcFormat)
{
H_AUTO_OGL(getGlSrcTextureComponentType)
H_AUTO_OGL(getGlSrcTextureComponentType);
#ifndef USE_OPENGLES
switch (texSrcFormat)
{
case GL_DSDT_NV:
@ -388,10 +541,11 @@ static GLenum getGlSrcTextureComponentType(GLint texSrcFormat)
return GL_BYTE; // these are signed format
break;
default:
return GL_UNSIGNED_BYTE;
break;
}
#endif
return GL_UNSIGNED_BYTE;
}
// ***************************************************************************
@ -400,22 +554,65 @@ uint CDriverGL::computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const
H_AUTO_OGL(CDriverGL_computeMipMapMemoryUsage)
switch(glfmt)
{
#ifdef GL_RGBA8
case GL_RGBA8: return w*h* 4;
#endif
#ifdef GL_RGBA
case GL_RGBA: return w*h* 4;
#endif
// Well this is ugly, but simple :). GeForce 888 is stored as 32 bits.
#ifdef GL_RGB8
case GL_RGB8: return w*h* 4;
#endif
#ifdef GL_RGB
case GL_RGB: return w*h* 4;
#endif
#ifdef GL_RGBA4
case GL_RGBA4: return w*h* 2;
#endif
#ifdef GL_RGB5_A1
case GL_RGB5_A1: return w*h* 2;
#endif
#ifdef GL_RGB5
case GL_RGB5: return w*h* 2;
#endif
#ifdef GL_LUMINANCE8
case GL_LUMINANCE8: return w*h* 1;
#endif
#ifdef GL_LUMINANCE
case GL_LUMINANCE: return w*h* 1;
#endif
#ifdef GL_ALPHA8
case GL_ALPHA8: return w*h* 1;
#endif
#ifdef GL_ALPHA
case GL_ALPHA: return w*h* 1;
#endif
#ifdef GL_LUMINANCE8_ALPHA8
case GL_LUMINANCE8_ALPHA8: return w*h* 2;
#endif
#ifdef GL_LUMINANCE_ALPHA
case GL_LUMINANCE_ALPHA: return w*h* 2;
#endif
#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return w*h /2;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return w*h /2;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return w*h* 1;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return w*h* 1;
#endif
#ifdef GL_DU8DV8_ATI
case GL_DU8DV8_ATI:
#endif
#ifdef GL_DSDT_NV
case GL_DSDT_NV: return w*h* 2;
};
#endif
}
// One format has not been coded.
nlstop;
@ -431,13 +628,15 @@ static inline GLenum translateWrapToGl(ITexture::TWrapMode mode, const CGlExtens
H_AUTO_OGL(translateWrapToGl)
if(mode== ITexture::Repeat)
return GL_REPEAT;
else
{
#ifdef USE_OPENGLES
return GL_CLAMP_TO_EDGE;
#else
if(extensions.Version1_2)
return GL_CLAMP_TO_EDGE;
else
return GL_CLAMP;
}
#endif
}
// ***************************************************************************
@ -506,14 +705,26 @@ static inline GLenum translateMinFilterToGl(CTextureDrvInfosGL *glText)
static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt)
{
H_AUTO_OGL(sameDXTCFormat);
#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1)
return true;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1Alpha)
return true;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT3_EXT && tex.PixelFormat==CBitmap::DXTC3)
return true;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT5_EXT && tex.PixelFormat==CBitmap::DXTC5)
return true;
#endif
return false;
}
@ -522,14 +733,26 @@ static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt)
static inline bool isDXTCFormat(GLint glfmt)
{
H_AUTO_OGL(isDXTCFormat);
#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
return true;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
return true;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT3_EXT)
return true;
#endif
#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
return true;
#endif
return false;
}
@ -558,14 +781,20 @@ void CDriverGL::bindTextureWithMode(ITexture &tex)
{
_DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
// Bind this texture
#ifdef USE_OPENGLES
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
#else
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
#endif
}
}
else
{
CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D;
#ifndef USE_OPENGLES
if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV)
textureMode = CDriverGLStates::TextureRect;
#endif
_DriverGLStates.setTextureMode(textureMode);
// Bind this texture
@ -591,11 +820,19 @@ void CDriverGL::setupTextureBasicParameters(ITexture &tex)
{
if (_Extensions.ARBTextureCubeMap)
{
#ifdef USE_OPENGLES
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
// glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
#else
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
#endif
}
}
else
@ -1005,6 +1242,23 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
clamp(x1, x0, w);
clamp(y1, y0, h);
#ifdef USE_OPENGLES
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (!bUpload)
ptr = NULL;
sint pixelSize = 4;
if (glSrcFmt == GL_ALPHA)
pixelSize = 1;
for(sint yy = 0; yy < (y1-y0); yy++)
{
char *row = (char*)ptr + ((yy + y0)*w + x0) * pixelSize;
glTexSubImage2D (GL_TEXTURE_2D, i, x0, y0+yy, x1-x0, 1, glSrcFmt, glSrcType, row );
}
#else
glPixelStorei(GL_UNPACK_ROW_LENGTH, w);
glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
@ -1012,6 +1266,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
glTexSubImage2D (GL_TEXTURE_2D, i, x0, y0, x1-x0, y1-y0, glSrcFmt,glSrcType, ptr);
else
glTexSubImage2D (GL_TEXTURE_2D, i, x0, y0, x1-x0, y1-y0, glSrcFmt,glSrcType, NULL);
#endif
// Next mipmap!!
// floor .
@ -1024,9 +1279,13 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
}
// Reset the transfer mode...
#ifdef USE_OPENGLES
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
#else
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
#endif
}
}
@ -1081,8 +1340,11 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap)
// system of "backup the previous binded texture" seems to not work with some drivers....
_DriverGLStates.activeTextureARB (0);
CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D;
#ifndef USE_OPENGLES
if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV)
textureMode = CDriverGLStates::TextureRect;
#endif
_DriverGLStates.setTextureMode (textureMode);
// Bind this texture, for reload...
@ -1139,7 +1401,12 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap)
nlassert (((x0&3) == 0) && ((y0&3) == 0));
if ((w>=4) && (h>=4))
{
nglCompressedTexSubImage2DARB ( GL_TEXTURE_2D, nNumMipMap-decalMipMapResize,
#ifdef USE_OPENGLES
glCompressedTexSubImage2D (
#else
nglCompressedTexSubImage2DARB (
#endif
GL_TEXTURE_2D, nNumMipMap-decalMipMapResize,
x0, y0, (x1-x0), (y1-y0), glfmt, imageSize, ptr );
}
else
@ -1148,7 +1415,12 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap)
// of the mipmap is less than 4 pixel so we use the other form. (its not really time critical
// to upload 16 bytes so we can do it twice if texture is cut)
imageSize = tex.getPixels(nNumMipMap).size();
nglCompressedTexImage2DARB (GL_TEXTURE_2D, nNumMipMap-decalMipMapResize,
#ifdef USE_OPENGLES
glCompressedTexImage2D (
#else
nglCompressedTexImage2DARB (
#endif
GL_TEXTURE_2D, nNumMipMap-decalMipMapResize,
glfmt, w, h, 0, imageSize, ptr);
}
}
@ -1158,6 +1430,22 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap)
nlassert (glSrcFmt!=GL_RGBA || tex.getPixelFormat()==CBitmap::RGBA);
void *ptr= tex.getPixels(nNumMipMap).getPtr();
#ifdef USE_OPENGLES
sint pixelSize = 4;
if (glSrcFmt == GL_ALPHA)
pixelSize = 1;
for(sint yy = 0; yy < (y1-y0); yy++)
{
char *row = (char*)ptr + ((yy + y0)*w + x0) * pixelSize;
glTexSubImage2D (GL_TEXTURE_2D, nNumMipMap, x0, y0+yy, x1-x0, 1, glSrcFmt, glSrcType, row );
}
// Reset the transfer mode...
// glPixelStorei (GL_UNPACK_ALIGNMENT, 0);
#else
glPixelStorei (GL_UNPACK_ROW_LENGTH, w);
glPixelStorei (GL_UNPACK_SKIP_ROWS, y0);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, x0);
@ -1167,6 +1455,7 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap)
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
#endif
}
// Disable texture 0
@ -1227,19 +1516,31 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
_CurrentTextureInfoGL[stage]= gltext;
// setup this texture
#ifdef USE_OPENGLES
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
#else
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
#endif
// Change parameters of texture, if necessary.
//============================================
if(gltext->MagFilter!= tex->getMagFilter())
{
gltext->MagFilter= tex->getMagFilter();
#ifdef USE_OPENGLES
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
#else
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
#endif
}
if(gltext->MinFilter!= tex->getMinFilter())
{
gltext->MinFilter= tex->getMinFilter();
#ifdef USE_OPENGLES
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
#else
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
#endif
}
}
}
@ -1248,8 +1549,10 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
{
// setup texture mode, after activeTextureARB()
CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D;
#ifndef USE_OPENGLES
if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV)
textureMode = CDriverGLStates::TextureRect;
#endif
_DriverGLStates.setTextureMode(/*CDriverGLStates::Texture2D*/textureMode);
// Activate texture...
@ -1296,11 +1599,14 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
_CurrentTextureInfoGL[stage]= NULL;
// setup texture mode, after activeTextureARB()
_DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled);
#ifndef USE_OPENGLES
if (_Extensions.ATITextureEnvCombine3)
{
// very strange bug with ATI cards : when a texture is set to NULL at a stage, the stage is still active sometimes...
activateTexEnvMode(stage, _TexEnvReplace); // set the whole stage to replace fix the problem
}
#endif
}
this->_CurrentTexture[stage]= tex;
@ -1311,24 +1617,43 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
// This maps the CMaterial::TTexOperator
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, GL_ADD_SIGNED_EXT,
GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI };
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD,
#ifdef USE_OPENGLES
GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE
#else
GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI
#endif
};
// This maps the CMaterial::TTexSource
static const GLenum SourceLUT[4]= { GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT };
static const GLenum SourceLUT[4]= { GL_TEXTURE,
#ifdef USE_OPENGLES
GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT
#else
GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT
#endif
};
// This maps the CMaterial::TTexOperand
static const GLenum OperandLUT[4]= { GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
// This maps the CMaterial::TTexOperator, used for openGL Arg2 setup.
static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE,
GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT };
static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE,
#ifdef USE_OPENGLES
GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT
#else
GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT
#endif
};
#ifndef USE_OPENGLES
// ***************************************************************************
// Set general tex env using ENV_COMBINE4 for the current setupped stage (used by forceActivateTexEnvMode)
static void forceActivateTexEnvModeEnvCombine4(const CMaterial::CTexEnv &env)
{
H_AUTO_OGL(forceActivateTexEnvModeEnvCombine4)
H_AUTO_OGL(forceActivateTexEnvModeEnvCombine4);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
//== RGB ==
@ -1613,6 +1938,7 @@ static void forceActivateTexEnvModeEnvCombine4(const CMaterial::CTexEnv &env)
}
}
#endif
// ***************************************************************************
void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv &env)
@ -1626,6 +1952,114 @@ void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv &
// Setup the gl env mode.
_DriverGLStates.activeTextureARB(stage);
#ifdef USE_OPENGLES
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
// RGB.
//=====
if (env.Env.OpRGB == CMaterial::Mad)
{
//
if (false)
{
// GL_MODULATE_ADD_ATI
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]);
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, SourceLUT[env.Env.SrcArg1RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, OperandLUT[env.Env.OpArg1RGB]);
// Arg2.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, SourceLUT[env.Env.SrcArg2RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, OperandLUT[env.Env.OpArg2RGB]);
}
else
{
// fallback to modulate ..
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
//
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]);
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, SourceLUT[env.Env.SrcArg1RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, OperandLUT[env.Env.OpArg1RGB]);
}
}
else
{
// Operator.
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, OperatorLUT[env.Env.OpRGB] );
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]);
// Arg1.
if(env.Env.OpRGB > CMaterial::Replace)
{
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, SourceLUT[env.Env.SrcArg1RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, OperandLUT[env.Env.OpArg1RGB]);
// Arg2.
if(env.Env.OpRGB >= CMaterial::InterpolateTexture )
{
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, InterpolateSrcLUT[env.Env.OpRGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
}
}
}
// Alpha.
//=====
if (env.Env.OpAlpha == CMaterial::Mad)
{
if (true)
{
// GL_MODULATE_ADD_ATI
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0Alpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0Alpha]);
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, SourceLUT[env.Env.SrcArg1Alpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, OperandLUT[env.Env.OpArg1Alpha]);
// Arg2.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, SourceLUT[env.Env.SrcArg2Alpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, OperandLUT[env.Env.OpArg2Alpha]);
}
else
{
// fallback to modulate ..
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
//
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0RGB]);
// Arg1.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, SourceLUT[env.Env.SrcArg1RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, OperandLUT[env.Env.OpArg1RGB]);
}
}
else
{
// Operator.
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, OperatorLUT[env.Env.OpAlpha] );
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0Alpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0Alpha]);
// Arg1.
if(env.Env.OpAlpha > CMaterial::Replace)
{
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, SourceLUT[env.Env.SrcArg1Alpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, OperandLUT[env.Env.OpArg1Alpha]);
// Arg2.
if(env.Env.OpAlpha >= CMaterial::InterpolateTexture )
{
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, InterpolateSrcLUT[env.Env.OpAlpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA);
}
}
}
#else
// if the Mad operator is used, then
// "Normal drivers", setup EnvCombine.
if(_Extensions.EXTTextureEnvCombine)
@ -1746,6 +2180,7 @@ void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv &
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
#endif
}
// ***************************************************************************
@ -1982,4 +2417,8 @@ bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height)
// ***************************************************************************
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -46,13 +46,15 @@ using namespace NLMISC;
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
@ -1313,6 +1315,7 @@ void CDriverGL::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
_DriverGLStates.bindARBVertexBuffer(vb.VertexObjectId);
}
#ifndef USE_OPENGLES
// special case if the buffer is an ATI_vertex_array_object
if (vb.VBMode == CVertexBufferInfo::HwATI)
{
@ -1346,6 +1349,7 @@ void CDriverGL::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
}
}
else
#endif
{
// For each value
for (uint value=0; value<CVertexBuffer::NumValue; value++)
@ -1367,7 +1371,11 @@ void CDriverGL::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
{
mustNormalize = ARBVertexProgramMustNormalizeAttrib[value];
}
#ifdef USE_OPENGLES
glVertexPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#else
nglVertexAttribPointerARB(glIndex, NumCoordinatesType[type], GLType[type], mustNormalize, vb.VertexSize, vb.ValuePtr[value]);
#endif
}
else
{
@ -1415,6 +1423,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
if (flags & flag & drvInfo->UsedVertexComponents)
{
_DriverGLStates.enableVertexAttribArrayForEXTVertexShader(glIndex, true, drvInfo->Variants);
#ifndef USE_OPENGLES
// use variant or open gl standard array
if (vb.VBMode == CVertexBufferInfo::HwATI)
{
@ -1487,6 +1496,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
}
}
else
#endif
{
switch(value)
{
@ -1499,7 +1509,9 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
case CVertexBuffer::Weight: // skin weight
{
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
}
break;
case CVertexBuffer::Normal: // normal
@ -1518,21 +1530,27 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
{
// implemented using a variant, as not available with EXTVertexShader
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
}
break;
case CVertexBuffer::Fog: // fog coordinate
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
}
break;
case CVertexBuffer::PaletteSkin: // palette skin
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
}
break;
case CVertexBuffer::Empty: // empty
@ -1789,6 +1807,7 @@ void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard)
{
H_AUTO_OGL(CDriverGL_fenceOnCurVBHardIfNeeded);
#ifndef USE_OPENGLES
// If old is not a VBHard, or if not a NVidia VBHard, no-op.
if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB)
return;
@ -1817,6 +1836,7 @@ void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard)
vbHardNV->GPURenderingAfterFence= false;
}
}
#endif
}
// ***************************************************************************
@ -1840,4 +1860,8 @@ void CIndexBufferInfo::setupIndexBuffer(CIndexBuffer &ib)
// ***************************************************************************
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -24,11 +24,15 @@
using namespace std;
using namespace NLMISC;
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
// ***************************************************************************
@ -103,10 +107,10 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
H_AUTO_OGL(CVertexArrayRangeNVidia_allocate)
nlassert(_VertexArrayPtr==NULL);
#ifdef NL_OS_WINDOWS
// try to allocate AGP or VRAM data.
switch(vbType)
{
#ifdef NL_OS_WINDOWS
case CVertexBuffer::AGPPreferred:
_VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f);
break;
@ -116,12 +120,9 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
else
_VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f);
break;
default:
break;
}
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
switch(vbType)
{
#elif defined(NL_OS_MAC)
// TODO: implement for Mac OS X
#elif defined(NL_OS_UNIX)
case CVertexBuffer::AGPPreferred:
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f);
break;
@ -131,11 +132,10 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
else
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f);
break;
#endif // NL_OS_WINDOWS
default:
break;
}
#endif // NL_OS_WINDOWS
// init the allocator.
if(_VertexArrayPtr)
@ -175,7 +175,9 @@ void CVertexArrayRangeNVidia::free()
#ifdef NL_OS_WINDOWS
// Free special memory.
nwglFreeMemoryNV(_VertexArrayPtr);
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#elif defined(NL_OS_MAC)
// TODO: implement for Mac OS X
#elif defined(NL_OS_UNIX)
nglXFreeMemoryNV(_VertexArrayPtr);
#endif // NL_OS_WINDOWS
@ -1217,7 +1219,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
nglGenBuffersARB(1, &vertexBufferID);
#endif
if (glGetError() != GL_NO_ERROR) return false;
if (glGetError() != GL_NO_ERROR) return NULL;
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
switch(_VBType)
{
@ -1254,7 +1256,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
nglDeleteBuffersARB(1, &vertexBufferID);
#endif
return false;
return NULL;
}
CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb);
newVbHard->initGL(vertexBufferID, this, _VBType);
@ -1664,6 +1666,8 @@ void CVertexBufferHardARB::invalidate()
}
#endif
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
}
} // NL3D

View file

@ -20,9 +20,15 @@
#include "nel/misc/types_nl.h"
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
class CDriverGL;
class IVertexBufferHardGL;
@ -30,8 +36,6 @@ class CVertexBufferInfo;
class CVertexBufferHardGLMapObjectATI;
class CVertexBufferHardARB;
// ***************************************************************************
// ***************************************************************************
// VBHard interface for both NVidia / ATI extension.
@ -573,6 +577,9 @@ public:
#endif
};
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D
@ -580,24 +587,3 @@ public:
#endif // NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H
/* End of driver_opengl_vertex_buffer_hard.h */

View file

@ -30,8 +30,15 @@ using namespace NLMISC;
//#define DEBUG_SETUP_EXT_VERTEX_SHADER
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it)
@ -43,6 +50,7 @@ CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInf
|| drv->_Extensions.ARBVertexProgram
);
#ifndef USE_OPENGLES
if (drv->_Extensions.NVVertexProgram) // NVIDIA implemntation
{
// Generate a program
@ -56,6 +64,7 @@ CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInf
{
ID = nglGenVertexShadersEXT(1); // ATI implementation
}
#endif
}
@ -79,6 +88,8 @@ bool CDriverGL::isVertexProgramEmulated () const
bool CDriverGL::activeNVVertexProgram (CVertexProgram *program)
{
H_AUTO_OGL(CVertexProgamDrvInfosGL_activeNVVertexProgram)
#ifndef USE_OPENGLES
// Setup or unsetup ?
if (program)
{
@ -188,6 +199,9 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program)
// Ok
return true;
}
#endif
return false;
}
@ -200,10 +214,16 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate)
{
switch(comp)
{
#ifdef USE_OPENGLES
case CVPSwizzle::X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES;
case CVPSwizzle::Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES;
case CVPSwizzle::Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES;
#else
case CVPSwizzle::X: return GL_X_EXT;
case CVPSwizzle::Y: return GL_Y_EXT;
case CVPSwizzle::Z: return GL_Z_EXT;
case CVPSwizzle::W: return GL_W_EXT;
#endif
default:
nlstop;
return 0;
@ -214,10 +234,16 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate)
{
switch(comp)
{
#ifdef USE_OPENGLES
case CVPSwizzle::X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES;
case CVPSwizzle::Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES;
case CVPSwizzle::Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES;
#else
case CVPSwizzle::X: return GL_NEGATIVE_X_EXT;
case CVPSwizzle::Y: return GL_NEGATIVE_Y_EXT;
case CVPSwizzle::Z: return GL_NEGATIVE_Z_EXT;
case CVPSwizzle::W: return GL_NEGATIVE_W_EXT;
#endif
default:
nlstop;
return 0;
@ -231,7 +257,9 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate)
*/
static GLuint convOutputRegisterToEXTVertexShader(CVPOperand::EOutputRegister r)
{
H_AUTO_OGL(convOutputRegisterToEXTVertexShader)
H_AUTO_OGL(convOutputRegisterToEXTVertexShader);
#ifndef USE_OPENGLES
switch (r)
{
case CVPOperand::OHPosition: return GL_OUTPUT_VERTEX_EXT;
@ -259,6 +287,8 @@ static GLuint convOutputRegisterToEXTVertexShader(CVPOperand::EOutputRegister r)
nlstop;
break;
}
#endif
return 0;
}
@ -310,6 +340,8 @@ static uint convInputRegisterToVBFlag(uint index)
static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW)
{
H_AUTO_OGL(doSwizzle);
#ifndef USE_OPENGLES
nglSwizzleEXT(res, in, outX, outY, outZ, outW);
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
std::string swzStr = "Swizzle : ";
@ -353,13 +385,15 @@ static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum ou
}
EVS_INFO(swzStr.c_str());
#endif
#endif
}
// Perform write mask and output de bug information
static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW)
{
H_AUTO_OGL(doWriteMask);
#ifndef USE_OPENGLES
nglWriteMaskEXT(res, in, outX, outY, outZ, outW);
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
nlinfo("3D: Write Mask : %c%c%c%c",
@ -369,6 +403,7 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum
outW ? 'w' : '-'
);
#endif
#endif
}
// ***************************************************************************
@ -377,6 +412,8 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum
bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint id, uint variants[EVSNumVariants], uint16 &usedInputRegisters)
{
H_AUTO_OGL(CDriverGL_setupEXTVertexShader);
#ifndef USE_OPENGLES
// counter to see what is generated
uint numOp = 0;
uint numOpIndex = 0;
@ -1157,7 +1194,9 @@ bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint
#endif
return true;
#else
return false;
#endif
}
//=================================================================================================
@ -1315,6 +1354,8 @@ static void ARBVertexProgramDumpInstr(const CVPInstruction &instr, std::string &
bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgram, GLuint id, bool &specularWritten)
{
H_AUTO_OGL(CDriverGL_setupARBVertexProgram)
#ifndef USE_OPENGLES
// tmp
CVPParser::TProgram parsedProgram = inParsedProgram;
//
@ -1449,6 +1490,9 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra
#endif
return true;
#else
return false;
#endif
}
@ -1456,7 +1500,9 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra
// ***************************************************************************
bool CDriverGL::activeARBVertexProgram (CVertexProgram *program)
{
H_AUTO_OGL(CDriverGL_activeARBVertexProgram)
H_AUTO_OGL(CDriverGL_activeARBVertexProgram);
#ifndef USE_OPENGLES
// Setup or unsetup ?
if (program)
{
@ -1520,13 +1566,18 @@ bool CDriverGL::activeARBVertexProgram (CVertexProgram *program)
_VertexProgramEnabled = false;
}
return true;
#else
return false;
#endif
}
// ***************************************************************************
bool CDriverGL::activeEXTVertexShader (CVertexProgram *program)
{
H_AUTO_OGL(CDriverGL_activeEXTVertexShader)
H_AUTO_OGL(CDriverGL_activeEXTVertexShader);
#ifndef USE_OPENGLES
// Setup or unsetup ?
if (program)
{
@ -1594,6 +1645,9 @@ bool CDriverGL::activeEXTVertexShader (CVertexProgram *program)
_VertexProgramEnabled = false;
}
return true;
#else
return false;
#endif
}
// ***************************************************************************
@ -1623,7 +1677,9 @@ bool CDriverGL::activeVertexProgram (CVertexProgram *program)
void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3)
{
H_AUTO_OGL(CDriverGL_setConstant)
H_AUTO_OGL(CDriverGL_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1639,6 +1695,7 @@ void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3)
float datas[] = { f0, f1, f2, f3 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas);
}
#endif
}
@ -1646,7 +1703,9 @@ void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3)
void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double d3)
{
H_AUTO_OGL(CDriverGL_setConstant)
H_AUTO_OGL(CDriverGL_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1662,6 +1721,7 @@ void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double
double datas[] = { d0, d1, d2, d3 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas);
}
#endif
}
@ -1669,7 +1729,9 @@ void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double
void CDriverGL::setConstant (uint index, const NLMISC::CVector& value)
{
H_AUTO_OGL(CDriverGL_setConstant)
H_AUTO_OGL(CDriverGL_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1685,6 +1747,7 @@ void CDriverGL::setConstant (uint index, const NLMISC::CVector& value)
float datas[] = { value.x, value.y, value.z, 0 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas);
}
#endif
}
@ -1692,7 +1755,9 @@ void CDriverGL::setConstant (uint index, const NLMISC::CVector& value)
void CDriverGL::setConstant (uint index, const NLMISC::CVectorD& value)
{
H_AUTO_OGL(CDriverGL_setConstant)
H_AUTO_OGL(CDriverGL_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1708,13 +1773,16 @@ void CDriverGL::setConstant (uint index, const NLMISC::CVectorD& value)
double datas[] = { value.x, value.y, value.z, 0 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas);
}
#endif
}
// ***************************************************************************
void CDriverGL::setConstant (uint index, uint num, const float *src)
{
H_AUTO_OGL(CDriverGL_setConstant)
H_AUTO_OGL(CDriverGL_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1734,12 +1802,15 @@ void CDriverGL::setConstant (uint index, uint num, const float *src)
nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_FLOAT, (void *) (src + 4 * k));
}
}
#endif
}
// ***************************************************************************
void CDriverGL::setConstant (uint index, uint num, const double *src)
{
H_AUTO_OGL(CDriverGL_setConstant)
H_AUTO_OGL(CDriverGL_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1759,6 +1830,7 @@ void CDriverGL::setConstant (uint index, uint num, const double *src)
nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_DOUBLE, (void *) (src + 4 * k));
}
}
#endif
}
// ***************************************************************************
@ -1767,7 +1839,11 @@ const uint CDriverGL::GLMatrix[IDriver::NumMatrix]=
{
GL_MODELVIEW,
GL_PROJECTION,
#ifdef USE_OPENGLES
GL_MODELVIEW
#else
GL_MODELVIEW_PROJECTION_NV
#endif
};
@ -1775,10 +1851,17 @@ const uint CDriverGL::GLMatrix[IDriver::NumMatrix]=
const uint CDriverGL::GLTransform[IDriver::NumTransform]=
{
#ifdef USE_OPENGLES
0,
0,
0,
0
#else
GL_IDENTITY_NV,
GL_INVERSE_NV,
GL_TRANSPOSE_NV,
GL_INVERSE_TRANSPOSE_NV
#endif
};
@ -1786,7 +1869,9 @@ const uint CDriverGL::GLTransform[IDriver::NumTransform]=
void CDriverGL::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform)
{
H_AUTO_OGL(CDriverGL_setConstantMatrix)
H_AUTO_OGL(CDriverGL_setConstantMatrix);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1856,6 +1941,7 @@ void CDriverGL::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver:
nglSetInvariantEXT(_EVSConstantHandle + index + 3, GL_FLOAT, matDatas + 12);
}
}
#endif
}
// ***************************************************************************
@ -1871,7 +1957,9 @@ void CDriverGL::setConstantFog (uint index)
void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided)
{
H_AUTO_OGL(CDriverGL_enableVertexProgramDoubleSidedColor)
H_AUTO_OGL(CDriverGL_enableVertexProgramDoubleSidedColor);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (_Extensions.NVVertexProgram)
{
@ -1889,6 +1977,7 @@ void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided)
else
glDisable (GL_VERTEX_PROGRAM_TWO_SIDE_ARB);
}
#endif
}
@ -1900,5 +1989,8 @@ bool CDriverGL::supportVertexProgramDoubleSidedColor() const
return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram;
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -22,15 +22,11 @@
// by default, we disable the windows menu keys (F10, ALT and ALT+SPACE key doesn't freeze or open the menu)
#define NL_DISABLE_MENU
#ifdef NL_OS_WINDOWS
# include <windowsx.h>
#elif defined(NL_OS_MAC)
#ifdef NL_OS_MAC
# import "mac/cocoa_window_delegate.h"
# import "mac/cocoa_application_delegate.h"
# import <OpenGL/OpenGL.h>
#elif defined (NL_OS_UNIX)
# include <GL/gl.h>
# include <GL/glx.h>
# ifdef HAVE_XRANDR
# include <X11/extensions/Xrandr.h>
# endif // HAVE_XRANDR
@ -50,8 +46,15 @@
using namespace std;
using namespace NLMISC;
namespace NL3D
{
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
#ifdef NL_OS_WINDOWS
@ -110,7 +113,8 @@ bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
H_AUTO_OGL(DriverGL_WndProc)
H_AUTO_OGL(DriverGL_WndProc);
// Get the driver pointer..
CDriverGL *pDriver=(CDriverGL*)GetWindowLongPtr (hWnd, GWLP_USERDATA);
bool trapMessage = false;
@ -342,9 +346,12 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
#elif defined(NL_OS_MAC)
// nothing to do
nlunreferenced(windowIcon);
#elif defined (NL_OS_UNIX)
nlunreferenced(windowIcon);
_dpy = XOpenDisplay(NULL);
if (_dpy == NULL)
@ -444,6 +451,7 @@ bool CDriverGL::unInit()
#ifdef NL_OS_WINDOWS
#ifndef USE_OPENGLES
// Off-screen rendering ?
if (_PBuffer)
{
@ -451,6 +459,7 @@ bool CDriverGL::unInit()
nwglDestroyPbufferARB(_PBuffer);
_PBuffer = NULL;
}
#endif
if (_Registered && !UnregisterClassW(L"NLClass", GetModuleHandle(NULL)))
{
@ -606,14 +615,15 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
#ifdef NL_OS_WINDOWS
// Init pointers
#ifndef USE_OPENGLES
_PBuffer = NULL;
_hRC = NULL;
_hDC = NULL;
#endif
// Driver caps.
//=============
// Retrieve the WGL extensions before init the driver.
int pf;
// Offscreen mode ?
if (_CurrentMode.OffScreen)
@ -652,7 +662,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_pfd.cAlphaBits = 8;
}
_pfd.iLayerType = PFD_MAIN_PLANE;
pf=ChoosePixelFormat(tempHDC,&_pfd);
int pf=ChoosePixelFormat(tempHDC,&_pfd);
if (!pf)
{
nlwarning ("CDriverGL::setDisplay: ChoosePixelFormat failed");
@ -695,7 +705,11 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
}
// Register WGL functions
#ifdef USE_OPENGLES
registerEGlExtensions (_Extensions, tempHDC);
#else
registerWGlExtensions (_Extensions, tempHDC);
#endif
HDC hdc = wglGetCurrentDC ();
@ -854,11 +868,19 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_CurrentMode.Depth = uint8(GetDeviceCaps (_hDC, BITSPIXEL));
// Destroy the temp gl context
#ifdef USE_OPENGLES
if (!eglDestroyContext(_EglDisplay, _EglContext);)
{
DWORD error = GetLastError ();
nlwarning ("CDriverGL::setDisplay: wglDeleteContext failed: 0x%x", error);
}
#else
if (!wglDeleteContext (tempGLRC))
{
DWORD error = GetLastError ();
nlwarning ("CDriverGL::setDisplay: wglDeleteContext failed: 0x%x", error);
}
#endif
// Destroy the temp windows
if (!DestroyWindow (tmpHWND))
@ -871,9 +893,15 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
{
DWORD error = GetLastError ();
nlwarning ("CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x", error);
#ifdef USE_OPENGLES
eglDestroyContext(_EglDisplay, _EglContext);
#else
wglDeleteContext (_hRC);
nwglReleasePbufferDCARB( _PBuffer, _hDC );
nwglDestroyPbufferARB( _PBuffer );
#endif
DestroyWindow (tmpHWND);
_PBuffer = NULL;
_win = EmptyWindow;
@ -898,43 +926,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
// associate OpenGL driver to window
SetWindowLongPtr(_win, GWLP_USERDATA, (LONG_PTR)this);
_hDC=GetDC(_win);
wglMakeCurrent(_hDC,NULL);
_CurrentMode.Depth = uint8(GetDeviceCaps(_hDC,BITSPIXEL));
// ---
memset(&_pfd,0,sizeof(_pfd));
_pfd.nSize = sizeof(_pfd);
_pfd.nVersion = 1;
_pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
_pfd.iPixelType = PFD_TYPE_RGBA;
_pfd.cColorBits = _CurrentMode.Depth;
// Choose best suited Depth Buffer.
if(_CurrentMode.Depth <= 16)
{
_pfd.cDepthBits = 16;
}
else
{
_pfd.cDepthBits = 24;
_pfd.cAlphaBits = 8;
_pfd.cStencilBits = 8;
}
_pfd.iLayerType = PFD_MAIN_PLANE;
pf=ChoosePixelFormat(_hDC,&_pfd);
if (!pf)
{
return false;
}
if ( !SetPixelFormat(_hDC,pf,&_pfd) )
{
return false;
}
_hRC=wglCreateContext(_hDC);
wglMakeCurrent(_hDC,_hRC);
createContext();
}
/// release old emitter
@ -1615,7 +1607,19 @@ bool CDriverGL::destroyWindow()
std::vector<NLMISC::CBitmap> bitmaps;
setWindowIcon(bitmaps);
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
if (_EglDisplay && _EglContext)
{
eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext);
if (_DestroyWindow)
{
eglDestroyContext(_EglDisplay, _EglContext);
}
}
#elif defined(NL_OS_WINDOWS)
// Then delete.
// wglMakeCurrent(NULL,NULL);
@ -1633,11 +1637,23 @@ bool CDriverGL::destroyWindow()
{
ReleaseDC(_win, _hDC);
_hDC = NULL;
}
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
if (_DestroyWindow && _ctx)
glXDestroyContext(_dpy, _ctx);
_ctx = NULL;
#endif
#ifdef NL_OS_WINDOWS
// don't destroy window if it hasn't been created by our driver
if (_DestroyWindow)
if (_win && _DestroyWindow)
DestroyWindow(_win);
}
#elif defined(NL_OS_MAC)
@ -1654,16 +1670,8 @@ bool CDriverGL::destroyWindow()
_EventEmitter.closeIM();
if (_DestroyWindow)
{
if (_ctx)
glXDestroyContext(_dpy, _ctx);
if (_win)
if (_DestroyWindow && _win)
XDestroyWindow(_dpy, _win);
}
_ctx = NULL;
// Ungrab the keyboard (probably not necessary);
// XUnmapWindow(_dpy, _win);
@ -2366,6 +2374,150 @@ emptyProc CDriverGL::getWindowProc()
return (emptyProc)GlWndProc;
}
// --------------------------------------------------
bool CDriverGL::createContext()
{
#ifdef USE_OPENGLES
uint samples = 0;
if (_CurrentMode.AntiAlias > -1)
{
if (_CurrentMode.AntiAlias == 0)
{
samples = 4;
}
else
{
samples = _CurrentMode.AntiAlias;
}
}
EGLint attribList[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 8,
// EGL_SAMPLE_BUFFERS, _CurrentMode.AntiAlias > -1 ? 1:0,
// EGL_SAMPLES, samples,
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES_BIT,
EGL_NONE
};
// Get Display
_EglDisplay = EGL_NO_DISPLAY; // eglGetDisplay(_hDC);
if (_EglDisplay == EGL_NO_DISPLAY)
{
_EglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (_EglDisplay == EGL_NO_DISPLAY)
{
nlwarning("3D: failed to get display 0x%x", eglGetError());
return false;
}
}
// Initialize EGL
EGLint majorVersion;
EGLint minorVersion;
if (!eglInitialize(_EglDisplay, &majorVersion, &minorVersion))
{
return EGL_FALSE;
}
const char *extensions = eglQueryString(_EglDisplay, EGL_EXTENSIONS);
// Get configs
EGLint numConfigs;
if (!eglGetConfigs(_EglDisplay, NULL, 0, &numConfigs))
{
return false;
}
// Choose config
EGLConfig config = NULL;
if (!eglChooseConfig(_EglDisplay, attribList, &config, 1, &numConfigs))
{
return false;
}
// Create a surface
_EglSurface = eglCreateWindowSurface(_EglDisplay, config, (EGLNativeWindowType)_win, NULL);
if (_EglSurface == EGL_NO_SURFACE)
{
return false;
}
// Create a GL context
EGLint contextAttribs[] =
{
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL_NONE
};
_EglContext = eglCreateContext(_EglDisplay, config, EGL_NO_CONTEXT, contextAttribs);
if (_EglContext == EGL_NO_CONTEXT)
{
return false;
}
// Make the context current
if (!eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext))
{
return false;
}
#elif defined(NL_OS_WINDOWS)
_hDC = GetDC(_win);
_CurrentMode.Depth = uint8(GetDeviceCaps(_hDC,BITSPIXEL));
wglMakeCurrent(_hDC,NULL);
// ---
memset(&_pfd,0,sizeof(_pfd));
_pfd.nSize = sizeof(_pfd);
_pfd.nVersion = 1;
_pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
_pfd.iPixelType = PFD_TYPE_RGBA;
_pfd.cColorBits = _CurrentMode.Depth;
// Choose best suited Depth Buffer.
if(_CurrentMode.Depth <= 16)
{
_pfd.cDepthBits = 16;
}
else
{
_pfd.cDepthBits = 24;
_pfd.cAlphaBits = 8;
_pfd.cStencilBits = 8;
}
_pfd.iLayerType = PFD_MAIN_PLANE;
int pf=ChoosePixelFormat(_hDC,&_pfd);
if (!pf)
{
return false;
}
if ( !SetPixelFormat(_hDC,pf,&_pfd) )
{
return false;
}
_hRC=wglCreateContext(_hDC);
wglMakeCurrent(_hDC,_hRC);
#endif
return true;
}
// --------------------------------------------------
bool CDriverGL::activate()
{
@ -2374,7 +2526,20 @@ bool CDriverGL::activate()
if (_win == EmptyWindow)
return false;
#ifdef NL_OS_WINDOWS
#ifdef USE_OPENGLES
EGLContext ctx = eglGetCurrentContext();
if (ctx != _EglContext)
{
// Make the context current
if (!eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext))
{
return false;
}
}
#elif defined(NL_OS_WINDOWS)
HGLRC hglrc = wglGetCurrentContext();
@ -2393,7 +2558,7 @@ bool CDriverGL::activate()
if (nctx != NULL && nctx != _ctx)
glXMakeCurrent(_dpy, _win, _ctx);
#endif // NL_OS_WINDOWS
#endif // USE_OPENGLES
return true;
}
@ -2860,4 +3025,8 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, std::vector<l
#endif
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -16,21 +16,23 @@
#import <Cocoa/Cocoa.h>
namespace NL3D
{
class CDriverGL;
NSApplicationTerminateReply applicationShouldTerminate(CDriverGL*);
}
#ifdef NL_STATIC
#ifdef USE_OPENGLES
using NL3D::NLDRIVERGLES::CDriverGL;
#else
using NL3D::NLDRIVERGL::CDriverGL;
#endif
#endif
@interface CocoaApplicationDelegate : NSObject
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
<NSApplicationDelegate>
#endif
{
NL3D::CDriverGL* _driver;
CDriverGL* _driver;
}
-(id)initWithDriver:(NL3D::CDriverGL*)driver;
-(id)initWithDriver:(CDriverGL*)driver;
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
@end

View file

@ -14,14 +14,13 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../stdopengl.h"
#include "../driver_opengl.h"
#include "cocoa_application_delegate.h"
#include "cocoa_event_emitter.h"
namespace NL3D
{
NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver)
static NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver)
{
// cancel if there is a driver and a custom exit handler set up
if(driver && driver->ExitFunc)
@ -40,11 +39,10 @@ namespace NL3D
// just let the app terminate if no custom quit handling worked
return NSTerminateNow;
}
}
@implementation CocoaApplicationDelegate
-(id)initWithDriver:(NL3D::CDriverGL*)driver
-(id)initWithDriver:(CDriverGL*)driver
{
if((self = [super init]))
{
@ -56,7 +54,7 @@ namespace NL3D
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
{
return NL3D::applicationShouldTerminate(_driver);
return applicationShouldTerminate(_driver);
}
@end

View file

@ -18,21 +18,42 @@
namespace NL3D
{
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
class CDriverGL;
void viewDidResize(NSView*, CDriverGL*);
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
}
#ifdef NL_STATIC
#ifdef USE_OPENGLES
using NL3D::NLDRIVERGLES::CDriverGL;
#else
using NL3D::NLDRIVERGL::CDriverGL;
#endif
#endif
@interface CocoaOpenGLView : NSOpenGLView<NSTextInputClient>
{
NSMutableAttributedString* _characterStorage;
NSRange _markedRange;
NL3D::CDriverGL* _driver;
CDriverGL* _driver;
}
-(id)initWithFrame:(NSRect)frame;
-(void)dealloc;
-(void)keyDown:(NSEvent*)event;
-(void)setDriver:(NL3D::CDriverGL*)driver;
-(void)setDriver:(CDriverGL*)driver;
-(void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize;
@end

View file

@ -14,20 +14,17 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../stdopengl.h"
#include "../driver_opengl.h"
#import "cocoa_opengl_view.h"
namespace NL3D
{
void viewDidResize(NSView* view, CDriverGL* driver)
static void viewDidResize(NSView* view, CDriverGL* driver)
{
NSRect rect = [[view superview] frame];
driver->_CurrentMode.Height = rect.size.height;
driver->_CurrentMode.Width = rect.size.width;
}
}
@implementation CocoaOpenGLView
@ -55,7 +52,7 @@ namespace NL3D
#endif
}
-(void)setDriver:(NL3D::CDriverGL*)driver
-(void)setDriver:(CDriverGL*)driver
{
_driver = driver;
}
@ -67,7 +64,7 @@ namespace NL3D
if(!_driver)
return;
NL3D::viewDidResize(self, _driver);
viewDidResize(self, _driver);
}
/******************************************************************************/

View file

@ -17,21 +17,23 @@
#import <Cocoa/Cocoa.h>
#include "AvailabilityMacros.h"
namespace NL3D
{
class CDriverGL;
void windowDidMove(NSWindow*, NL3D::CDriverGL*);
}
#ifdef NL_STATIC
#ifdef USE_OPENGLES
using NL3D::NLDRIVERGLES::CDriverGL;
#else
using NL3D::NLDRIVERGL::CDriverGL;
#endif
#endif
@interface CocoaWindowDelegate : NSObject
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
<NSWindowDelegate>
#endif
{
NL3D::CDriverGL* _driver;
CDriverGL* _driver;
}
- (id)initWithDriver:(NL3D::CDriverGL*)driver;
- (id)initWithDriver:(CDriverGL*)driver;
- (void)windowDidMove:(NSNotification*)notification;
@end

View file

@ -14,13 +14,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../stdopengl.h"
#include "../driver_opengl.h"
#import "cocoa_window_delegate.h"
namespace NL3D
{
void windowDidMove(NSWindow* window, NL3D::CDriverGL* driver)
static void windowDidMove(NSWindow* window, CDriverGL* driver)
{
// get the rect (position, size) of the screen with menu bar
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
@ -35,11 +34,10 @@ namespace NL3D
driver->_WindowY =
screenRect.size.height - windowRect.size.height - windowRect.origin.y;
}
}
@implementation CocoaWindowDelegate
-(id)initWithDriver:(NL3D::CDriverGL*)driver
-(id)initWithDriver:(CDriverGL*)driver
{
if((self = [super init]))
{
@ -55,7 +53,7 @@ namespace NL3D
if(!_driver)
return;
NL3D::windowDidMove([notification object], _driver);
windowDidMove([notification object], _driver);
}
@end

View file

@ -32,6 +32,34 @@
#include <deque>
#include <limits>
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <windows.h>
# include <windowsx.h>
#endif
#ifdef USE_OPENGLES
# include "GLES/gl.h"
# include "GLES/glext.h"
# include "EGL/egl.h"
# include "EGL/eglext.h"
#else
# ifdef NL_OS_WINDOWS
# include <GL/gl.h>
# include "GL/wglext.h"
# elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY
# include <OpenGL/gl.h>
# elif defined (NL_OS_UNIX)
# define GLX_GLXEXT_PROTOTYPES
# include <GL/gl.h>
# include <GL/glx.h>
# include "GL/glxext.h"
# endif
# include "GL/glext.h"
#endif
#include "nel/misc/common.h"
#include "nel/misc/debug.h"

View file

@ -0,0 +1,84 @@
FIND_PACKAGE(OpenGLES REQUIRED)
IF(NOT WIN32)
IF(APPLE)
FIND_LIBRARY(CARBON NAMES Carbon)
FIND_LIBRARY(COCOA NAMES Cocoa)
ELSE(APPLE)
FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode)
ENDIF(APPLE)
ENDIF(NOT WIN32)
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}/nel/src/3d/driver/opengl)
FILE(GLOB SRC ${SOURCE_DIR}/*.cpp ${SOURCE_DIR}/*.h ${SOURCE_DIR}/*.def)
IF(APPLE)
FILE(GLOB MAC_SRC ${SOURCE_DIR}/mac/*.h ${SOURCE_DIR}/mac/*.m ${SOURCE_DIR}/mac/*.mm ${SOURCE_DIR}/mac/*.cpp)
SET(SRC ${SRC} ${MAC_SRC})
SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS "-x objective-c++")
ENDIF(APPLE)
INCLUDE_DIRECTORIES(${SOURCE_DIR} ${OPENGLES_INCLUDE_DIR})
ADD_DEFINITIONS(-DUSE_OPENGLES)
IF(WIN32)
SET(NLDRV_OGLES_LIB "nel_drv_opengles_win")
ELSE(WIN32)
SET(NLDRV_OGLES_LIB "nel_drv_opengles")
ENDIF(WIN32)
NL_TARGET_DRIVER(${NLDRV_OGLES_LIB} ${SRC})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} nel3d nelmisc ${OPENGLES_LIBRARIES})
NL_DEFAULT_PROPS(${NLDRV_OGLES_LIB} "NeL, Driver, Video: OpenGL ES")
NL_ADD_LIB_SUFFIX(${NLDRV_OGLES_LIB})
NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB})
IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(/DDRIVER_OPENGLES_EXPORTS)
ENDIF(WIN32)
IF(APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${CARBON})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${COCOA})
ENDIF(APPLE)
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_X11_LIB})
IF(XF86VidMode_FOUND)
INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${XF86VidMode_LIBRARY})
ENDIF(XF86VidMode_FOUND)
IF(X11_Xrandr_FOUND)
INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH})
ADD_DEFINITIONS(-DHAVE_XRANDR)
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_Xrandr_LIB})
ENDIF(X11_Xrandr_FOUND)
IF(X11_Xrender_FOUND)
INCLUDE_DIRECTORIES(${X11_Xrender_INCLUDE_PATH})
ADD_DEFINITIONS(-DHAVE_XRENDER)
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_Xrender_LIB})
ENDIF(X11_Xrender_FOUND)
IF(X11_Xcursor_FOUND)
INCLUDE_DIRECTORIES(${X11_Xcursor_INCLUDE_PATH})
ADD_DEFINITIONS(-DHAVE_XCURSOR)
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_Xcursor_LIB})
ENDIF(X11_Xcursor_FOUND)
ENDIF(UNIX AND NOT APPLE)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGLES_LIB} ${SOURCE_DIR}/stdopengl.h ${SOURCE_DIR}/stdopengl.cpp)
ENDIF(WITH_PCH)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
INSTALL(TARGETS ${NLDRV_OGLES_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
IF(WITH_MAXPLUGIN)
INSTALL(TARGETS ${NLDRV_OGLES_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -69,25 +69,29 @@ UDriver::~UDriver()
purgeMemory();
}
// ***************************************************************************
void UDriver::setMatrixMode2D11()
{
setMatrixMode2D(CFrustum(0.0f,1.0f,0.0f,1.0f,-1.0f,1.0f,false));
}
// ***************************************************************************
void UDriver::setMatrixMode2D43()
{
setMatrixMode2D(CFrustum(0.0f,4.0f/3.0f,0.0f,1.0f,-1.0f,1.0f,false));
}
// ***************************************************************************
UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc)
{
return new CDriverUser (windowIcon, direct3d, exitFunc);
return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc);
}
// ***************************************************************************
UDriver *UDriver::createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc)
{
return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc);
}
// ***************************************************************************
void UDriver::purgeMemory()
@ -110,9 +114,8 @@ bool CDriverUser::_StaticInit= false;
// ***************************************************************************
CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc)
CDriverUser::CDriverUser (uint windowIcon, TDriver driver, emptyProc exitFunc)
{
// The enum of IDriver and UDriver MUST be the same!!!
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);
nlassert((uint)IDriver::typeCount == (uint)UDriver::typeCount);
@ -134,13 +137,16 @@ CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc)
// Create/Init Driver.
#if defined(NL_OS_WINDOWS)
if (direct3d)
if (driver == Direct3d)
_Driver= CDRU::createD3DDriver();
#endif
if (!_Driver)
if (!_Driver && driver == OpenGl)
_Driver= CDRU::createGlDriver();
if (!_Driver && driver == OpenGlEs)
_Driver= CDRU::createGlEsDriver();
nlassert(_Driver);
_Driver->init (windowIcon, exitFunc);

View file

@ -64,6 +64,10 @@ extern IDriver* createGlDriverInstance ();
extern IDriver* createD3DDriverInstance ();
#endif
#ifdef NL_OPENGLES_AVAILABLE
extern IDriver* createGlEsDriverInstance ();
#endif
#endif
// ***************************************************************************
@ -82,36 +86,25 @@ IDriver *CDRU::createGlDriver() throw (EDru)
IDRV_CREATE_PROC createDriver = NULL;
IDRV_VERSION_PROC versionDriver = NULL;
//#ifdef NL_OS_WINDOWS
// WINDOWS code.
// HINSTANCE hInst;
// hInst=LoadLibrary(NL3D_GL_DLL_NAME);
CLibrary driverLib;
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
driverLib.addLibPath(NL_DRIVER_PREFIX);
#endif
// if (!hInst)
if (!driverLib.loadLibrary(NL3D_GL_DLL_NAME, true, true, false))
{
throw EDruOpenglDriverNotFound();
}
// char buffer[1024], *ptr;
// SearchPath (NULL, NL3D_GL_DLL_NAME, NULL, 1023, buffer, &ptr);
nlinfo ("Using the library '"NL3D_GL_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
// createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME);
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
if (createDriver == NULL)
{
throw EDruOpenglDriverCorrupted();
}
// versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME);
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
if (versionDriver != NULL)
{
@ -121,44 +114,67 @@ IDriver *CDRU::createGlDriver() throw (EDru)
throw EDruOpenglDriverUnknownVersion();
}
//#elif defined (NL_OS_UNIX)
//
// void *handle = dlopen(NL3D_GL_DLL_NAME, RTLD_NOW);
//
// if (handle == NULL)
// {
// nlwarning ("when loading dynamic library '%s': %s", NL3D_GL_DLL_NAME, dlerror());
// throw EDruOpenglDriverNotFound();
// }
//
// /* Not ANSI. Might produce a warning */
// createDriver = (IDRV_CREATE_PROC) dlsym (handle, IDRV_CREATE_PROC_NAME);
// if (createDriver == NULL)
// {
// nlwarning ("when getting function in dynamic library '%s': %s", NL3D_GL_DLL_NAME, dlerror());
// throw EDruOpenglDriverCorrupted();
// }
//
// versionDriver = (IDRV_VERSION_PROC) dlsym (handle, IDRV_VERSION_PROC_NAME);
// if (versionDriver != NULL)
// {
// if (versionDriver()<IDriver::InterfaceVersion)
// throw EDruOpenglDriverOldVersion();
// else if (versionDriver()>IDriver::InterfaceVersion)
// throw EDruOpenglDriverUnknownVersion();
// }
//
//#else // NL_OS_UNIX
//#error "Dynamic DLL loading not implemented!"
//#endif // NL_OS_UNIX
IDriver *ret= createDriver();
if (ret == NULL)
{
throw EDruOpenglDriverCantCreateDriver();
}
return ret;
return ret;
#endif
}
// ***************************************************************************
IDriver *CDRU::createGlEsDriver() throw (EDru)
{
#ifdef NL_STATIC
#ifdef NL_OPENGLES_AVAILABLE
return createGlEsDriverInstance ();
#else
return NULL;
#endif // NL_OPENGLES_AVAILABLE
#else
IDRV_CREATE_PROC createDriver = NULL;
IDRV_VERSION_PROC versionDriver = NULL;
CLibrary driverLib;
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
driverLib.addLibPath(NL_DRIVER_PREFIX);
#endif
if (!driverLib.loadLibrary(NL3D_GLES_DLL_NAME, true, true, false))
{
throw EDruOpenglEsDriverNotFound();
}
nlinfo ("Using the library '"NL3D_GLES_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
if (createDriver == NULL)
{
throw EDruOpenglDriverCorrupted();
}
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
if (versionDriver != NULL)
{
if (versionDriver()<IDriver::InterfaceVersion)
throw EDruOpenglDriverOldVersion();
else if (versionDriver()>IDriver::InterfaceVersion)
throw EDruOpenglDriverUnknownVersion();
}
IDriver *ret= createDriver();
if (ret == NULL)
{
throw EDruOpenglEsDriverCantCreateDriver();
}
return ret;
#endif
}
@ -181,31 +197,21 @@ IDriver *CDRU::createD3DDriver() throw (EDru)
IDRV_CREATE_PROC createDriver = NULL;
IDRV_VERSION_PROC versionDriver = NULL;
// WINDOWS code.
// HINSTANCE hInst;
// hInst=LoadLibrary(NL3D_D3D_DLL_NAME);
CLibrary driverLib;
// if (!hInst)
if (!driverLib.loadLibrary(NL3D_D3D_DLL_NAME, true, true, false))
{
throw EDruDirect3dDriverNotFound();
}
// char buffer[1024], *ptr;
// SearchPath (NULL, NL3D_D3D_DLL_NAME, NULL, 1023, buffer, &ptr);
nlinfo ("Using the library '"NL3D_D3D_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
// createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME);
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
if (createDriver == NULL)
{
throw EDruDirect3dDriverCorrupted();
}
// versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME);
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
if (versionDriver != NULL)
{
@ -220,8 +226,8 @@ IDriver *CDRU::createD3DDriver() throw (EDru)
{
throw EDruDirect3dDriverCantCreateDriver();
}
return ret;
return ret;
#endif
}
#endif // NL_OS_WINDOWS

View file

@ -7,15 +7,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/src )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common )
SET(RZ_SERVER_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/server/src)
IF(WITH_STATIC)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
ENDIF(WITH_STATIC)
ADD_SUBDIRECTORY(common)
IF(WITH_RYZOM_CLIENT)
@ -26,6 +17,30 @@ IF(WITH_RYZOM_CLIENT)
ENDIF(WITH_LUA51)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
# CURL Macports version depends on libidn and libintl too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
FIND_PACKAGE(Libwww REQUIRED)
ADD_SUBDIRECTORY(client)

View file

@ -561,12 +561,9 @@ HelpPages =
};
WebIgMainDomain = "atys.ryzom.com";
WebIgTrustedDomains =
{
WebIgTrustedDomains = {
"atys.ryzom.com"
};
PatchletUrl = "http://atys.ryzom.com/start/app_patchlet.php?patch=preload";
SelectedSlot = 0;

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>LSMinimumSystemVersion</key>
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}.0</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.role-playing-games</string>
</dict>
</plist>

View file

@ -0,0 +1 @@
APPL????

Binary file not shown.

View file

@ -42,30 +42,39 @@ SOURCE_GROUP("r2" FILES ${SRC_R2})
# on Mac, create a .App Bundle
if(APPLE)
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(MACOSX_BUNDLE_INFO_STRING "Ryzom Core Client")
SET(MACOSX_BUNDLE_ICON_FILE "atys.icns")
SET(MACOSX_BUNDLE_ICON_FILE "ryzom.icns")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "")
SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${NL_VERSION})
SET(MACOSX_BUNDLE_BUNDLE_NAME "Ryzom Core Client")
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.8")
SET(MACOSX_BUNDLE_BUNDLE_VERSION "1.0")
SET(MACOSX_BUNDLE_COPYRIGHT "Winchgate and The Ryzom Core Community")
# TODO: in release mode, cmake could copy all the dylibs into the .app
# bundle for redistribution... should some part of cpack handle that?
# ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD
# # make frameworks directory in app bundle
# COMMAND ${CMAKE_COMMAND} -E make_directory
# ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks
# # copy framework into app bundle
# COMMAND ${CMAKE_COMMAND} -E copy ${SOME_LIBRARY}
# ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks
# # ...
# # install_name_tool the lib pathes
SET(RYZOM_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app)
SET(RYZOM_CONTENTS_DIR ${RYZOM_OUTPUT_DIR}/Contents)
SET(RYZOM_RESOURCES_DIR ${RYZOM_CONTENTS_DIR}/Resources)
SET(MAC_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/ryzom/client/macosx)
ENDIF(APPLE)
ADD_EXECUTABLE(ryzom_client WIN32 MACOSX_BUNDLE ${SRC} ${SRC_INTERFACE} ${SRC_MODE} ${SRC_R2})
IF(APPLE)
SET_TARGET_PROPERTIES(ryzom_client PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_BUNDLE_NAME})
SET_TARGET_PROPERTIES(ryzom_client PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${MAC_RESOURCES_DIR}/Info.plist)
ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR})
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR})
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR})
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR})
IF(RYZOM_DATA_DIR)
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -R ARGS ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
ENDIF(RYZOM_DATA_DIR)
ENDIF(APPLE)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}

View file

@ -841,6 +841,7 @@ void CClientConfig::setValues()
if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto;
else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL;
else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D;
else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES;
}
else
cfgWarning ("Default value used for 'Driver3D' !!!");

View file

@ -53,7 +53,7 @@ using std::string;
//---------------------------------------------------
struct CClientConfig
{
enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D };
enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D, OpenGLES };
enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod, SoundDrvOpenAL, SoundDrvDirectSound, SoundDrvXAudio2 };
enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT };

View file

@ -819,33 +819,43 @@ void prelogInit()
nmsg = "Creating 3d driver...";
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
bool direct3D = false;
UDriver::TDriver driver = UDriver::OpenGl;
#ifdef NL_OS_WINDOWS
uint icon = (uint)LoadIcon(HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON));
#else
uint icon = 0;
#endif // NL_OS_WINDOWS
switch(ClientCfg.Driver3D)
{
case CClientConfig::DrvAuto:
#ifdef NL_OS_WINDOWS
{
// Fallback to D3D for card other than nVidia
std::string deviceName;
uint64 drvVersion;
CSystemInfo::getVideoInfo(deviceName, drvVersion);
strlwr(deviceName);
direct3D = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL;
driver = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL ? UDriver::Direct3d:UDriver::OpenGl;
}
break;
case CClientConfig::OpenGL:
direct3D = false;
break;
case CClientConfig::Direct3D:
direct3D = true;
driver = UDriver::Direct3d;
break;
#endif // NL_OS_WINDOWS
case CClientConfig::OpenGL:
driver = UDriver::OpenGl;
break;
case CClientConfig::OpenGLES:
driver = UDriver::OpenGlEs;
break;
default:
break;
}
Driver = UDriver::createDriver ((uint)LoadIcon (HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)), direct3D);
#else // NL_OS_WINDOWS
Driver = UDriver::createDriver ();
#endif // NL_OS_WINDOWS
Driver = UDriver::createDriver(icon, driver);
if(Driver == NULL)
{
ExitClientError (CI18N::get ("Can_t_load_the_display_driver").toUtf8().c_str ());
@ -1111,7 +1121,7 @@ void prelogInit()
CBloomEffect::getInstance().setDriver(Driver);
// init bloom effect
CBloomEffect::getInstance().init(!direct3D);
CBloomEffect::getInstance().init(driver != UDriver::Direct3d);
nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000);

View file

@ -580,7 +580,7 @@ void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTCh
// in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly
_Link.push_back (suri);
}
else if (_TrustedDomain && suri[0] == '#')
else if (_TrustedDomain && suri.find('#') == 0)
{
// Direct url (hack for lua beginElement)
_Link.push_back (suri.substr(1));

View file

@ -106,7 +106,7 @@ public:
void setOpened(bool opened) { Opened = opened; }
bool getOpened() const { return Opened; }
void setText(const ucstring &text) { Text = text; }
const ucstring& getText() const { return Text; }
ucstring getText() const { return Text; }
sint32 getFontSize() const { return FontSize; }
void setFontSize(sint32 value) { FontSize = value; }
sint32 getYDecal() const { return YDecal; }

View file

@ -2528,7 +2528,6 @@ class CAHOnCreateAccountSubmit : public IActionHandler
text->setMultiLineSpace(10);
text->setColor(CRGBA(250, 30, 30, 255));
std::vector< std::string > errors(5);
errors[0] = "id=\"comment-Username\"";
errors[1] = "id=\"comment-Password\"";

View file

@ -2022,7 +2022,7 @@ Arguments: s(parameterName) ->
@param[in] parameterName is a the id of the parameter to remove
@code
()removeProfileParameter("running"); // retire le paramètre "running" ou "running:<*>" du groupe
()removeProfileParameter("running"); // remove "running" or "running:<*>" parameter from group
@endcode
*/
@ -2048,7 +2048,7 @@ Arguments: s(parameterName) ->
@param[in] parameterName is a the id of the parameter to add
@code
()addProfileParameter("running"); // équivalent à un parameter "running" dans la primitive du groupe
()addProfileParameter("running"); // equivalent to "running" parameter in group primitive
@endcode
*/
@ -2077,7 +2077,7 @@ Arguments: s(parameterName),s(parameterContent) ->
@param[in] parameterContent is the value of the parameter
@code
()addPersistentProfileParameter("foo", "bar"); // équivalent à un parameter "foo:bar" dans la primitive du groupe
()addPersistentProfileParameter("foo", "bar"); // equivalent to "foo:bar" parameter in group primitive
@endcode
*/
@ -2108,7 +2108,7 @@ Arguments: s(parameterName),f(parameterContent) ->
@param[in] parameterContent is the value of the parameter
@code
()addPersistentProfileParameter("foo", 0.5); // équivalent à un parameter "foo:0.5" dans la primitive du groupe
()addPersistentProfileParameter("foo", 0.5); // equivalent to "foo:0.5" parameter in group primitive
@endcode
*/
@ -2137,7 +2137,7 @@ Arguments: s(parameterName) ->
@param[in] parameterName is a the id of the parameter to remove
@code
()removeProfileParameter("running"); // retire le paramètre "running" ou "running:<*>" du groupe
()removeProfileParameter("running"); // remove "running" or "running:<*>" parameters from group
@endcode
*/

View file

@ -119,7 +119,6 @@ class CMissionStepKillFauna : public IMissionStepTemplate
}
uint processEvent( const TDataSetRow & userRow, const CMissionEvent & event,uint subStepIndex,const TDataSetRow & giverRow )
{
nlinfo("Process Event");
string webAppUrl;
bool ret = true;
_User = PlayerManager.getChar(getEntityIdFromRow(userRow));

0
code/ryzom/tools/server/www/webtt/app/tmp/cache/models/empty vendored Executable file → Normal file
View file

0
code/ryzom/tools/server/www/webtt/app/tmp/cache/views/empty vendored Executable file → Normal file
View file

0
code/ryzom/tools/server/www/webtt/app/tmp/logs/empty Executable file → Normal file
View file

View file

0
code/ryzom/tools/server/www/webtt/app/tmp/tests/empty Executable file → Normal file
View file

View file

View file

View file

View file

View file

View file

View file

View file

0
code/ryzom/tools/server/www/webtt/app/webroot/js/jquery-fluid16.js vendored Executable file → Normal file
View file

0
code/ryzom/tools/server/www/webtt/app/webroot/js/jquery-ui.js vendored Executable file → Normal file
View file

0
code/ryzom/tools/server/www/webtt/cake/console/cake Executable file → Normal file
View file

View file

View file

@ -0,0 +1,47 @@
<?php
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
require_once(RYAPI_PATH.'client/config.php');
// Og (non-ryzom.com) method
function ryzom_authenticate_with_serverkey($cid, $name, $authserver, $authkey) {
}
// Ig method
function ryzom_authenticate_ingame($cid, $name, $authkey) {
if (isset($_SESSION['user']))
return true;
if (ryzom_get_param('user'))
return true;
return false;
}
// Session method
function ryzom_authenticate_with_session($name, $redirect) {
if (isset($_SESSION['user']))
return true;
if (ryzom_get_param('user'))
return true;
return false;
}
?>

View file

@ -0,0 +1,20 @@
<?php
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
// Url where player_auth.php is located
define('RYAPI_AUTH_SCRIPT', '');

View file

@ -0,0 +1,39 @@
<?php
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
function ryzom_user_get_info($cid) {
if (isset($_SESSION['user']))
return $_SESSION['user'];
$user = unserialize(base64_decode(ryzom_get_param('user')));
$_SESSION['user'] = $user;
return $user;
}
function ryzom_get_user_id($cid, $name, $creation_date) {
if (isset($_SESSION['user']))
return $_SESSION['user']['id'];
$user = unserialize(base64_decode(ryzom_get_param('user')));
$_SESSION['user'] = $user;
return $user['id'];
}
?>

View file

@ -0,0 +1,3 @@
<?php
?>

View file

@ -0,0 +1,67 @@
<?php
function ryzom_app_authenticate(&$user, $ask_login=true, $welcome_message='') {
$name = ryzom_get_param('name');
$authserver = ryzom_get_param('authserver');
$authkey = ryzom_get_param('authkey');
$lang = ryzom_get_param('lang');
$cid = ryzom_get_param('cid', '');
$is_ingame = false;
// we have to set the $user['lang'] even for anonymous user or we cannot display the test in the right langage
if($lang == '') {
$l = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if($l=='fr'||$l=='en'||$l=='de'||$l=='ru'||$l=='es')
$lang = $l;
else
$lang = 'en';
}
$user['message'] = '';
$user['lang'] = $lang;
$user['ig'] = false;
if ((isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Ryzom')) || ryzom_get_param('ig')) {
$user['ig'] = true;
// Ingame
$shardid = ryzom_get_param('shardid');
if (!ryzom_authenticate_ingame($shardid, $cid, $name, $authkey))
return false;
$is_ingame = true;
} else {
// Outgame : Use session
$error_message = '';
if (!ryzom_authenticate_with_session($name, $cid, $error_message)) {
if ($ask_login) {
$c = '';
if (!$welcome_message)
$welcome_message = '<span style="font-size:11pt; color: #AAAAFF">The application <strong style="color: #99FFFF">'._t(APP_NAME).'</strong> require authentication. Please enter your credentials</span>';
$c .= '<div style="text-align: center">'.$welcome_message.'</div><br />';
if ($user['message'])
$c .= '<div style="text-align: center"><strong style="color: #FF5555">'._t($user['message']).'</strong></div><br />';
$c .= ryzom_render_login_form($name, false);
echo ryzom_app_render(_t('app_'.APP_NAME), $c);
exit;
}
return false;
}
}
if ($lang)
$_SESSION['lang'] = $lang;
// get user informations
$user = ryzom_user_get_info($cid);
$user['lang'] = $_SESSION['lang'];
if (isset($user['creation_date']))
$user['id'] = ryzom_get_user_id($cid, $user['char_name'], $user['creation_date']);
if ($is_ingame && $user['last_played_date'] != '0')
$user['ig'] = true;
else
$user['ig'] = false;
unset($user['last_played_date']);
unset($user['creation_date']);
return true;
}
?>

View file

@ -0,0 +1,28 @@
<?php
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
// Url where the api is
define('RYAPI_URL', 'http://');
if (!defined('RYAPI_PATH'))
define('RYAPI_PATH', dirname(__FILE__).'/');
// used by "home" link
if (!defined('RYAPP_URL'))
define('RYAPP_URL', 'http://');
?>

View file

@ -0,0 +1,422 @@
<?php
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
define('SQL_DEF_TEXT', 0);
define('SQL_DEF_BOOLEAN', 1);
define('SQL_DEF_INT', 2);
define('SQL_DEF_DATE', 3);
// Wrapper for SQL database interactions
class ServerDatabase
{
var $hostname = '';
var $username = '';
var $password = '';
var $database = '';
var $_connection = Null;
function ServerDatabase($host='', $user='', $passwd='', $dbname='')
{
if (($host != '') && ($user != '') && ($dbname != ''))
{
$this->hostname = $host;
$this->username = $user;
$this->password = $passwd;
$this->database = $dbname;
}
if (($this->hostname != '') && ($this->username != '') && ($this->database != ''))
{
$this->_connection = mysql_connect($this->hostname, $this->username, $this->password)
or die("ERR1"); // ace . $this->get_error());
$this->select_db($this->database);
}
}
function close()
{
@mysql_close($this->_connection);
}
function query($sql_statement)
{
$result = mysql_query($sql_statement, $this->_connection);
return $result;
}
function select_db($dbname) {
$this->database = $dbname;
mysql_select_db($this->database, $this->_connection) or die("Database selection error : " . $this->get_error());
}
function num_rows($result)
{
return @mysql_num_rows($result);
}
function fetch_row($result, $result_type=MYSQL_BOTH)
{
return @mysql_fetch_array($result, $result_type);
}
function fetch_assoc($result)
{
return @mysql_fetch_array($result, MYSQL_ASSOC);
}
function query_single_row($sql_statement)
{
$result = $this->query($sql_statement);
return @mysql_fetch_array($result);
}
function free_result($result)
{
@mysql_free_result($result);
}
function get_error()
{
return mysql_errno($this->_connection) .": ". mysql_error($this->_connection);
}
function last_insert_id()
{
return @mysql_insert_id();
}
function change_to($host,$user,$pass,$dbname)
{
$this->close();
$this->hostname = $host;
$this->username = $user;
$this->password = $pass;
$this->database = $dbname;
$this->ServerDatabase();
}
}
class ryDB {
private static $_instances = array();
private $db;
private $defs = array();
private $errors = '';
private function __construct($db_name) {
global $_RYZOM_API_CONFIG;
$this->db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $db_name);
$this->db->query("SET NAMES utf8");
}
public static function getInstance($db_name) {
if (!array_key_exists($db_name, self::$_instances))
self::$_instances[$db_name] = new ryDB($db_name);
self::$_instances[$db_name]->db->select_db($db_name);
return self::$_instances[$db_name];
}
function setDbDefs($table, $defs) {
$this->defs[$table] = $defs;
}
function getDefs($table) {
if (!array_key_exists($table, $this->defs))
die("Please add tables defs using setDbDefs('$table', \$defs)");
return $this->defs[$table];
}
function getErrors() {
return $this->db->get_error();
}
function now() {
return date('Y-m-d H:i:s', time());
}
function toDate($timestamp) {
return date('Y-m-d H:i:s', $timestamp);
}
function fromDate($string_date) {
return strtotime($string_date);
}
function addDbTableProp($table, $props) {
$this->props[$table] = $props;
}
/// DIRECT QUERY
function sqlQuery($sql) {
$result = $this->db->query($sql);
$ret = array();
while ($row = $this->db->fetch_row($result)) {
$ret[] = $row;
}
return $ret;
}
/// QUERY ///
function sqlSelect($table, $props, $values=array(), $extra='') {
if ($table) {
$sql = "SELECT\n\t";
$params = array();
$test = array();
if (!$props)
die("Bad Select on [$table] : missing props");
foreach($props as $name => $type)
$params[] = '`'.addslashes($name).'`';
foreach($values as $name => $value) {
if ($name[0] == '=')
$test[] = '('.addslashes(substr($name, 1)).' LIKE '.var_export($value, true).')';
else
$test[] = '('.addslashes($name).' = '.var_export($value, true).')';
}
$sql .= implode(",\n\t", $params)."\nFROM\n\t".$table."\n";
if ($test)
$sql .= "WHERE\n\t".implode("\nAND\n\t", $test);
}
if ($extra)
$sql .= "\n".$extra;
return $sql.';';
}
function querySingle($table, $values=array(), $extra='') {
$sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra);
$result = $this->db->query($sql);
return $this->db->fetch_row($result);
}
function querySingleAssoc($table, $values=array(), $extra='') {
$sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra);
$result = $this->db->query($sql);
return $this->db->fetch_row($result, MYSQL_ASSOC);
}
function query($table, $values=array(), $extra='') {
$sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra);
$result = $this->db->query($sql);
$ret = array();
while ($row = $this->db->fetch_row($result)) {
$ret[] = $row;
}
return $ret;
}
function queryAssoc($table, $values=array(), $extra='') {
$sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra);
$result = $this->db->query($sql);
$ret = array();
while ($row = $this->db->fetch_row($result, MYSQL_ASSOC)) {
$ret[] = $row;
}
return $ret;
}
/// INSERT ///
function sqlInsert($table, $props, $vals) {
$sql = 'INSERT INTO '.$table.' ';
$params = array();
$values = array();
foreach($props as $name => $type) {
if (!isset($vals[$name]))
continue;
$params[] = $name;
switch ($type) {
case SQL_DEF_BOOLEAN:
$values[] = $vals[$name]?1:0;
break;
case SQL_DEF_INT:
$values[] = $vals[$name];
break;
case SQL_DEF_DATE: // date
if (is_string($vals[$name]))
$values[] = "'".addslashes($vals[$name])."'";
else
$values[] = "'".$this->toDate($vals[$name])."'";
break;
default:
$values[] = "'".addslashes($vals[$name])."'";
break;
}
}
$sql .= "(\n\t".implode(",\n\t", $params)."\n) VALUES (\n\t".implode(",\n\t", $values)."\n);";
return $sql;
}
function insert($table, $values) {
$sql = $this->sqlInsert($table, $this->getDefs($table), $values);
$this->db->query($sql);
return $this->db->last_insert_id();
}
/// DELETE ///
function sqlDelete($table, $values=array(), $where='') {
$sql = "DELETE FROM\n\t".$table."\n";
$test = array();
foreach($values as $name => $value)
$test[] = '('.addslashes($name).' = '.var_export($value, true).')';
if ($test or $where)
$sql .= "WHERE\n\t";
if ($test)
$sql .= implode("\nAND\n\t", $test);
if ($where)
$sql .= "\n".$where;
return $sql.';';
}
function delete($table, $values=array(), $where='') {
$sql = $this->sqlDelete($table, $values, $where);
$result = $this->db->query($sql);
return $result;
}
/// UPDATE ///
function sqlUpdate($table, $props, $vals, $tests, $extra) {
$sql = 'UPDATE '.$table.' SET ';
$params = array();
$test = array();
$values = array();
foreach($props as $name => $type) {
if (!array_key_exists($name, $vals))
continue;
switch ($type) {
case SQL_DEF_BOOLEAN:
$values[] = '`'.$name.'` = '.($vals[$name]?'1':'0');
break;
case SQL_DEF_DATE:
if (is_string($vals[$name]))
$values[] = '`'.$name.'` = \''.addslashes($vals[$name]).'\'';
else
$values[] = '`'.$name.'` = \''.$this->toDate($vals[$name]).'\'';
break;
default:
$values[] = '`'.$name.'` = \''.addslashes($vals[$name]).'\'';
break;
}
}
$sql .= "\n\t".implode(",\n\t", $values)."\n";
foreach($tests as $name => $value) {
$test[] = '('.addslashes($name).' = '.var_export($value, true).')';
}
if ($test)
$sql .= "WHERE\n\t".implode("\nAND\n\t", $test);
$sql .= "\n".$extra;
return $sql;
}
function update($table, $values=array(), $test=array(), $extra='') {
$sql = $this->sqlUpdate($table, $this->getDefs($table), $values, $test, $extra);
$result = $this->db->query($sql);
return $result;
}
function sqlInsertOrUpdate($table, $props, $vals) {
$sql = $this->sqlInsert($table, $props, $vals);
$sql = substr($sql, 0, strlen($sql)-1);
$params = array();
$test = array();
$values = array();
foreach($props as $prop) {
if (!array_key_exists($prop[2], $vals))
continue;
$type = $prop[0];
$check = $prop[1];
$name = $prop[2];
if ($type{0} == '#')
$type = substr($type, 1);
if (($type{0} == '>') or ($type == 'id'))
continue;
switch ($type) {
case 'trad':
$values[] = '`'.$name."` = '".addslashes($vals[$name])."'";
break;
case 'textarea':
case 'string':
case 'option':
$values[] = '`'.$name."` = '".addslashes($vals[$name])."'";
break;
case 'id':
case 'int':
case 'float':
$values[] = '`'.$name.'` = '.addslashes($vals[$name]);
break;
case 'bool':
$values[] = '`'.$name.'` = '.($vals[$name]?'1':'0');
break;
}
}
$sql .= "\nON DUPLICATE KEY UPDATE\n\t".implode(",\n\t", $values)."\n";
return $sql;
}
function insertOrUpdate($table, $values) {
$sql = $this->sqlInsertOrUpdate($table, $this->getDefs($table), $values);
return $result;
}
/// Display
function getTableHtml($name, $params, $values, $order_by='')
{
$ret = '<table cellpadding="0" cellspacing="0" width="100%">';
$tr_header = '<td align="left" height="32px">&nbsp;';
$tr_header .= implode('</td><td align="left">&nbsp;', array_keys($params)).'</td>';
$ret .= _s('t header', $tr_header);
$i = 0;
if (!$values)
return '';
$current_section = '';
foreach ($values as $rows) {
if ($order_by && $rows[$order_by] != $current_section) {
$current_section = $rows[$order_by];
if ($current_section != '0')
$ret .= _s('t row ', '<td>'._s('section', $current_section).'</td>'.str_repeat('<td>'._s('section', '&nbsp;').'</td>', count($params)-1));
}
$td = '';
foreach ($params as $test => $param)
$td .= '<td align="left" height="22px">&nbsp;'.$rows[$param].'</td>';
$ret .= _s('t row '.strval($i % 2), $td);
$i++;
}
$ret .= '</table>';
return $ret;
}
}
?>

View file

@ -0,0 +1,43 @@
<?php
class ryLogger {
public $enable = false;
private $logs;
private static $_instance = NULL;
public static function getInstance() {
if (self::$_instance === NULL)
self::$_instance = new ryLogger();
return self::$_instance;
}
function addLog($log, $indent=NULL) {
if ($indent !== NULL)
$this->log_indent += $indent;
if ($log) {
$tabs = str_repeat(" ", $this->log_indent);
$a = $tabs.str_replace("\n", "\n ".$tabs, $log);
$this->logs[] = '<font color="#00FF00">'.$a.'</font>';
}
}
function addPrint($log, $color='#FFFF00') {
$this->logs[] = '<font color="'.$color.'">'.$log.'</font>';
}
function addError($log) {
$this->logs[] = '<font color="#FF5500"> ERROR: '.$log.'</font>';
}
function getLogs() {
$ret = '';
if ($this->logs && $this->enable)
$ret = "<b>Debug</b>\n\n".implode("\n", $this->logs);
$this->logs = array();
return $ret;
}
}
?>

View file

@ -0,0 +1,215 @@
<?php
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
function ryzom_app_render($title, $content, $ig=false, $bgcolor='', $javascript=array(), $homeLink=false) {
$c = '';
// Render header
$title_prefix = '';
if (ON_IPHONE) {
$title_prefix = 'Ryzom - ';
}
if (!$bgcolor)
$bgcolor = '#000000'.($ig?'00':'');
if (!$ig) {
$c .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'."\n";
$c .= '<html>
<head>'."\n";
$c .= ' <title>'.$title_prefix.(translation_exists($title)?_t($title):$title).'</title>'."\n";
$c .= ' <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8" />'."\n";
$c .= ryzom_render_header();
$c .= ryzom_render_header_www();
$events = ON_IPHONE ? 'onorientationchange="updateOrientation();" ' : '';
$c .= ' </head>'."\n";
$c .= ' <body '.$events.'bgcolor="'.$bgcolor.'">'."\n";
// Javascript
$js_code = '';
foreach ($javascript as $js)
$js_code .= '<script type="text/javascript" src="'.$js.'"></script>';
$c .= $js_code;
$c .= ryzom_render_www(ryzom_render_window($title, $content, $homeLink));
$c .= '</body></html>';
} else {
$c .= '<html><body>';
$c .= $content;
$debug = ryLogger::getInstance()->getLogs();
if ($debug)
$c .= '<table width="100%"><tr bgcolor="#002200"><td>'.$debug.'</td></tr></table>';
$c .= '</body></html>';
}
return $c;
}
function ryzom_render_header() {
if (ON_IPHONE) {
return '';
} else {
return ' <link type="text/css" href="'.RYAPI_URL.'data/css/ryzom_ui.css" rel="stylesheet" media="all" />';
}
}
// Call this inside the <head> part if you want to use ryzom_render_www
function ryzom_render_header_www() {
if (ON_IPHONE) {
return '
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.8;">
<link rel="apple-touch-icon" href="data/img/ryzom_icon.png"/>
<link type="text/css" href="data/css/ryzom_iphone.css" rel="stylesheet" media="all" />
<script type="text/javascript">
window.addEventListener("load", function() { setTimeout(loaded, 100) }, false);
window.onload = function initialLoad() { updateOrientation(); }
iPhone.DomLoad(updateOrientation);
setInterval(updateOrientation, 500);
function loaded() {
document.getElementById("main").style.visibility = "visible";
window.scrollTo(0, 1); // hide the location bar
}
function updateOrientation(){
switch (window.orientation) {
case 0:
case 180:
contentType = "show_normal";
break;
case -90:
case 90:
default:
contentType = "show_wide";
break;
}
document.getElementById("main").setAttribute("class", contentType);
}
function sizeTextarea(t) {
a = t.value.split(\'\n\');
b=1;
for (x=0;x < a.length; x++) {
if (a[x].length >= t.cols) b+= Math.floor(a[x].length/t.cols);
}
b+= a.length;
if (b > t.rows) t.rows = b;
}
</script>
';
} else {
return '
<style type="text/css">
body{background-image:url('.RYAPI_URL.'data/img/bg.jpg);background-repeat:no-repeat;color:white;background-color:black;font-family:arial;font-size:12px}
#main{width:95%;height:300px;margin-left:auto;margin-right:auto;text-align:left}
a, a:visited{color:orange;font-size:12px}
td{font-size:12px}
a:hover{color:orange}
.error{padding:.5em;background:#ff5555;color:white;font-weight:bold}
img{border:0px}
textarea{background-color:black;color:white;font-family:arial;font-size:12px}
pre{overflow:auto;width:800px}
</style>
';
}
}
// Render a Ryzom style window
function ryzom_render_window($title, $content, $homeLink=false) {
return ryzom_render_window_begin($title, $homeLink) . $content . ryzom_render_window_end();
}
function ryzom_render_window_begin($title, $homeLink=false) {
if ($homeLink === false)
$homeLink = '<span style="float:right;margin-right:12px;"><a href="'.RYAPP_URL.'/index.php" class="ryzom-ui-text-button">'._t('home').'</a></span>';
return '
<div class="ryzom-ui ryzom-ui-header">
<div class="ryzom-ui-tl"><div class="ryzom-ui-tr">
<div class="ryzom-ui-t">'.(translation_exists($title)?_t($title):$title).$homeLink.'</div>
</div>
</div>
<div class="ryzom-ui-l"><div class="ryzom-ui-r"><div class="ryzom-ui-m">
<div class="ryzom-ui-body">
';
}
function ryzom_render_window_end() {
return '</div>
<div style="background-color: #000000">'.ryLogger::getInstance()->getLogs().'</div></div></div></div>
<div class="ryzom-ui-bl"><div class="ryzom-ui-br"><div class="ryzom-ui-b"></div></div></div><p class="ryzom-ui-notice">powered by <a class="ryzom-ui-notice" href="http://dev.ryzom.com/projects/ryzom-api/wiki">ryzom-api</a></p>
</div>
';
}
// Render a webpage using www.ryzom.com style
function ryzom_render_www($content) {
return ryzom_render_www_begin() . $content . ryzom_render_www_end();
}
function ryzom_render_www_begin($url='') {
$style1 = 'position: relative; padding-top: 20px; padding-right: 30px; margin-bottom: -3px';
$style2 = 'position: absolute; bottom: 0; right: 0; ';
if (ON_IPHONE) {
$style1 = 'position: relative; padding-top: 30px; padding-right: 30px; ';
$style2 = 'position: fixed; top: 0; right: 0; padding-right: 0px;';
$marginBottom = '';
}
if (!$url) {
$url_params = parse_query($_SERVER['REQUEST_URI']);
unset($url_params['lang']);
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.http_build_query($url_params);
}
return '
<br />
<div id="main">
<div style="'.$style1.'">
<a href="'.$url.'&lang=en"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/en.png" alt="English" /></a>
<a href="'.$url.'&lang=fr"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/fr.png" alt="French" /></a>
<a href="'.$url.'&lang=de"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/de.png" alt="German" /></a>
<a href="'.$url.'&lang=ru"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/ru.png" alt="Russian" /></a>
<div style="'.$style2.'">
<a href="http://www.ryzom.com/"><img border="0" src="'.RYAPI_URL.'data/img/logo.gif" alt=""/></a>
</div>
</div>
';
}
function ryzom_render_www_end() {
return '</div>';
}
function ryzom_render_login_form($char, $aligned=true) {
$c = '';
if ($aligned) {
$c .= '<form action="" method="post"><table>';
$c .= '<tr><td>'._t('enter_char').'</td></tr>';
$c .= '<tr><td><input style="width: 200px" type="text" name="char" value="'.$char.'"/></td></tr>';
$c .= '<tr><td>'._t('enter_password').'</td></tr>';
$c .= '<tr><td><input style="width: 200px" type="password" name="password" /></td></tr>';
$c .= '<tr><td><input type="submit" value="'._t('submit').'" /></td></tr>';
} else {
$c .= '<form action="" method="post"><table width="100%">';
$c .= '<tr><td align="center">'._t('login').'</td></tr>';
$c .= '<tr><td align="center"><input style="width: 200px" type="text" name="char" value="'.$char.'"/></td></tr>';
$c .= '<tr><td align="center">'._t('password').'</td></tr>';
$c .= '<tr><td align="center"><input style="width: 200px" type="password" name="password" /></td></tr>';
$c .= '<tr><td align="center"><input type="submit" value="'._t('submit').'" /></td></tr>';
}
$c .= '</table></form>';
return $c;
}
?>

View file

@ -0,0 +1,3 @@
<?php
?>

View file

@ -0,0 +1,182 @@
<?php
include_once('logger.php');
// Always use this function to get param because in game, the param can be pass by _GET or by _POST
function ryzom_get_param($var, $default='')
{
if (isset($_POST[$var]))
return $_POST[$var];
else
if (isset($_GET[$var]))
return $_GET[$var];
else
return $default;
}
function parse_query($var)
{
$var = parse_url($var);
$arr = array();
if (isset($var['query'])) {
$var = html_entity_decode($var['query']);
$var = explode('&', $var);
foreach($var as $val) {
$x = explode('=', $val);
$arr[$x[0]] = urldecode($x[1]);
}
unset($val, $x, $var);
}
return $arr;
}
if (!function_exists('http_build_query')) {
function http_build_query($data, $prefix='', $sep='', $key='') {
$ret = array();
foreach ((array)$data as $k => $v) {
if (is_int($k) && $prefix != null) {
$k = urlencode($prefix . $k);
}
if ((!empty($key)) || ($key === 0)) $k = $key.'['.urlencode($k).']';
if (is_array($v) || is_object($v)) {
array_push($ret, http_build_query($v, '', $sep, $k));
} else {
array_push($ret, $k.'='.urlencode($v));
}
}
if (empty($sep)) $sep = ini_get('arg_separator.output');
return implode($sep, $ret);
}
}
/***
*
* Translation utilities
*
* ***/
function translation_exists($id) {
global $user, $ryzom_texts;
return isset($ryzom_texts[$id]) && isset($ryzom_texts[$id][$user['lang']]);
}
// Translate the $id in the selected language
function get_translation($id, $lang, $args=array()) {
global $ryzom_texts, $user;
if(!isset($ryzom_texts[$id])) return '{'.$id.'}';
if(!isset($ryzom_texts[$id][$lang])) return '{'.$id.'['.$lang.']}';
if($ryzom_texts[$id][$lang] == '' && isset($ryzom_texts[$id]['en'])) return @vsprintf($ryzom_texts[$id]['en'], $args);
return @vsprintf($ryzom_texts[$id][$lang], $args);
}
// Translate the $id in the user language
function _t($id, $args=array()) {
global $ryzom_texts, $user;
$a = '';
if ($args) {
if (is_array($args)) {
$a = array();
foreach ($args as $arg)
$a[] = strval($arg);
$a = ' '.implode(', ', $a);
} else
$a = ' '.strval($args);
}
if(!isset($ryzom_texts[$id])) return '{'.$id.$a.'}';
if(!isset($ryzom_texts[$id][$user['lang']])) return '{'.$id.'['.$user['lang'].']'.$a.'}';
if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['en']) && $ryzom_texts[$id]['en'] != '') return @vsprintf($ryzom_texts[$id]['en'], $args);
if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['fr']) && $ryzom_texts[$id]['fr'] != '') return '{'.$id.$a.'}';
if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['de']) && $ryzom_texts[$id]['de'] != '') return '{'.$id.$a.'}';
return @vsprintf($ryzom_texts[$id][$user['lang']], $args);
}
/***
*
* Ryzom time
*
* ***/
// Get a human and translated readable time, for example "3 days ago"
function ryzom_relative_time($timestamp) {
global $ryzom_periods, $user;
$difference = time() - $timestamp;
$lengths = array("60","60","24","7","4.35","12","10");
if ($difference >= 0) { // this was in the past
$ending = _t('ago');
} else { // this was in the future
$difference = -$difference;
$ending = _t('to_go');
}
for($j = 0,$m=count($lengths); $j<$m && $difference >= $lengths[$j]; $j++)
$difference /= $lengths[$j];
// round hours as '1.2 hours to go'
$difference = round($difference, ($j == 2) ? 1 : 0);
$form = ($difference == 1) ? 'singular' : 'plural';
// Handle exceptions
// French uses singular form if difference = 0
if ($user['lang'] == 'fr' && ($difference == 0)) {
$form = 'singular';
}
// Russian has a different plural form for plurals of 2 through 4
if ($user['lang'] == 'ru' && ($form == 'plural')) {
if ($difference < 5) {
$form = '2-4';
}
}
$final = $ryzom_periods[$user['lang']][$form][$j];
$text = _t('date_format', array($difference, $final, $ending));
return $text;
}
// Get a human and translated absolute date
function ryzom_absolute_time($timestamp) {
global $user, $ryzom_daysofweek, $ryzom_monthnames;
$day_of_month = date("j", $timestamp);
$dow = date("w", $timestamp);
$month = date("n", $timestamp);
$day_of_week = $ryzom_daysofweek[$user['lang']][$dow];
$month_str = $ryzom_monthnames[$user['lang']][$month-1];
$text = _t("absolute_date_format", array($day_of_month, $day_of_week, $month_str, $month, date("m", $timestamp), date("d", $timestamp)));
return $text;
}
/***
*
* Debug tools
*
* ***/
function p($var, $value=NULL) {
ob_start();
debug_print_backtrace();
$bt = ob_get_contents();
ob_end_clean();
$bt = explode("\n",$bt);
$bt = explode('[', $bt[1]);
ob_start();
echo '<font color="#AAFFFF">'.substr($bt[count($bt)-1], 0, -1)."</font>\n";
if ($value !== NULL) {
echo '<font color="#FFFFFF">'.$var.' : </font>';
$var = $value;
}
//if (is_array($var))
echo '<pre>';
print_r($var);
echo '</pre>';
// else
// var_dump($var);
ryLogger::getInstance()->addPrint(ob_get_contents());
ob_end_clean();
}
?>

View file

@ -0,0 +1,248 @@
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
html, body, form, fieldset, p, div, h1, h2, h3, h4, h5, h6 {
margin:0;
padding:0;
-webkit-text-size-adjust: none;
}
body {
font-size: 14px;
background: black;
font-family: Helvetica;
}
ul li {
padding: 0px 4px 10px 2px;
list-style: circle outside;
}
ol li {
padding: 0px 4px 10px 2px;
}
.ryzom-ui p {
padding-bottom:8px;
}
#main {
clear: both;
padding-top: 0px;
overflow:auto;
margin-left:auto;
margin-right:auto;
text-align:left
}
.error {
padding:.5em;
background:#ff5555;
color:white;
font-weight:bold
}
/*-----------------------------
ORIENTATION
-----------------------------*/
.content_wide,
.content_normal {
display:none;
}
.show_normal {
width: 320px;
}
.show_wide {
width: 480px;
}
.show_wide .content_wide,
.show_normal .content_normal {
display: block;
}
/* ---------------------- */
.ryzom-ui {
color: white;
}
.ryzom-ui input, .ryzom-ui select {
border-top: 1px solid #030403;
border-right: 1px solid #6e7f57;
border-bottom: 1px solid #889e6c;
border-left: 1px solid #272d1f;
background-color: #37402b;
color: #ddd;
font-size: 16px;
margin: 2px 0 5px 0;
}
.ryzom-ui input[type=text] {
width: 96%;
}
.ryzom-ui textarea {
width: 96%;
background-color: black;
color: white;
font-size: 16px;
font-family: Helvetica;
}
/* input[type=submit] will make IE6 to ignore whole CSS rule, so cant combine this with .ryzom-ui-button below */
input[type=submit] {
border-bottom: 1px solid #030403;
border-left: 1px solid #6e7f57;
border-top: 1px solid #889e6c;
border-right: 1px solid #272d1f;
background-color: #435120;
}
input.ryzom-ui-button, .ryzom-ui-button {
border-bottom: 1px solid #030403;
border-left: 1px solid #6e7f57;
border-top: 1px solid #889e6c;
border-right: 1px solid #272d1f;
background-color: #435120;
}
a, a:visited {color:orange}
a:hover {color:orange}
a.ryzom-ui-button, a.ryzom-ui-button:visited {
color: white;
padding: 0 .5em;
text-decoration: none;
}
a.ryzom-ui-button:hover {
background: #536130;
color: #ddd;
}
/* window without title - just borders */
.ryzom-ui-tl {
}
.ryzom-ui-tr {
}
.ryzom-ui-t {
background-image: url(skin_t.gif);
background-repeat: repeat-x;
background-position: left top;
height: 8px;
margin: 0;
}
/* window with proper header */
.ryzom-ui-header .ryzom-ui-tl {
margin: 0px 0px;
height: 32px;
}
.ryzom-ui-header .ryzom-ui-tr {
height: 32px;
}
.ryzom-ui-header .ryzom-ui-t {
background-image: url(skin_header_m.gif);
background-repeat: repeat-x;
background-position: left top;
padding: 7px 0 0 12px;
height: 32px;
text-transform: uppercase;
color: white;
border-top: 1px solid #030403;
}
/* window body */
.ryzom-ui-l {
}
.ryzom-ui-r {
}
.ryzom-ui-m {
margin: 0 0px;
padding: 0px;
background-image: url(skin_blank.png);
background-repeat: repeat;
}
.ryzom-ui-body {
background-image: url(skin_blank_inner.png);
background-repeat: repeat;
/* leave 5px room after bottom border */
margin: 0 8px 5px 2px;
padding: 5px 5px 5px 5px;
border-top: 1px solid #030403;
border-right: 1px solid #6e7f57;
border-bottom: 1px solid #889e6c;
border-left: 1px solid #272d1f;
}
/* window bottom border */
.ryzom-ui-bl {
height: 8px;
}
.ryzom-ui-br {
height: 8px;
}
.ryzom-ui-b {
height: 8px;
margin: 0 8px;
}
.ryzom-ui-notice {
margin: 0px;
padding: 0px;
color: #999;
text-align: center;
}
a.ryzom-ui-notice, a.ryzom-ui-notice:visited {
margin: 0px;
padding: 0px;
color: #BBB;
padding: 0 .5em;
text-decoration: underline;
}
a.ryzom-ui-notice:hover {
color: gray;
}
.ryzom-ui-t .ryzom-ui-text-button {
font-size: 85%;
}
a.ryzom-ui-text-button, a:visited.ryzom-ui-text-button {
color:#FFFF11;
text-decoration:none;
}
.ryzom-ui-text-button {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.ryzom-ui-text-button {
padding: 0;margin: 0;
border-color: #ff8 #ff3 #ff3 #ff8;
border-width: 1px;
border-style: solid;
padding: 0px 4px;
color: white;
}
.ryzom-ui-wrap-ul {
float: left;
text-align: center;
padding: 0;
list-style: none;
}
.ryzom-ui-wrap-li {
float: left;
margin: 0 0 10px 5px;
width: 6.1em;
list-style: none;
height: 70px;
}

View file

@ -0,0 +1,227 @@
/* Copyright (C) 2009 Winch Gate Property Limited
*
* This file is part of ryzom_api.
* ryzom_api is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ryzom_api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Check ryzom_api/functions_render.php for easy php function to render ryzom layout or use this following html:
*
<div class="ryzom-ui">
<div class="ryzom-ui-tl"><div class="ryzom-ui-tr">
<div class="ryzom-ui-t"><!-- title --></div>
</div></div>
<div class="ryzom-ui-l"><div class="ryzom-ui-r"><div class="ryzom-ui-m">
<div class="ryzom-ui-body"><!-- content --></div>
</div></div></div>
<div class="ryzom-ui-bl"><div class="ryzom-ui-br"><div class="ryzom-ui-b"></div></div></div>
</div><!-- .ryzom-ui -->
*/
.ryzom-ui {
color: white;
}
.ryzom-ui input, .ryzom-ui select {
border-top: 1px solid #030403;
border-right: 1px solid #6e7f57;
border-bottom: 1px solid #889e6c;
border-left: 1px solid #272d1f;
background-color: #37402b;
color: #ddd;
font-size: 12px;
margin: 2px 0 5px 0;
}
.ryzom-ui input[type=text] {
width: 100%;
}
.ryzom-ui textarea {
width: 98%;
}
/* input[type=submit] will make IE6 to ignore whole CSS rule, so cant combine this with .ryzom-ui-button below */
input[type=submit] {
border-bottom: 1px solid #030403;
border-left: 1px solid #6e7f57;
border-top: 1px solid #889e6c;
border-right: 1px solid #272d1f;
background-color: #435120;
}
input.ryzom-ui-button, .ryzom-ui-button {
border-bottom: 1px solid #030403;
border-left: 1px solid #6e7f57;
border-top: 1px solid #889e6c;
border-right: 1px solid #272d1f;
background-color: #435120;
}
a.ryzom-ui-button, a.ryzom-ui-button:visited {
color: white;
padding: 0 .5em;
text-decoration: none;
}
a.ryzom-ui-button:hover {
background: #536130;
color: #ddd;
}
/* window without title - just borders */
.ryzom-ui-tl {
background-image: url(skin_tl.gif);
background-repeat: no-repeat;
background-position: left top;
width: 100%; height: 8px;
}
.ryzom-ui-tr {
background-image: url(skin_tr.gif);
background-repeat: no-repeat;
background-position: right top;
height: 8px;
}
.ryzom-ui-t {
background-image: url(skin_t.gif);
background-repeat: repeat-x;
background-position: left top;
height: 8px;
margin: 0 8px;
}
/* window with proper header */
.ryzom-ui-header .ryzom-ui-tl {
margin: 0px 0px;
background-image: url(skin_header_l.gif);
background-repeat: no-repeat;
background-position: left top;
height: 32px;
}
.ryzom-ui-header .ryzom-ui-tr {
background-image: url(skin_header_r.gif);
background-repeat: no-repeat;
background-position: right top;
height: 32px;
}
.ryzom-ui-header .ryzom-ui-t {
background-image: url(skin_header_m.gif);
background-repeat: repeat-x;
background-position: left top;
margin-left: 12px;
margin-right: 26px;
padding-top: 9px;
height: 32px;
text-transform: uppercase;
color: white;
}
/* window body */
.ryzom-ui-l {
background-image: url(skin_l.gif);
background-position: left top;
background-repeat: repeat-y;
width: 100%;
}
.ryzom-ui-r {
background-image: url(skin_r.gif);
background-position: right top;
background-repeat: repeat-y;
width: 100%;
}
.ryzom-ui-m {
margin: 0 8px;
padding: 8px;
background-image: url(skin_blank.png);
background-repeat: repeat;
}
.ryzom-ui-body {
background-image: url(skin_blank_inner.png);
background-repeat: repeat;
/* leave 5px room after bottom border */
margin: 0px 0 5px 0;
padding: 10px 10px 5px 10px;
border-top: 1px solid #030403;
border-right: 1px solid #6e7f57;
border-bottom: 1px solid #889e6c;
border-left: 1px solid #272d1f;
}
/* window bottom border */
.ryzom-ui-bl {
background-image: url(skin_bl.gif);
background-repeat: no-repeat;
background-position: left top;
height: 8px;
}
.ryzom-ui-br {
background-image: url(skin_br.gif);
background-repeat: no-repeat;
background-position: right top;
height: 8px;
}
.ryzom-ui-b {
background-image: url(skin_b.gif);
background-repeat: repeat-x;
background-position: left top;
height: 8px;
margin: 0 8px;
}
.ryzom-ui-notice {
margin: 0px;
padding: 0px;
color: #333;
text-align: center;
}
a.ryzom-ui-notice, a.ryzom-ui-notice:visited {
margin: 0px;
padding: 0px;
color: #555;
padding: 0 .5em;
text-decoration: underline;
}
a.ryzom-ui-notice:hover {
color: gray;
}
.ryzom-ui-t .ryzom-ui-text-button {
font-size: 85%;
}
a.ryzom-ui-text-button, a:visited.ryzom-ui-text-button {
color:#FFFF11;
text-decoration:none;
}
.ryzom-ui-text-button {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.ryzom-ui-text-button {
padding: 0;margin: 0;
border-color: #ff8 #ff3 #ff3 #ff8;
border-width: 1px;
border-style: solid;
padding: 0px 4px;
color: white;
}
.ryzom-ui-wrap-ul {
float: left;
text-align: center;
padding: 0;
list-style: none;
margin-top: -5px;
margin-bottom: -20px;
}
.ryzom-ui-wrap-li {
float: left;
margin: 0 5px 10px 5px;
width: 6.1em;
padding: 0;
list-style: none;
height: 70px;
}

Some files were not shown because too many files have changed in this diff Show more