Merged: From gsoc2012-fabien r2211 to sound_dev

This commit is contained in:
kaetemi 2012-06-02 10:57:01 +02:00
commit 7bd37858ff
216 changed files with 13138 additions and 1241 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

@ -48,13 +48,15 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
IF(MERCURIAL_FOUND)
Mercurial_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
SET(CHANGESET ${ER_WC_CHANGESET})
SET(BRANCH ${ER_WC_BRANCH})
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
IF(REVISION)
IF(DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in)
ENDIF(REVISION)
ENDIF(DEFINED REVISION)

View file

@ -62,9 +62,8 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
LIST(APPEND ${_out_compile_flags} ${_directory_definitions})
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS})
# Format definitions and remove duplicates
# Format definitions
SEPARATE_ARGUMENTS(${_out_compile_flags})
LIST(REMOVE_DUPLICATES ${_out_compile_flags})
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
MACRO(_PCH_GET_PDB_FILENAME out_filename _target)
@ -98,9 +97,13 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _inputcpp _output)
IF(MSVC)
_PCH_GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\")
SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\")
ELSE(MSVC)
SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} -c ${_input})
SET(HEADER_FORMAT "c++-header")
IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
ENDIF(APPLE)
SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x ${HEADER_FORMAT} -o ${_output} -c ${_input})
ENDIF(MSVC)
ENDMACRO(_PCH_GET_COMPILE_COMMAND)

View file

@ -76,9 +76,10 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument:
###
MACRO(NL_DEFAULT_PROPS name label)
IF(NOT MSVC10)
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
ENDIF(NOT MSVC10)
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
STRING(REGEX REPLACE "\\:" " -" proj_label ${label})
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${proj_label})
GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library
@ -354,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")
@ -381,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
@ -396,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}")
@ -408,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
@ -477,13 +496,27 @@ 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(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")
IF(WIN32)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32")
ENDIF(WIN32)
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")
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")
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")
@ -499,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}")
@ -513,12 +581,14 @@ 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 "-DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}")
ENDIF(MSVC)
ENDMACRO(NL_SETUP_BUILD)
@ -709,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

@ -19,7 +19,7 @@ environments.
License
-------
Ryzom Core is a Free Software project under the GNU Affero General Public License,
Ryzom Core is a Free Software project under the GNU Affero General Public License v3,
which means all its code is available for everyone to download, examine,
use, modify, and distribute, subject to the usual restrictions attached
to any GPL software. If you are not familiar with the AGPL, see the COPYING

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

@ -21,6 +21,7 @@
#include "nel/misc/string_mapper.h"
#include "nel/misc/plane.h"
#include "nel/misc/aabbox.h"
#include "nel/misc/sheet_id.h"
#include "nel/3d/transform.h"
@ -125,9 +126,9 @@ public:
//\name Sound related.
//@{
void setSoundGroup(const std::string &soundGroup);
void setSoundGroup(const NLMISC::TStringId &soundGroupId);
void setSoundGroup(const NLMISC::CSheetId &soundGroupId);
const std::string &getSoundGroup();
NLMISC::TStringId getSoundGroupId();
NLMISC::CSheetId getSoundGroupId();
void setEnvironmentFx(const std::string &environmentFx);
void setEnvironmentFx(const NLMISC::TStringId &environmentFxId);
const std::string &getEnvironmentFx();
@ -188,7 +189,7 @@ private:
std::vector<NLMISC::CPlane> _Volume;
/// Sound group name id
NLMISC::TStringId _SoundGroupId;
NLMISC::CSheetId _SoundGroupId;
/// Environement Fx name Id (using CStringMapper)
NLMISC::TStringId _EnvironmentFxId;

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

@ -21,6 +21,7 @@
#include "nel/misc/string_mapper.h"
#include "nel/3d/ps_located.h"
#include "nel/3d/ps_attrib.h"
#include "nel/misc/sheet_id.h"
@ -63,13 +64,13 @@ public:
virtual void step(TPSProcessPass pass);
/// set the name of the sound
void setSoundName(const NLMISC::TStringId &soundName)
void setSoundName(const NLMISC::CSheetId &soundName)
{
_SoundName = soundName;
}
/// get the name of the sound
const NLMISC::TStringId &getSoundName(void) const
const NLMISC::CSheetId &getSoundName(void) const
{
return _SoundName;
}
@ -161,7 +162,7 @@ protected:
void removeAllSources();
CPSAttrib<UPSSoundInstance *> _Sounds;
NLMISC::TStringId _SoundName;
NLMISC::CSheetId _SoundName;
float _Gain;
CPSAttribMaker<float> * _GainScheme;
float _Pitch;

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

@ -162,7 +162,7 @@ public:
/// inherited from IPSSoundServer
UPSSoundInstance *createSound(const NLMISC::TStringId &soundName, bool spawned = true)
UPSSoundInstance *createSound(const NLMISC::CSheetId &soundName, bool spawned = true)
{
if (!_AudioMixer)
return NULL;

View file

@ -19,6 +19,7 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/string_mapper.h"
#include "nel/misc/sheet_id.h"
#include <string>
namespace NLMISC
@ -50,7 +51,7 @@ struct UPSSoundServer
* \param spawn true if the sound must be spawned e.g it continues after this interface is removed
* \param cb useful only for spawned sound, it tells when a spawned sound has been removed
*/
virtual UPSSoundInstance *createSound(const NLMISC::TStringId &soundName, bool spawn = false) = 0;
virtual UPSSoundInstance *createSound(const NLMISC::CSheetId &soundName, bool spawn = false) = 0;
};

View file

@ -394,7 +394,7 @@ public:
* If you are using the stream only in output mode, you can use this method as a faster version
* of clear() *if you don't serialize pointers*.
*/
void resetBufPos()
virtual void resetBufPos()
{
// This is ensured in CMemStream::CMemStream() and CMemStream::clear()
//if ( (!isReading()) && _Buffer.empty() )
@ -477,7 +477,7 @@ public:
}
/// See doc in CMemStream::bufferToFill()
uint8 *bufferToFill( uint32 msgsize )
virtual uint8 *bufferToFill( uint32 msgsize )
{
_FreeBits = 8;
_DbgInfo.clear();
@ -654,7 +654,7 @@ public:
virtual void serial(ucstring &b);
virtual void serial(CBitMemStream &b) { serialMemStream(b); }
virtual void serialMemStream(CBitMemStream &b);
virtual void serialMemStream(CMemStream &b);
//@}

View file

@ -22,8 +22,9 @@
#include <vector>
#ifdef NL_OS_WINDOWS
# define NOMINMAX
# include <windows.h>
struct HINSTANCE__;
typedef struct HINSTANCE__ *HINSTANCE;
typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */
#else
# include <dlfcn.h>
#endif

View file

@ -470,12 +470,12 @@ public:
/// return a string in form "(a:b:c:d)" where a,b,c,d are components of entity id.
std::string toString() const
{
std::string id;
id.reserve(25);
id+='(';
getDebugString (id);
id+=')';
return id;
std::string ident;
ident.reserve(25);
ident+='(';
getDebugString (ident);
ident+=')';
return ident;
}
/// Read from a debug string, use the same format as toString() (id:type:creator:dynamic) in hexadecimal

View file

@ -29,7 +29,7 @@ extern int *OptFastFloorCWStackPtr;
extern int *OptFastFloorCWStackEnd;
// fastFloor function.
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
#include <cfloat>

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

@ -301,7 +301,7 @@ public:
* If you are using the stream only in output mode, you can use this method as a faster version
* of clear() *if you don't serialize pointers*.
*/
void resetBufPos() { _Buffer.Pos = 0; }
virtual void resetBufPos() { _Buffer.Pos = 0; }
/**
* Resize the message buffer and fill data at position 0.
@ -340,7 +340,7 @@ public:
* fill it with raw data using any filling function (warning: don't fill more than 'msgsize'
* bytes!), then you are ready to read, using serial(), the data you've just filled.
*/
uint8 *bufferToFill( uint32 msgsize )
virtual uint8 *bufferToFill( uint32 msgsize )
{
#ifdef NL_DEBUG
nlassert( isReading() );

View file

@ -42,6 +42,20 @@ namespace NLMISC
class CWindowDisplayer;
}
#if defined(NL_OS_WINDOWS) && defined(_WINDOWS)
#ifndef WINAPI
#define WINAPI __stdcall
#endif
#ifndef APIENTRY
#define APIENTRY WINAPI
#endif
struct HINSTANCE__;
typedef struct HINSTANCE__ *HINSTANCE;
typedef char CHAR;
typedef CHAR *LPSTR;
#endif
namespace NLNET
{

View file

@ -25,6 +25,7 @@
#include <nel/misc/time_nl.h>
#include <nel/misc/stream.h>
#include <nel/misc/singleton.h>
#include <nel/misc/sheet_id.h>
#include <nel/sound/u_audio_mixer.h>
#include <nel/georges/u_form.h>
@ -180,7 +181,7 @@ public:
// Load environment sounds ; treeRoot can be null if you don't want an access to the envsounds
// virtual void loadEnvSounds( const char *filename, UEnvSound **treeRoot=NULL );
/// Get a TSoundId from a name (returns NULL if not found)
virtual TSoundId getSoundId( const NLMISC::TStringId &name );
virtual TSoundId getSoundId( const NLMISC::CSheetId &name );
/// Gets the group controller for the given group tree path with separator '/', if it doesn't exist yet it will be created.
/// Examples: "music", "effects", "dialog", "music/background", "music/loading", "music/player", etcetera
@ -192,7 +193,7 @@ public:
* pass a callback function that will be called (if not NULL) just before deleting the spawned
* source.
*/
virtual USource *createSource( const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL);
virtual USource *createSource( const NLMISC::CSheetId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL);
/// Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*)
virtual USource *createSource( TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL);
/// Add a source which was created by an EnvSound
@ -223,13 +224,15 @@ public:
/// Return the names of the sounds (call this method after loadSounds())
virtual void getSoundNames( std::vector<NLMISC::TStringId> &names ) const;
virtual void getSoundNames( std::vector<NLMISC::CSheetId> &names ) const;
/// Return the number of mixing tracks (voices)
virtual uint getPolyphony() const { return (uint)_Tracks.size(); }
/// Return the number of sources instance.
virtual uint getSourcesInstanceCount() const { return (uint)_Sources.size(); }
/// Return the number of playing sources (slow)
virtual uint getPlayingSourcesCount() const;
uint countPlayingSimpleSources() const; // debug
uint countSimpleSources() const; // debug
/// Return the number of available tracks
virtual uint getAvailableTracksCount() const;
/// Return the number of used tracks
@ -442,7 +445,7 @@ private:
/// Witch parameter to control
TControledParamId ParamId;
/// The controled sounds names.
std::vector<NLMISC::TStringId> SoundNames;
std::vector<NLMISC::CSheetId> SoundNames;
/// Current parameter value
float Value;
/// All the sources controled by this variable

View file

@ -64,7 +64,7 @@ public:
/// Associtation clas for storage of sound / filter.
struct TSoundInfo
{
NLMISC::TStringId SoundName;
NLMISC::CSheetId SoundName;
UAudioMixer::TBackgroundFlags Filter;
void serial(NLMISC::IStream &s)
@ -73,11 +73,11 @@ public:
if (s.isReading())
{
s.serial(soundName);
SoundName = NLMISC::CStringMapper::map(soundName);
SoundName = NLMISC::CSheetId(soundName);/*NLMISC::CStringMapper::map(soundName)*/;
}
else
{
soundName = NLMISC::CStringMapper::unmap(SoundName);
soundName = SoundName.toString();/* NLMISC::CStringMapper::unmap(SoundName)*/;
s.serial(soundName);
}
s.serial(Filter);

View file

@ -229,7 +229,7 @@ private:
struct TSoundData
{
/// The name of the sound.
NLMISC::TStringId SoundName;
NLMISC::CSheetId SoundName;
/// The reference to the sound.
CSound *Sound;
/// A source instance of the sound (may be NULL).

View file

@ -249,11 +249,12 @@ private:
/// The segment of all the audio path.
std::vector<std::pair<NLMISC::CVector, NLMISC::CVector> > _AudioPath;
typedef CHashMap<NLMISC::TStringId, CClusterSound, NLMISC::CStringIdHashMapTraits> TClusterSoundCont;
typedef CHashMap<NLMISC::CSheetId, CClusterSound, NLMISC::CSheetIdHashMapTraits> TClusterSoundCont;
/// The current cluster playing source indexed with sound group id
TClusterSoundCont _Sources;
typedef CHashMap<NLMISC::TStringId, NLMISC::TStringId, NLMISC::CStringIdHashMapTraits> TStringStringMap;
typedef CHashMap<NLMISC::CSheetId, NLMISC::CSheetId, NLMISC::CSheetIdHashMapTraits> TStringStringMap;
//typedef CHashMap<NLMISC::TStringId, NLMISC::TStringId, NLMISC::CStringIdHashMapTraits> TStringStringMap;
/// The sound_group to sound assoc
TStringStringMap _SoundGroupToSound;
};

View file

@ -52,8 +52,8 @@ public:
const std::vector<uint32> &getSoundSeq() const { return _SoundSeq;}
const std::vector<uint32> &getDelaySeq() const { return _DelaySeq;}
NLMISC::TStringId getSound(uint index) const { return !_Sounds.empty() ? _Sounds[index%_Sounds.size()]:0;}
const std::vector<NLMISC::TStringId> &getSounds() const { return _Sounds;}
NLMISC::CSheetId getSound(uint index) const { return !_Sounds.empty() ? _Sounds[index%_Sounds.size()]:NLMISC::CSheetId::Unknown;}
const std::vector<NLMISC::CSheetId> &getSounds() const { return _Sounds;}
uint32 getFadeLength() const { return _XFadeLength;}
@ -87,7 +87,7 @@ private:
virtual float getMaxDistance() const;
TPATTERN_MODE _PatternMode;
std::vector<NLMISC::TStringId> _Sounds;
std::vector<NLMISC::CSheetId> _Sounds;
float _TicksPerSeconds;
std::vector<uint32> _SoundSeq;
/// Sequence of delay in millisec.

View file

@ -133,7 +133,7 @@ class CContextSoundContainer : public IContextSoundContainer
virtual void addSound(CSound *sound, const std::string &baseName)
{
const std::string &patternName = NLMISC::CStringMapper::unmap(sound->getName());
const std::string &patternName = sound->getName().toString(); /*NLMISC::CStringMapper::unmap(sound->getName())*/;
nlassert(patternName.size() >= baseName.size());
std::string arg;
@ -172,7 +172,7 @@ class CContextSoundContainer : public IContextSoundContainer
if (i != NbJoker)
return;
nlassertex(i==NbJoker, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
nlassertex(i==NbJoker, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
sint randomValue = 0;
if (UseRandom)
@ -187,7 +187,7 @@ class CContextSoundContainer : public IContextSoundContainer
}
else if (!arg.empty())
{
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
// end of the argument.
NLMISC::fromString(arg, randomValue);
arg.clear();
@ -199,13 +199,13 @@ class CContextSoundContainer : public IContextSoundContainer
// read the potential last arg.
if (!arg.empty())
{
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
// end of the argument.
NLMISC::fromString(arg, randomValue);
arg.clear();
ok = true;
}
nlassertex (ok, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
nlassertex (ok, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
}
else
@ -221,9 +221,9 @@ class CContextSoundContainer : public IContextSoundContainer
if (!ret.second)
{
typename THashContextSound::iterator it = _ContextSounds.find(cm);
nlassertex(it != _ContextSounds.end(), ("Error wile adding soudn '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
nlassertex(it != _ContextSounds.end(), ("Error wile adding soudn '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
nlwarning("Sound %s has the same context matcher as the sound %s", NLMISC::CStringMapper::unmap(sound->getName()).c_str(), NLMISC::CStringMapper::unmap(it->second->getName()).c_str());
nlwarning("Sound %s has the same context matcher as the sound %s", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/, it->second->getName().toString().c_str() /*NLMISC::CStringMapper::unmap(it->second->getName()).c_str()*/);
}
}
@ -249,7 +249,7 @@ class CContextSoundContainer : public IContextSoundContainer
typename THashContextSound::const_iterator first(_ContextSounds.begin()), last(_ContextSounds.end());
for (; first != last; ++first)
{
subsounds.push_back(std::make_pair(NLMISC::CStringMapper::unmap(first->second->getName()), first->second));
subsounds.push_back(std::make_pair(first->second->getName().toString()/*NLMISC::CStringMapper::unmap(first->second->getName())*/, first->second));
}
}

View file

@ -57,9 +57,11 @@ public:
private:
CGroupController *m_Parent;
std::map<std::string, CGroupController *> m_Children;
float m_DevGain;
float m_UserGain;
/// Gain as set by the interface
float m_Gain;
/// Gain including parent gain
float m_FinalGain;
int m_NbSourcesInclChild;
@ -70,27 +72,22 @@ public:
/// \name UGroupController
//@{
virtual void setDevGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); m_DevGain = gain; updateSourceGain(); }
virtual float getDevGain() { return m_DevGain; }
virtual void setUserGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); m_UserGain = gain; updateSourceGain(); }
virtual float getUserGain() { return m_UserGain; }
virtual void setGain(float devGain, float userGain) { NLMISC::clamp(devGain, 0.0f, 1.0f); NLMISC::clamp(userGain, 0.0f, 1.0f); m_DevGain = devGain; m_UserGain = userGain; updateSourceGain(); }
virtual void setGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); if (m_Gain != gain) { m_Gain = gain; updateSourceGain(); } }
virtual float getGain() { return m_Gain; }
//@}
inline float getFinalGain() const { return m_FinalGain; }
void addSource(CSourceCommon *source);
void removeSource(CSourceCommon *source);
virtual std::string getPath();
protected:
virtual ~CGroupController(); // subnodes can only be deleted by the root
private:
inline float calculateTotalGain() { return m_DevGain * m_UserGain; }
inline float calculateTotalGain() { return m_Gain; }
virtual void calculateFinalGain();
virtual void increaseSources();
virtual void decreaseSources();

View file

@ -59,6 +59,7 @@ protected:
virtual void calculateFinalGain();
virtual void increaseSources();
virtual void decreaseSources();
static bool isReservedName(const std::string &nodeName);
}; /* class CGroupControllerRoot */

View file

@ -22,6 +22,7 @@
#include "nel/misc/string_mapper.h"
#include "nel/sound/u_source.h"
#include "nel/georges/u_form_elm.h"
#include "nel/misc/sheet_id.h"
#include <string>
namespace NLSOUND {
@ -35,7 +36,7 @@ class CGroupController;
/// Sound names hash map
//typedef std::hash_map<std::string, CSound*> TSoundMap;
typedef CHashMap<NLMISC::TStringId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundMap;
typedef CHashMap<NLMISC::CSheetId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundMap;
/// Sound names set (for ambiant sounds)
typedef std::set<CSound*> TSoundSet;
@ -99,7 +100,7 @@ public:
/// Return the length of the sound in ms
virtual uint32 getDuration() = 0;
/// Return the name (must be unique)
const NLMISC::TStringId& getName() const { return _Name; }
const NLMISC::CSheetId& getName() const { return _Name; }
/// Return the min distance (if detailed()) (default 1.0f if not implemented by sound type)
virtual float getMinDistance() const { return _MinDist; }
@ -121,7 +122,8 @@ public:
bool operator<( const CSound& otherSound ) const
{
return NLMISC::CStringMapper::unmap(_Name) < NLMISC::CStringMapper::unmap(otherSound._Name);
//return NLMISC::CStringMapper::unmap(_Name) < NLMISC::CStringMapper::unmap(otherSound._Name);
return _Name.toString() < otherSound._Name.toString();
}
protected:
@ -142,7 +144,7 @@ protected:
float _MaxDist;
// Sound name.
NLMISC::TStringId _Name;
NLMISC::CSheetId _Name;
/// An optional user var controler.
NLMISC::TStringId _UserVarControler;

View file

@ -20,6 +20,7 @@
#include "nel/misc/string_mapper.h"
#include "nel/3d/cluster.h"
#include "nel/sound/u_source.h"
#include "nel/misc/sheet_id.h"
namespace NLMISC
@ -31,7 +32,7 @@ namespace NLMISC
namespace NLSOUND {
typedef std::set<NLMISC::TStringId> TMarkerSoundSet;
typedef std::set<NLMISC::CSheetId> TMarkerSoundSet;
class UAudioMixer;
@ -50,13 +51,13 @@ public:
virtual float getTime() const { return _Time; }
/** Add a new sound in the set of to-be-played sounds for this marker */
virtual void addSound(const NLMISC::TStringId &soundName);
virtual void addSound(const NLMISC::CSheetId &soundName);
/** Remove a sound */
virtual void removeSound(const NLMISC::TStringId &soundName);
virtual void removeSound(const NLMISC::CSheetId &soundName);
/** Return the set of sounds of this marker */
virtual void getSounds(std::vector<NLMISC::TStringId> &sounds);
virtual void getSounds(std::vector<NLMISC::CSheetId> &sounds);
/** Play all the sounds of this marker */
virtual void play(UAudioMixer* mixer, NL3D::CCluster *cluster, CSoundContext &context);

View file

@ -20,6 +20,7 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/string_mapper.h"
#include "nel/sound/audio_mixer_user.h"
#include "nel/misc/sheet_id.h"
#include <string>
namespace NLSOUND {
@ -67,16 +68,16 @@ public:
bool isLoaded();
/// Return a sound corresponding to a name.
CSound *getSound(const NLMISC::TStringId &name);
CSound *getSound(const NLMISC::CSheetId &name);
/// Return the names of the sounds
void getNames( std::vector<NLMISC::TStringId> &names );
void getNames( std::vector<NLMISC::CSheetId> &names );
/// Return the number of sounds in this bank.
uint countSounds();
void addSound(CSound *sound);
void removeSound(const NLMISC::TStringId &name);
void removeSound(const NLMISC::CSheetId &name);
private:
@ -88,7 +89,7 @@ private:
typedef CHashMap<NLMISC::TStringId, TSimpleSoundContainer, NLMISC::CStringIdHashMapTraits> TBufferAssocContainer;
/// Sound names hash map
// typedef std::hash_map<std::string, CSound*> TSoundTable;
typedef CHashMap<NLMISC::TStringId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundTable;
typedef CHashMap<NLMISC::CSheetId, CSound*, NLMISC::CSheetIdHashMapTraits> TSoundTable;
/// Assoc from buffer to sound. Used for sound unloading.
TBufferAssocContainer _BufferAssoc;

View file

@ -23,6 +23,7 @@
#include "nel/3d/cluster.h"
#include "nel/sound/sound.h"
#include "nel/sound/group_controller.h"
#include "nel/misc/sheet_id.h"
namespace NLSOUND {

View file

@ -19,6 +19,7 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/string_mapper.h"
#include "nel/misc/sheet_id.h"
#include "nel/sound/u_source.h"
#include "nel/sound/u_group_controller.h"
#include "nel/ligo/primitive.h"
@ -284,7 +285,7 @@ public:
//@}
/// Get a TSoundId from a name (returns NULL if not found)
virtual TSoundId getSoundId( const NLMISC::TStringId &name ) = 0;
virtual TSoundId getSoundId( const NLMISC::CSheetId &name ) = 0;
/// Gets the group controller for the given group tree path with separator '/', if it doesn't exist yet it will be created.
/// Examples: "music", "effects", "dialog", "music/background", "music/loading", "music/player", etcetera
@ -296,7 +297,7 @@ public:
* pass a callback function that will be called (if not NULL) just before deleting the spawned
* source.
*/
virtual USource *createSource(const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0;
virtual USource *createSource(const NLMISC::CSheetId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0;
/// Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*)
virtual USource *createSource(TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0;
@ -320,7 +321,7 @@ public:
//@{
//@name Statistic and utility methods
/// Fill a vector with the names of all loaded sounds.
virtual void getSoundNames( std::vector<NLMISC::TStringId> &names ) const = 0;
virtual void getSoundNames( std::vector<NLMISC::CSheetId> &names ) const = 0;
/// Return the number of mixing tracks (voices)
virtual uint getPolyphony() const = 0;
/// Return the number of sources

View file

@ -35,9 +35,9 @@
// Project includes
#define NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER "effects"
#define NLSOUND_SHEET_V1_DEFAULT_SOUND_MUSIC_GROUP_CONTROLLER "music"
#define NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER "dialog"
#define NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER "sound:effects:game"
#define NLSOUND_SHEET_V1_DEFAULT_SOUND_MUSIC_GROUP_CONTROLLER "sound:music:game"
#define NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER "sound:dialog:game"
namespace NLSOUND {
@ -50,13 +50,8 @@ namespace NLSOUND {
class UGroupController
{
public:
virtual void setDevGain(float gain) = 0;
virtual float getDevGain() = 0;
virtual void setUserGain(float gain) = 0;
virtual float getUserGain() = 0;
virtual void setGain(float devGain, float userGain) = 0;
virtual void setGain(float gain) = 0;
virtual float getGain() = 0;
protected:
virtual ~UGroupController() { }

View file

@ -100,7 +100,7 @@ USource *OnAddSource( const char *name, float x, float y, float z )
/*
* Create a source with sound 'name', and set some of its initial properties, if successful
*/
USource *source = AudioMixer->createSource( CStringMapper::map(name) );
USource *source = AudioMixer->createSource( /*CStringMapper::map(name)*/ CSheetId(name) );
if ( source != NULL )
{
source->setPos( CVector(x,y,z) );

View file

@ -20,8 +20,6 @@
#include <stdio.h>
#ifdef NL_OS_WINDOWS
# include <conio.h>
#else
# include <curses.h>
#endif
// NeL includes
@ -99,14 +97,14 @@ static void initSample()
//NLMISC::CHTimer::startBench();
s_Source = s_AudioMixer->createSource(CStringMapper::map("stream_file"));
s_Source = s_AudioMixer->createSource(/*CStringMapper::map("stream_file")*/ CSheetId("stream_file"));
nlassert(s_Source);
s_StreamFileSource = dynamic_cast<CStreamFileSource *>(s_Source);
nlassert(s_StreamFileSource);
// s_Source->setSourceRelativeMode(true);
// s_Source->setPitch(2.0f);
s_GroupController = s_AudioMixer->getGroupController("dialog");
s_GroupController = s_AudioMixer->getGroupController("sound:dialog");
}
static void runSample()
@ -129,10 +127,10 @@ static void runSample()
#endif
{
case '+':
s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f);
s_GroupController->setGain(s_GroupController->getGain() + 0.1f);
break;
case '-':
s_GroupController->setUserGain(s_GroupController->getUserGain() - 0.1f);
s_GroupController->setGain(s_GroupController->getGain() - 0.1f);
break;
case 'x':
s_Source->stop();

View file

@ -20,8 +20,6 @@
#include <stdio.h>
#ifdef NL_OS_WINDOWS
# include <conio.h>
#else
# include <curses.h>
#endif
// NeL includes
@ -89,7 +87,7 @@ static void initSample()
//NLMISC::CHTimer::startBench();
USource *source = s_AudioMixer->createSource(CStringMapper::map("default_stream"));
USource *source = s_AudioMixer->createSource(CSheetId("default_stream")/*CStringMapper::map("default_stream")*/);
nlassert(source);
s_StreamSource = dynamic_cast<UStreamSource *>(source);
nlassert(s_StreamSource);
@ -100,7 +98,7 @@ static void initSample()
s_StreamSource->setFormat(s_AudioDecoder->getChannels(), s_AudioDecoder->getBitsPerSample(), (uint32)s_AudioDecoder->getSamplesPerSec());
//s_StreamSource->setPitch(2.0f);
s_GroupController = s_AudioMixer->getGroupController("dialog");
s_GroupController = s_AudioMixer->getGroupController("sound:dialog");
}
//CMutex *s_Mutex = NULL;
@ -154,10 +152,10 @@ static void runSample()
#endif
{
case '+':
s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f);
s_GroupController->setGain(s_GroupController->getGain() + 0.1f);
break;
case '-':
s_GroupController->setUserGain(s_GroupController->getUserGain() - 0.1f);
s_GroupController->setGain(s_GroupController->getGain() - 0.1f);
break;
default:
return;

View file

@ -51,7 +51,9 @@ CCluster::CCluster ()
// map a no fx string
_EnvironmentFxId = CStringMapper::map("no fx");
// map a no soundgroup string
_SoundGroupId = CStringMapper::map("");
_SoundGroupId = NLMISC::CSheetId::Unknown; /*CStringMapper::map("")*/;
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
// I am a transform cluster
CTransform::setIsCluster(true);
@ -76,18 +78,21 @@ CCluster::~CCluster()
void CCluster::setSoundGroup(const std::string &soundGroup)
{
_SoundGroupId = CStringMapper::map(soundGroup);
_SoundGroupId = NLMISC::CSheetId(soundGroup);/*CStringMapper::map(soundGroup);*/
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
}
void CCluster::setSoundGroup(const NLMISC::TStringId &soundGroupId)
void CCluster::setSoundGroup(const NLMISC::CSheetId &soundGroupId)
{
_SoundGroupId = soundGroupId;
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
}
const std::string &CCluster::getSoundGroup()
{
return CStringMapper::unmap(_SoundGroupId);
return _SoundGroupId.toString();/*CStringMapper::unmap(_SoundGroupId)*/;
}
NLMISC::TStringId CCluster::getSoundGroupId()
NLMISC::CSheetId CCluster::getSoundGroupId()
{
return _SoundGroupId;
}
@ -304,7 +309,8 @@ void CCluster::serial (NLMISC::IStream&f)
std::string envFxName;
f.serial(soundGroup);
_SoundGroupId = CStringMapper::map(soundGroup);
_SoundGroupId = NLMISC::CSheetId(soundGroup); /*CStringMapper::map(soundGroup)*/;
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
f.serial(envFxName);
if (envFxName == "")
@ -314,7 +320,7 @@ void CCluster::serial (NLMISC::IStream&f)
else
{
// write the sound group
std::string soundGroup = CStringMapper::unmap(_SoundGroupId);
std::string soundGroup = _SoundGroupId.toString();/*CStringMapper::unmap(_SoundGroupId)*/;
f.serial(soundGroup);
// write the env fx name
std::string envFxName = CStringMapper::unmap(_EnvironmentFxId);

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,42 +641,44 @@ 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)
{
_EVSPositionHandle = nglBindParameterEXT(GL_CURRENT_VERTEX_EXT);
_EVSNormalHandle = nglBindParameterEXT(GL_CURRENT_NORMAL);
_EVSColorHandle = nglBindParameterEXT(GL_CURRENT_COLOR);
_EVSPositionHandle = nglBindParameterEXT(GL_CURRENT_VERTEX_EXT);
_EVSNormalHandle = nglBindParameterEXT(GL_CURRENT_NORMAL);
_EVSColorHandle = nglBindParameterEXT(GL_CURRENT_COLOR);
if (!_EVSPositionHandle || !_EVSNormalHandle || !_EVSColorHandle)
if (!_EVSPositionHandle || !_EVSNormalHandle || !_EVSColorHandle)
{
nlwarning("Unable to bind input parameters for use with EXT_vertex_shader, vertex program support is disabled");
_Extensions.EXTVertexShader = false;
}
else
{
// bind texture units
for(uint k = 0; k < 8; ++k)
{
nlwarning("Unable to bind input parameters for use with EXT_vertex_shader, vertex program support is disabled");
_EVSTexHandle[k] = nglBindTextureUnitParameterEXT(GL_TEXTURE0_ARB + k, GL_CURRENT_TEXTURE_COORDS);
}
// Other attributes are managed using variant pointers :
// Secondary color
// Fog Coords
// Skin Weight
// Skin palette
// This mean that they must have 4 components
// Allocate invariants. One assitionnal variant is needed for fog coordinate if fog bug is not fixed in driver version
_EVSConstantHandle = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_INVARIANT_EXT, GL_FULL_RANGE_EXT, _EVSNumConstant + (_ATIFogRangeFixed ? 0 : 1));
if (_EVSConstantHandle == 0)
{
nlwarning("Unable to allocate constants for EXT_vertex_shader, vertex program support is disabled");
_Extensions.EXTVertexShader = false;
}
else
{
// bind texture units
for(uint k = 0; k < 8; ++k)
{
_EVSTexHandle[k] = nglBindTextureUnitParameterEXT(GL_TEXTURE0_ARB + k, GL_CURRENT_TEXTURE_COORDS);
}
// Other attributes are managed using variant pointers :
// Secondary color
// Fog Coords
// Skin Weight
// Skin palette
// This mean that they must have 4 components
// Allocate invariants. One assitionnal variant is needed for fog coordinate if fog bug is not fixed in driver version
_EVSConstantHandle = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_INVARIANT_EXT, GL_FULL_RANGE_EXT, _EVSNumConstant + (_ATIFogRangeFixed ? 0 : 1));
if (_EVSConstantHandle == 0)
{
nlwarning("Unable to allocate constants for EXT_vertex_shader, vertex program support is disabled");
_Extensions.EXTVertexShader = false;
}
}
}
}
#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 registerWGlExtensions(CGlExtensions &ext, HDC hDC)
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);
@ -1569,7 +1808,7 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
// ***************************************************************************
bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen)
bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen)
{
H_AUTO_OGL(registerGlXExtensions);
@ -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,20 +20,15 @@
#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>
# endif
namespace NLDRIVERGL {
#endif
#endif
namespace NL3D
{
// ***************************************************************************
/**
@ -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);
@ -265,7 +384,7 @@ bool CTextureDrvInfosGL::activeFrameBufferObject(ITexture * tex)
// ***************************************************************************
// Get the glText mirror of an existing setuped texture.
static inline CTextureDrvInfosGL* getTextureGl(ITexture& tex)
static inline CTextureDrvInfosGL* getTextureGl(ITexture& tex)
{
H_AUTO_OGL(getTextureGl)
CTextureDrvInfosGL* gltex;
@ -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
{
if(extensions.Version1_2)
return GL_CLAMP_TO_EDGE;
else
return GL_CLAMP;
}
#ifdef USE_OPENGLES
return GL_CLAMP_TO_EDGE;
#else
if(extensions.Version1_2)
return GL_CLAMP_TO_EDGE;
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,8 +1401,13 @@ 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,
x0, y0, (x1-x0), (y1-y0), glfmt, imageSize, ptr );
#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,24 +22,20 @@
// 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
# ifdef HAVE_XRENDER
# include <X11/extensions/Xrender.h>
# endif // HAVE_XRENDER
# include <X11/Xatom.h>
# define _NET_WM_STATE_REMOVE 0
# define _NET_WM_STATE_ADD 1
# ifdef HAVE_XRANDR
# include <X11/extensions/Xrandr.h>
# endif // HAVE_XRANDR
# ifdef HAVE_XRENDER
# include <X11/extensions/Xrender.h>
# endif // HAVE_XRENDER
# include <X11/Xatom.h>
# define _NET_WM_STATE_REMOVE 0
# define _NET_WM_STATE_ADD 1
#endif // NL_OS_UNIX
#include "nel/misc/mouse_device.h"
@ -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
@ -1585,7 +1577,7 @@ bool CDriverGL::createWindow(const GfxMode &mode)
{
nlwarning("3D: Couldn't allocate XClassHint");
}
#endif // NL_OS_UNIX
_win = window;
@ -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,12 +1637,24 @@ bool CDriverGL::destroyWindow()
{
ReleaseDC(_win, _hDC);
_hDC = NULL;
// don't destroy window if it hasn't been created by our driver
if (_DestroyWindow)
DestroyWindow(_win);
}
#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 (_win && _DestroyWindow)
DestroyWindow(_win);
#elif defined(NL_OS_MAC)
if (_DestroyWindow)
@ -1654,16 +1670,8 @@ bool CDriverGL::destroyWindow()
_EventEmitter.closeIM();
if (_DestroyWindow)
{
if (_ctx)
glXDestroyContext(_dpy, _ctx);
if (_win)
XDestroyWindow(_dpy, _win);
}
_ctx = NULL;
if (_DestroyWindow && _win)
XDestroyWindow(_dpy, _win);
// 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,25 @@
#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
#else
using NL3D::CDriverGL;
#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,37 +14,35 @@
// 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
static NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver)
{
NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver)
// cancel if there is a driver and a custom exit handler set up
if(driver && driver->ExitFunc)
{
// cancel if there is a driver and a custom exit handler set up
if(driver && driver->ExitFunc)
{
driver->ExitFunc();
return NSTerminateCancel;
}
NLMISC::CCocoaEventEmitter* eventEmitter =
NLMISC::safe_cast<NLMISC::CCocoaEventEmitter*>(&(driver->_EventEmitter));
// cancel if there is a driver and cocoa event emitter handles the quit
if(driver && eventEmitter && eventEmitter->handleQuitRequest())
return NSTerminateCancel;
// just let the app terminate if no custom quit handling worked
return NSTerminateNow;
driver->ExitFunc();
return NSTerminateCancel;
}
NLMISC::CCocoaEventEmitter* eventEmitter =
NLMISC::safe_cast<NLMISC::CCocoaEventEmitter*>(&(driver->_EventEmitter));
// cancel if there is a driver and cocoa event emitter handles the quit
if(driver && eventEmitter && eventEmitter->handleQuitRequest())
return NSTerminateCancel;
// 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,44 @@
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
#else
using NL3D::CDriverGL;
#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,21 +14,18 @@
// 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
static void viewDidResize(NSView* view, CDriverGL* driver)
{
void viewDidResize(NSView* view, CDriverGL* driver)
{
NSRect rect = [[view superview] frame];
driver->_CurrentMode.Height = rect.size.height;
driver->_CurrentMode.Width = rect.size.width;
}
NSRect rect = [[view superview] frame];
driver->_CurrentMode.Height = rect.size.height;
driver->_CurrentMode.Width = rect.size.width;
}
@implementation CocoaOpenGLView
-(id)initWithFrame:(NSRect)frame
@ -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,25 @@
#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
#else
using NL3D::CDriverGL;
#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,32 +14,30 @@
// 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
static void windowDidMove(NSWindow* window, CDriverGL* driver)
{
void windowDidMove(NSWindow* window, NL3D::CDriverGL* driver)
{
// get the rect (position, size) of the screen with menu bar
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
// get the rect (position, size) of the screen with menu bar
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
// get the rect (position, size) of the window
NSRect windowRect = [window frame];
// get the rect (position, size) of the window
NSRect windowRect = [window frame];
// set x in driver
driver->_WindowX = windowRect.origin.x;
// set x in driver
driver->_WindowX = windowRect.origin.x;
// map y from cocoa to NeL coordinates before setting in driver
driver->_WindowY =
screenRect.size.height - windowRect.size.height - windowRect.origin.y;
}
// map y from cocoa to NeL coordinates before setting in driver
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

@ -618,7 +618,7 @@ void CPatch::computeTileLightmapPixelAutomatic(uint ts, uint tt, uint s, uint t
c= max(c, 0.f);
sint ic;
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
// FastFloor using fistp. Don't care convention.
float fc= c*256;
_asm

View file

@ -37,14 +37,14 @@ namespace NL3D
// ***************************************************************************
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
/* This floor works only for floor with noise, because floor/ceil are only made on decimal coordinates:
sTile =1.25 .... NB: because of difference of mapping (rare case), we may have sometimes values with
precision < 1/4 (eg 1.125). Just use f*256 to compute the floor.
NB: using a fastFloor() (fistp changing the controlfp() is not very a good idea here, because
computeNoise() are not "packed", so change on controlFp() would bee to frequent...
computeNoise() are not "packed", so change on controlFp() would bee too frequent...
And also because we need either floor() or ceil() here.
*/
inline sint noiseFloor(float f)

View file

@ -43,7 +43,7 @@ CPSSound::CPSSound() : _Gain(1.f),
{
NL_PS_FUNC(CPSSound_CPSSound)
if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("sound");
_SoundName = NLMISC::CStringMapper::emptyId();
_SoundName = NLMISC::CSheetId::Unknown /*NLMISC::CStringMapper::emptyId()*/;
}
// ***************************************************************************************************
@ -265,11 +265,11 @@ void CPSSound::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
std::string soundName;
f.serial(soundName);
_SoundName = NLMISC::CStringMapper::map(soundName);
_SoundName = NLMISC::CSheetId(soundName)/*NLMISC::CStringMapper::map(soundName)*/;
}
else
{
std::string soundName = NLMISC::CStringMapper::unmap(_SoundName);
std::string soundName = _SoundName.toString()/*NLMISC::CStringMapper::unmap(_SoundName)*/;
f.serial(soundName);
}

View file

@ -599,7 +599,7 @@ void CBitMemStream::append( const CBitMemStream& newBits )
/*
* Serial bitmemstream
*/
void CBitMemStream::serialMemStream(CBitMemStream &b)
void CBitMemStream::serialMemStream(CMemStream &b)
{
#ifdef LOG_ALL_TRAFFIC
sint32 bitpos = getPosInBit();

View file

@ -3731,7 +3731,7 @@ void CBitmap::blend(CBitmap &Bm0, CBitmap &Bm1, uint16 factor, bool inputBitmapI
{
// On a P4 2GHz, with a 256x256 texture, I got the following results :
// without mmx : 5.2 ms
// with mmx : 1.7 ms
// with mmx : 1.7 ms
// I'm sure this can be further optimized..
uint numPixLeft = numPix & 1; // process 2 pixels at once, so special case for odd number

View file

@ -109,7 +109,7 @@ static void jpgDecompressSkip(j_decompress_ptr cinfo, long num_bytes)
}
}
static void jpgDecompressTerm(j_decompress_ptr cinfo)
static void jpgDecompressTerm(j_decompress_ptr /* cinfo */)
{
}

View file

@ -237,12 +237,15 @@ namespace NLMISC
_PImpl = new TCoTaskData(this);
// _PImpl->_TaskThreadId = 0;
// _PImpl->_ParentThreadId = 0;
nlunreferenced(stackSize);
#else //NL_USE_THREAD_COTASK
// allocate platform specific data storage
_PImpl = new TCoTaskData;
nlunreferenced(stackSize);
#if defined (NL_OS_WINDOWS)
_PImpl->_Fiber = NULL;
_PImpl->_ParentFiber = NULL;
nlunreferenced(stackSize);
#elif defined(NL_OS_UNIX)
// allocate the stack
_PImpl->_Stack = new uint8[stackSize];

View file

@ -650,6 +650,9 @@ ICommand *CCommandRegistry::getCommand(const std::string &commandName)
NLMISC_CATEGORISED_COMMAND(nel,help,"display help on a specific variable/commands or on all variables and commands", "[<variable>|<command>]")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
// nlassert (_Commands != NULL);
// make sure we have a valid number of parameters

View file

@ -373,6 +373,10 @@ uint32 humanReadableToBytes (const string &str)
NLMISC_CATEGORISED_COMMAND(nel,btohr, "Convert a bytes number into an human readable number", "<int>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if (args.size() != 1)
return false;
@ -384,6 +388,10 @@ NLMISC_CATEGORISED_COMMAND(nel,btohr, "Convert a bytes number into an human read
NLMISC_CATEGORISED_COMMAND(nel,hrtob, "Convert a human readable number into a bytes number", "<hr>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if (args.size() != 1)
return false;
@ -446,6 +454,10 @@ uint32 fromHumanReadable (const std::string &str)
NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human readable time", "<int>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if (args.size() != 1)
return false;
@ -829,6 +841,7 @@ int nlfseek64( FILE *stream, sint64 offset, int origin )
return fsetpos (stream, &pos64);
#else // NL_OS_WINDOWS
// TODO: to fix for Linux and Mac OS X
// This code doesn't work under windows : fseek() implementation uses a signed 32 bits offset. What ever we do, it can't seek more than 2 Go.
// For the moment, i don't know if it works under linux for seek of more than 2 Go.
@ -871,6 +884,9 @@ sint64 nlftell64(FILE *stream)
}
else return -1;
#else
nlunreferenced(stream);
// TODO: implement for Linux and Mac OS X
nlerror("Not implemented");
return -1;
#endif
@ -885,9 +901,14 @@ sint64 nlftell64(FILE *stream)
NLMISC_CATEGORISED_COMMAND(nel, sleep, "Freeze the service for N seconds (for debug purpose)", "<N>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if(args.size() != 1) return false;
sint32 n = atoi (args[0].c_str());
sint32 n;
fromString(args[0], n);
log.displayNL ("Sleeping during %d seconds", n);
@ -897,6 +918,10 @@ NLMISC_CATEGORISED_COMMAND(nel, sleep, "Freeze the service for N seconds (for de
NLMISC_CATEGORISED_COMMAND(nel, system, "Execute the command line using system() function call (wait until the end of the command)", "<commandline>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if(args.size() != 1) return false;
string cmd = args[0];
@ -915,6 +940,10 @@ NLMISC_CATEGORISED_COMMAND(nel, system, "Execute the command line using system()
NLMISC_CATEGORISED_COMMAND(nel, launchProgram, "Execute the command line using launcProgram() function call (launch in background task without waiting the end of the execution)", "<programName> <arguments>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if(args.size() != 2) return false;
string cmd = args[0];
@ -927,6 +956,10 @@ NLMISC_CATEGORISED_COMMAND(nel, launchProgram, "Execute the command line using l
NLMISC_CATEGORISED_COMMAND(nel, killProgram, "kill a program given the pid", "<pid>")
{
nlunreferenced(rawCommandString);
nlunreferenced(quiet);
nlunreferenced(human);
if(args.size() != 1) return false;
uint32 pid;
fromString(args[0], pid);
@ -1030,6 +1063,9 @@ bool openDoc (const char *document)
}
else
return true;
#else
// TODO: implement for Linux and Mac OS X
nlunreferenced(document);
#endif // NL_OS_WINDOWS
return false;
}

View file

@ -24,7 +24,7 @@ int OptFastFloorCWStack[OptFastFloorCWStackSize];
int *OptFastFloorCWStackEnd = OptFastFloorCWStack + OptFastFloorCWStackSize;
int *OptFastFloorCWStackPtr = OptFastFloorCWStack;
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
double OptFastFloorMagicConst = pow(2.0,52) + pow(2.0,51);
float OptFastFloorMagicConst24 = (float)pow(2.0,23);

View file

@ -90,7 +90,7 @@ void CLog::setPosition (sint line, const char *fileName, const char *funcName)
_Mutex.enter();
_PosSet++;
_FileName = fileName;
_Line = line;
_Line = line;
_FuncName = funcName;
}
}

View file

@ -18,7 +18,7 @@
#include "nel/misc/noise_value.h"
#include "nel/misc/fast_floor.h"
#include "nel/misc/random.h"
namespace NLMISC
@ -45,8 +45,7 @@ public:
CRandomGrid3D()
{
//seed
CRandom Random;
Random.srand(0);
srand(0);
// init the grid
for(uint z=0; z<NL3D_NOISE_GRID_SIZE; z++)
@ -57,7 +56,7 @@ public:
{
uint id= x + (y<<NL3D_NOISE_GRID_SIZE_SHIFT) + (z<<(NL3D_NOISE_GRID_SIZE_SHIFT*2));
// take higher bits of rand gives better result.
uint v= Random.rand() >> 5;
uint v= rand() >> 5;
_Texture3d[id]= v&255;
}
}
@ -81,9 +80,9 @@ public:
// init LevelPhases.
for(i=0; i<NL3D_NOISE_LEVEL; i++)
{
_LevelPhase[i].x= Random.frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].y= Random.frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].z= Random.frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].x= frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].y= frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].z= frand(NL3D_NOISE_GRID_SIZE);
}
// not for level 0.
_LevelPhase[0]= CVector::Null;

View file

@ -55,6 +55,7 @@
#ifdef NL_OS_WINDOWS
#define NOMINMAX
#include <WinSock2.h>
#include <windows.h>
#endif

View file

@ -23,6 +23,7 @@
#include "nel/misc/command.h"
#include "nel/misc/file.h"
#include "nel/misc/path.h"
#include "nel/misc/sheet_id.h"
#include "nel/georges/u_form_loader.h"
#include "nel/georges/u_form_elm.h"
@ -221,6 +222,7 @@ void CAudioMixerUser::writeProfile(std::string& out)
*/
out += "Sound mixer: \n";
out += "\tPlaying sources: " + toString (getPlayingSourcesCount()) + " \n";
out += "\tPlaying simple sources: " + toString(countPlayingSimpleSources()) + " / " + toString(countSimpleSources()) + " \n";
out += "\tAvailable tracks: " + toString (getAvailableTracksCount()) + " \n";
out += "\tUsed tracks: " + toString (getUsedTracksCount()) + " \n";
// out << "\tMuted sources: " << nb << " \n";
@ -270,7 +272,8 @@ void CAudioMixerUser::reset()
_SourceWaitingForPlay.clear();
_MusicChannelFaders->reset();
for (uint i = 0; i < _NbMusicChannelFaders; ++i)
_MusicChannelFaders[i].reset();
// Stop tracks
uint i;
@ -1049,7 +1052,7 @@ public:
items->getArrayValue(soundName, i);
soundName = soundName.substr(0, soundName.find(".sound"));
cs.SoundNames.push_back(CStringMapper::map(soundName));
cs.SoundNames.push_back(CSheetId(soundName)/*CStringMapper::map(soundName)*/);
}
if (!cs.SoundNames.empty())
@ -1099,7 +1102,7 @@ void CAudioMixerUser::initUserVar()
TUserVarControlsContainer::iterator first(_UserVarControls.begin()), last(_UserVarControls.end());
for(; first != last; ++first)
{
std::vector<NLMISC::TStringId>::iterator first2(first->second.SoundNames.begin()), last2(first->second.SoundNames.end());
std::vector<NLMISC::CSheetId>::iterator first2(first->second.SoundNames.begin()), last2(first->second.SoundNames.end());
for (; first2 != last2; ++first2)
{
CSound *sound = getSoundId(*first2);
@ -1130,7 +1133,7 @@ void CAudioMixerUser::CControledSources::serial(NLMISC::IStream &s)
for (uint i=0; i<size; ++i)
{
s.serial(soundName);
SoundNames.push_back(CStringMapper::map(soundName));
SoundNames.push_back(CSheetId(soundName)/*CStringMapper::map(soundName)*/);
}
}
else
@ -1144,7 +1147,7 @@ void CAudioMixerUser::CControledSources::serial(NLMISC::IStream &s)
for (uint i=0; i<size; ++i)
{
soundName = CStringMapper::unmap(SoundNames[i]);
soundName = SoundNames[i].toString();/*CStringMapper::unmap(SoundNames[i])*/;
s.serial(soundName);
}
}
@ -1778,7 +1781,7 @@ void CAudioMixerUser::update()
// ******************************************************************
TSoundId CAudioMixerUser::getSoundId( const NLMISC::TStringId &name )
TSoundId CAudioMixerUser::getSoundId( const NLMISC::CSheetId &name )
{
return _SoundBank->getSound(name);
}
@ -1892,7 +1895,7 @@ retrySound:
if (invalid)
{
nlwarning("The sound %s contain an infinite recursion !", CStringMapper::unmap(id->getName()).c_str());
nlwarning("The sound %s contain an infinite recursion !", id->getName().toString().c_str()/*CStringMapper::unmap(id->getName()).c_str()*/);
return NULL;
}
@ -2033,7 +2036,7 @@ retrySound:
// ******************************************************************
USource *CAudioMixerUser::createSource( const NLMISC::TStringId &name, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context, UGroupController *groupController)
USource *CAudioMixerUser::createSource( const NLMISC::CSheetId &name, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context, UGroupController *groupController)
{
return createSource( getSoundId( name ), spawn, cb, userParam, cluster, context, groupController);
}
@ -2160,7 +2163,7 @@ bool CAudioMixerUser::unloadSampleBank(const std::string &name)
// ******************************************************************
void CAudioMixerUser::getSoundNames( std::vector<NLMISC::TStringId> &names ) const
void CAudioMixerUser::getSoundNames( std::vector<NLMISC::CSheetId> &names ) const
{
_SoundBank->getNames(names);
}
@ -2173,6 +2176,32 @@ uint CAudioMixerUser::getPlayingSourcesCount() const
return _PlayingSources;
}
// ******************************************************************
uint CAudioMixerUser::countPlayingSimpleSources() const
{
uint count = 0;
for (TSourceContainer::const_iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it)
{
if ((*it)->getType() == CSourceCommon::SOURCE_SIMPLE && (*it)->isPlaying())
++count;
}
return count;
}
uint CAudioMixerUser::countSimpleSources() const
{
uint count = 0;
for (TSourceContainer::const_iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it)
{
if ((*it)->getType() == CSourceCommon::SOURCE_SIMPLE)
++count;
}
return count;
}
// ******************************************************************
uint CAudioMixerUser::getAvailableTracksCount() const

View file

@ -84,7 +84,7 @@ void CBackgroundSound::importForm(const std::string& filename, NLGEORGES::UFormE
// Read the sound name.
std::string soundName;
psoundItem->getValueByName(soundName, "Sound");
sound.SoundName = CStringMapper::map(CFile::getFilenameWithoutExtension(soundName));
sound.SoundName = NLMISC::CSheetId(CFile::getFilenameWithoutExtension(soundName));/*CStringMapper::map(CFile::getFilenameWithoutExtension(soundName))*/;
// Read the environnement flag.
@ -133,7 +133,7 @@ void CBackgroundSound::getSubSoundList(std::vector<std::pair<std::string, CSound
for (; first != last; ++first)
{
CSound *sound = mixer->getSoundId(first->SoundName);
subsounds.push_back(make_pair(CStringMapper::unmap(first->SoundName), sound));
subsounds.push_back(make_pair(first->SoundName.toString()/*CStringMapper::unmap(first->SoundName)*/, sound));
}
}

View file

@ -86,7 +86,7 @@ void CBackgroundSoundManager::addSound(const std::string &soundName, uint layerI
CAudioMixerUser *mixer = CAudioMixerUser::instance();
TSoundData sd;
sd.SoundName = CStringMapper::map(soundName);
sd.SoundName = /*CStringMapper::map(soundName)*/ NLMISC::CSheetId(soundName);
sd.Sound = mixer->getSoundId(sd.SoundName);
sd.Source = 0;
@ -133,7 +133,7 @@ void CBackgroundSoundManager::addSound(const std::string &soundName, uint layerI
}
else
{
nlwarning ("The sound '%s' can't be loaded", CStringMapper::unmap(sd.SoundName).c_str());
nlwarning ("The sound '%s' can't be loaded", sd.SoundName.toString().c_str()/*CStringMapper::unmap(sd.SoundName).c_str()*/);
}
}
@ -1437,14 +1437,14 @@ void CBackgroundSoundManager::TSoundData::serial(NLMISC::IStream &s)
{
CAudioMixerUser *mixer = CAudioMixerUser::instance();
s.serial(str);
SoundName = NLMISC::CStringMapper::map(str);
SoundName = /*NLMISC::CStringMapper::map(str)*/ NLMISC::CSheetId(str);
Sound = mixer->getSoundId(SoundName);
Source = NULL;
Selected = false;
}
else
{
s.serial(const_cast<std::string&>(NLMISC::CStringMapper::unmap(SoundName)));
s.serial(const_cast<std::string&>(SoundName.toString()/*NLMISC::CStringMapper::unmap(SoundName)*/));
}
s.serial(MinBox);
s.serial(MaxBox);

View file

@ -70,7 +70,7 @@ float EAX_MATERIAL_PARAM[] =
class CSoundGroupSerializer
{
public:
std::vector<std::pair<NLMISC::TStringId, NLMISC::TStringId> > _SoundGroupAssoc;
std::vector<std::pair<NLMISC::CSheetId, NLMISC::CSheetId> > _SoundGroupAssoc;
// load the values using the george sheet (called by GEORGE::loadForm)
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const std::string &/* name */)
@ -103,7 +103,7 @@ public:
sound = sound.substr(0, n);
}
_SoundGroupAssoc.push_back(make_pair(CStringMapper::map(soundGroup), CStringMapper::map(sound)));
_SoundGroupAssoc.push_back(make_pair(CSheetId(soundGroup), CSheetId(sound) /*CStringMapper::map(soundGroup), CStringMapper::map(sound)*/));
}
}
catch(...)
@ -131,15 +131,15 @@ public:
s.serial(soundGroup);
s.serial(sound);
_SoundGroupAssoc.push_back(make_pair(CStringMapper::map(soundGroup), CStringMapper::map(sound)));
_SoundGroupAssoc.push_back(make_pair(CSheetId(soundGroup), CSheetId(sound) /*CStringMapper::map(soundGroup), CStringMapper::map(sound)*/));
}
else
{
std::string soundGroup;
std::string sound;
soundGroup = CStringMapper::unmap(_SoundGroupAssoc[i].first);
sound = CStringMapper::unmap(_SoundGroupAssoc[i].second);
soundGroup = _SoundGroupAssoc[i].first.toString();// CStringMapper::unmap(_SoundGroupAssoc[i].first);
sound = _SoundGroupAssoc[i].second.toString(); //CStringMapper::unmap(_SoundGroupAssoc[i].second);
s.serial(soundGroup);
s.serial(sound);
@ -254,10 +254,10 @@ void CClusteredSound::update(const CVector &listenerPos, const CVector &/* view
TClusterStatusMap::const_iterator first(_AudibleClusters.begin()), last(_AudibleClusters.end());
for (; first != last; ++first )
{
static NLMISC::TStringId NO_SOUND_GROUP = CStringMapper::emptyId();
static NLMISC::CSheetId NO_SOUND_GROUP = /*CStringMapper::emptyId()*/NLMISC::CSheetId::Unknown;
const CClusterSoundStatus &css = first->second;
CCluster *cluster = first->first;
NLMISC::TStringId soundGroup;
NLMISC::CSheetId soundGroup;
soundGroup = cluster->getSoundGroupId();
@ -292,7 +292,7 @@ void CClusteredSound::update(const CVector &listenerPos, const CVector &/* view
TStringStringMap::iterator it2(_SoundGroupToSound.find(soundGroup));
if (it2 != _SoundGroupToSound.end())
{
NLMISC::TStringId soundName = it2->second;
NLMISC::CSheetId soundName = it2->second;
CClusterSound cs;
// nldebug("Found the sound [%s] for sound group [%s]", CStringMapper::unmap(soundName).c_str(), CStringMapper::unmap(soundGroup).c_str());

View file

@ -19,6 +19,7 @@
#include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/sound/audio_mixer_user.h"
#include "nel/misc/sheet_id.h"
using namespace std;
using namespace NLMISC;
@ -63,11 +64,11 @@ void CComplexSound::parseSequence(const std::string &str, std::vector<uint32> &s
void CComplexSound::getSubSoundList(std::vector<std::pair<std::string, CSound*> > &subsounds) const
{
CAudioMixerUser *mixer = CAudioMixerUser::instance();
std::vector<NLMISC::TStringId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
std::vector<NLMISC::CSheetId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
for (; first != last; ++first)
{
CSound *sound = mixer->getSoundId(*first);
subsounds.push_back(make_pair(CStringMapper::unmap(*first), sound));
subsounds.push_back(make_pair((*first).toString()/*CStringMapper::unmap(*first)*/, sound));
}
}
@ -83,7 +84,7 @@ uint32 CComplexSound::getDuration()
CAudioMixerUser *mixer = CAudioMixerUser::instance();
vector<sint32> durations;
std::vector<NLMISC::TStringId>::iterator first(_Sounds.begin()), last(_Sounds.end());
std::vector<NLMISC::CSheetId>::iterator first(_Sounds.begin()), last(_Sounds.end());
for (; first != last; ++first)
{
CSound *sound = mixer->getSoundId(*first);
@ -204,7 +205,7 @@ float CComplexSound::getMaxDistance() const
CComplexSound *This = const_cast<CComplexSound*>(this);
This->_MaxDist = 0.0f;
std::vector<NLMISC::TStringId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
std::vector<NLMISC::CSheetId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
for (; first != last; ++first)
{
@ -236,7 +237,7 @@ void CComplexSound::serial(NLMISC::IStream &s)
{
std::string name;
s.serial(name);
_Sounds.push_back(CStringMapper::map(name));
_Sounds.push_back(/*CStringMapper::map(name)*/NLMISC::CSheetId(name));
}
}
else
@ -245,7 +246,7 @@ void CComplexSound::serial(NLMISC::IStream &s)
s.serial(nb);
for (uint i=0; i<nb; ++i)
{
std::string name = CStringMapper::unmap(_Sounds[i]);
std::string name = /*CStringMapper::unmap(_Sounds[i])*/_Sounds[i].toString();
s.serial(name);
}
}
@ -301,7 +302,7 @@ void CComplexSound::importForm(const std::string& filename, NLGEORGES::UFormElm&
if (psoundsArray->getArrayValue(soundname, i))
{
soundname = CFile::getFilenameWithoutExtension(soundname);
_Sounds.push_back(CStringMapper::map(soundname));
_Sounds.push_back(NLMISC::CSheetId(soundname)/*CStringMapper::map(soundname)*/);
}
}
}

View file

@ -190,9 +190,9 @@ void CComplexSource::playStuf()
case CComplexSound::MODE_ALL_IN_ONE:
{
// just spanw all the listed source.
const std::vector<NLMISC::TStringId> &sounds = _PatternSound->getSounds();
const std::vector<NLMISC::CSheetId> &sounds = _PatternSound->getSounds();
std::vector<NLMISC::TStringId>::const_iterator first(sounds.begin()), last(sounds.end());
std::vector<NLMISC::CSheetId>::const_iterator first(sounds.begin()), last(sounds.end());
if (_AllSources.empty())
{
@ -524,7 +524,7 @@ void CComplexSource::onUpdate()
else
{
// no sound after, just set an event at end of current sound to stop the complex sound.
nldebug("Setting last event for sound %s in %u millisec.", CStringMapper::unmap(_Source1->getSound()->getName()).c_str(), _Source1->getSound()->getDuration());
nldebug("Setting last event for sound %s in %u millisec.", _Source1->getSound()->getName().toString().c_str()/*CStringMapper::unmap(_Source1->getSound()->getName()).c_str()*/, _Source1->getSound()->getDuration());
if (_PatternSound->doFadeOut())
{
// set the event to begin fade out.

View file

@ -187,7 +187,7 @@ void CContextSound::init()
}
else
{
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
fromString(index, contextArgIndex[nbJoker++]);
parseArg = false;
index = "";
@ -195,13 +195,13 @@ void CContextSound::init()
}
else if (*first == 'r')
{
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
useRandom = true;
}
}
else if (*first == '%')
{
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
parseArg = true;
}
}
@ -215,7 +215,7 @@ void CContextSound::init()
}
else
{
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
fromString(index, contextArgIndex[nbJoker++]);
parseArg = false;
}
@ -247,7 +247,7 @@ void CContextSound::init()
LM_CASE_CONTAINER_CREATOR(9)
LM_CASE_CONTAINER_CREATOR(10)
default:
nlwarning("Unsuported number of context argument in context sound '%s'!", CStringMapper::unmap(_Name).c_str());
nlwarning("Unsuported number of context argument in context sound '%s'!", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/);
return;
}
// cleanup macro
@ -257,14 +257,14 @@ void CContextSound::init()
// ok, we have the container, now fill it with the sound
{
std::vector<NLMISC::TStringId> allSounds;
std::vector<NLMISC::CSheetId> allSounds;
// CSoundBank::getSoundNames(allSounds);
CAudioMixerUser::instance()->getSoundNames(allSounds);
std::vector<NLMISC::TStringId>::iterator first(allSounds.begin()), last(allSounds.end());
std::vector<NLMISC::CSheetId>::iterator first(allSounds.begin()), last(allSounds.end());
for (; first != last; ++first)
{
const std::string &soundName = CStringMapper::unmap(*first);
const std::string &soundName = first->toString()/*CStringMapper::unmap(*first)*/;
if (soundName.size() > _BaseName.size())
{
uint i;

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