Merged default into iOS-improvements iOS-improvements
authorAlex Szpakowski <slime73@gmail.com>
Wed, 20 Aug 2014 17:20:22 -0300
branchiOS-improvements
changeset 951563f5d07c7d70
parent 9514 5b56ab9ff5fe
parent 9100 441e6cee6d14
child 9516 77867123589c
Merged default into iOS-improvements
include/SDL_hints.h
include/SDL_syswm.h
src/file/cocoa/SDL_rwopsbundlesupport.m
src/filesystem/cocoa/SDL_sysfilesystem.m
     1.1 --- a/Android.mk	Fri Aug 08 15:14:09 2014 -0300
     1.2 +++ b/Android.mk	Wed Aug 20 17:20:22 2014 -0300
     1.3 @@ -34,7 +34,7 @@
     1.4  	$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
     1.5  	$(wildcard $(LOCAL_PATH)/src/power/*.c) \
     1.6  	$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
     1.7 -	$(wildcard $(LOCAL_PATH)/src/filesystem/dummy/*.c) \
     1.8 +	$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
     1.9  	$(wildcard $(LOCAL_PATH)/src/render/*.c) \
    1.10  	$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
    1.11  	$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
     2.1 --- a/CMakeLists.txt	Fri Aug 08 15:14:09 2014 -0300
     2.2 +++ b/CMakeLists.txt	Wed Aug 20 17:20:22 2014 -0300
     2.3 @@ -237,6 +237,7 @@
     2.4  set_option(VIDEO_X11           "Use X11 video driver" ${UNIX_SYS})
     2.5  set_option(VIDEO_WAYLAND       "Use Wayland video driver" ${UNIX_SYS})
     2.6  set_option(VIDEO_MIR           "Use Mir video driver" ${UNIX_SYS})
     2.7 +set_option(VIDEO_RPI           "Use Raspberry Pi video driver" ${UNIX_SYS})
     2.8  dep_option(X11_SHARED          "Dynamically load X11 support" ON "VIDEO_X11" OFF)
     2.9  set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm)
    2.10  foreach(_SUB ${SDL_X11_OPTIONS})
    2.11 @@ -330,11 +331,22 @@
    2.12  
    2.13    check_c_compiler_flag(-Wall HAVE_GCC_WALL)
    2.14    if(HAVE_GCC_WALL)
    2.15 +    list(APPEND EXTRA_CFLAGS "-Wall")
    2.16      if(HAIKU)
    2.17        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
    2.18      endif()
    2.19    endif()
    2.20 -  #check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
    2.21 +  check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
    2.22 +  if(HAVE_GCC_WSHADOW)
    2.23 +    list(APPEND EXTRA_CFLAGS "-Wshadow")
    2.24 +  endif()
    2.25 +
    2.26 +  set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
    2.27 +  check_c_compiler_flag("" HAVE_NO_UNDEFINED)
    2.28 +  set(CMAKE_REQUIRED_FLAGS)
    2.29 +  if(HAVE_NO_UNDEFINED)
    2.30 +    list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined")
    2.31 +  endif()
    2.32  endif()
    2.33  
    2.34  if(ASSEMBLY)
    2.35 @@ -658,6 +670,8 @@
    2.36    endif()
    2.37  
    2.38    if(SDL_VIDEO)
    2.39 +    # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
    2.40 +    CheckRPI()
    2.41      CheckX11()
    2.42      CheckMir()
    2.43      CheckDirectFB()
    2.44 @@ -805,6 +819,7 @@
    2.45      check_include_file(dsound.h HAVE_DSOUND_H)
    2.46      check_include_file(dinput.h HAVE_DINPUT_H)
    2.47      check_include_file(xaudio2.h HAVE_XAUDIO2_H)
    2.48 +    check_include_file(xinput.h HAVE_XINPUT_H)
    2.49      check_include_file(dxgi.h HAVE_DXGI_H)
    2.50      if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
    2.51        set(HAVE_DIRECTX TRUE)
    2.52 @@ -910,21 +925,31 @@
    2.53    endif()
    2.54  
    2.55    if(SDL_JOYSTICK)
    2.56 +    file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c)
    2.57 +    set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
    2.58      if(HAVE_DINPUT_H)
    2.59        set(SDL_JOYSTICK_DINPUT 1)
    2.60 -      set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_dxjoystick.c)
    2.61        list(APPEND EXTRA_LIBS dinput8 dxguid dxerr)
    2.62 -    else()
    2.63 +    endif()
    2.64 +    if(HAVE_XINPUT_H)
    2.65 +      set(SDL_JOYSTICK_XINPUT 1)
    2.66 +    endif()
    2.67 +    if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H)
    2.68        set(SDL_JOYSTICK_WINMM 1)
    2.69 -      set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_mmjoystick.c)
    2.70      endif()
    2.71      set(HAVE_SDL_JOYSTICK TRUE)
    2.72 -  endif()
    2.73  
    2.74 -  if(SDL_HAPTIC AND HAVE_DINPUT_H)
    2.75 -    set(SDL_HAPTIC_DINPUT 1)
    2.76 -    set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/haptic/windows/SDL_syshaptic.c)
    2.77 -    set(HAVE_SDL_HAPTIC TRUE)
    2.78 +    if(SDL_HAPTIC)
    2.79 +      file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c)
    2.80 +      set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
    2.81 +      if(HAVE_DINPUT_H)
    2.82 +        set(SDL_HAPTIC_DINPUT 1)
    2.83 +      endif()
    2.84 +      if(HAVE_XINPUT_H)
    2.85 +        set(SDL_HAPTIC_XINPUT 1)
    2.86 +      endif()
    2.87 +      set(HAVE_SDL_HAPTIC TRUE)
    2.88 +    endif()
    2.89    endif()
    2.90  
    2.91    file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)
    2.92 @@ -1306,7 +1331,9 @@
    2.93    # TODO: what about the .spec file? Is it only needed for RPM creation?
    2.94    install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
    2.95  else()
    2.96 -  install(TARGETS SDL2 RUNTIME DESTINATION bin)
    2.97 +  if(SDL_SHARED)
    2.98 +    install(TARGETS SDL2 RUNTIME DESTINATION bin)
    2.99 +  endif()
   2.100  endif()
   2.101  
   2.102  ##### Uninstall target #####
     3.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Fri Aug 08 15:14:09 2014 -0300
     3.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Wed Aug 20 17:20:22 2014 -0300
     3.3 @@ -543,11 +543,14 @@
     3.4      /** com.android.vending.expansion.zipfile.ZipResourceFile's getInputStream() or null. */
     3.5      private Method expansionFileMethod;
     3.6  
     3.7 +    /**
     3.8 +     * This method is called by SDL using JNI.
     3.9 +     */
    3.10      public InputStream openAPKExtensionInputStream(String fileName) throws IOException {
    3.11          // Get a ZipResourceFile representing a merger of both the main and patch files
    3.12          if (expansionFile == null) {
    3.13 -            Integer mainVersion = Integer.parseInt(nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"));
    3.14 -            Integer patchVersion = Integer.parseInt(nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"));
    3.15 +            Integer mainVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"));
    3.16 +            Integer patchVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"));
    3.17  
    3.18              try {
    3.19                  // To avoid direct dependency on Google APK extension library that is
     4.1 --- a/build-scripts/checker-buildbot.sh	Fri Aug 08 15:14:09 2014 -0300
     4.2 +++ b/build-scripts/checker-buildbot.sh	Wed Aug 20 17:20:22 2014 -0300
     4.3 @@ -61,13 +61,13 @@
     4.4  cd checker-buildbot
     4.5  
     4.6  # You might want to do this for CMake-backed builds instead...
     4.7 -#cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER="$CHECKERDIR/libexec/ccc-analyzer" ..
     4.8 +PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug ..
     4.9  
    4.10  # ...or run configure without the scan-build wrapper...
    4.11  #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure
    4.12  
    4.13 -# ...but this works for our buildbots just fine.
    4.14 -CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure
    4.15 +# ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X).
    4.16 +#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure
    4.17  
    4.18  rm -rf analysis
    4.19  PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE
     5.1 --- a/cmake/sdlchecks.cmake	Fri Aug 08 15:14:09 2014 -0300
     5.2 +++ b/cmake/sdlchecks.cmake	Wed Aug 20 17:20:22 2014 -0300
     5.3 @@ -917,3 +917,32 @@
     5.4      set(CMAKE_REQUIRED_FLAGS)
     5.5    endif(HAVE_USBHID)
     5.6  endmacro(CheckUSBHID)
     5.7 +
     5.8 +# Requires:
     5.9 +# - n/a
    5.10 +macro(CheckRPI)
    5.11 +  if(VIDEO_RPI)
    5.12 +    set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
    5.13 +    set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" )
    5.14 +    set(VIDEO_RPI_LIBS bcm_host )
    5.15 +    listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
    5.16 +    listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
    5.17 +
    5.18 +    set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
    5.19 +    set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
    5.20 +    check_c_source_compiles("
    5.21 +        #include <bcm_host.h>
    5.22 +        int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
    5.23 +    set(CMAKE_REQUIRED_FLAGS)
    5.24 +    set(CMAKE_REQUIRED_LIBRARIES)
    5.25 +
    5.26 +    if(SDL_VIDEO AND HAVE_VIDEO_RPI)
    5.27 +      set(HAVE_SDL_VIDEO TRUE)
    5.28 +      set(SDL_VIDEO_DRIVER_RPI 1)
    5.29 +      file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c)
    5.30 +      set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES})
    5.31 +      list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS})
    5.32 +      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
    5.33 +    endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
    5.34 +  endif(VIDEO_RPI)
    5.35 +endmacro(CheckRPI)
     6.1 --- a/docs/README-android.md	Fri Aug 08 15:14:09 2014 -0300
     6.2 +++ b/docs/README-android.md	Wed Aug 20 17:20:22 2014 -0300
     6.3 @@ -18,9 +18,9 @@
     6.4  
     6.5  - Android applications are Java-based, optionally with parts written in C
     6.6  - As SDL apps are C-based, we use a small Java shim that uses JNI to talk to 
     6.7 -the SDL library
     6.8 +  the SDL library
     6.9  - This means that your application C code must be placed inside an Android 
    6.10 -Java project, along with some C support code that communicates with Java
    6.11 +  Java project, along with some C support code that communicates with Java
    6.12  - This eventually produces a standard Android .apk package
    6.13  
    6.14  The Android Java code implements an "Activity" and can be found in:
    6.15 @@ -42,15 +42,15 @@
    6.16  
    6.17  There's two ways of using it:
    6.18  
    6.19 -androidbuild.sh com.yourcompany.yourapp < sources.list
    6.20 -androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
    6.21 +    androidbuild.sh com.yourcompany.yourapp < sources.list
    6.22 +    androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
    6.23  
    6.24  sources.list should be a text file with a source file name in each line
    6.25  Filenames should be specified relative to the current directory, for example if
    6.26  you are in the build-scripts directory and want to create the testgles.c test, you'll
    6.27  run:
    6.28 -    
    6.29 -./androidbuild.sh org.libsdl.testgles ../test/testgles.c
    6.30 +
    6.31 +    ./androidbuild.sh org.libsdl.testgles ../test/testgles.c
    6.32  
    6.33  One limitation of this script is that all sources provided will be aggregated into
    6.34  a single directory, thus all your source files should have a unique name.
    6.35 @@ -74,40 +74,42 @@
    6.36  If you want to use the Eclipse IDE, skip to the Eclipse section below.
    6.37  
    6.38  5. Create <project>/local.properties and use that to point to the Android SDK directory, by writing a line with the following form:
    6.39 -sdk.dir=PATH_TO_ANDROID_SDK
    6.40 +
    6.41 +       sdk.dir=PATH_TO_ANDROID_SDK
    6.42 +
    6.43  6. Run 'ant debug' in android/project. This compiles the .java and eventually 
    6.44     creates a .apk with the native code embedded
    6.45  7. 'ant debug install' will push the apk to the device or emulator (if connected)
    6.46  
    6.47  Here's an explanation of the files in the Android project, so you can customize them:
    6.48  
    6.49 -android-project/
    6.50 -	AndroidManifest.xml	- package manifest. Among others, it contains the class name
    6.51 -				  of the main Activity and the package name of the application.
    6.52 -	build.properties	- empty
    6.53 -	build.xml		- build description file, used by ant. The actual application name
    6.54 -				  is specified here.
    6.55 -	default.properties	- holds the target ABI for the application, android-10 and up
    6.56 -	project.properties	- holds the target ABI for the application, android-10 and up
    6.57 -	local.properties	- holds the SDK path, you should change this to the path to your SDK
    6.58 -	jni/			- directory holding native code
    6.59 -	jni/Android.mk		- Android makefile that can call recursively the Android.mk files
    6.60 -				  in all subdirectories
    6.61 -	jni/SDL/		- (symlink to) directory holding the SDL library files
    6.62 -	jni/SDL/Android.mk	- Android makefile for creating the SDL shared library
    6.63 -	jni/src/		- directory holding your C/C++ source
    6.64 -	jni/src/Android.mk	- Android makefile that you should customize to include your 
    6.65 +    android-project/
    6.66 +        AndroidManifest.xml	- package manifest. Among others, it contains the class name
    6.67 +        			  of the main Activity and the package name of the application.
    6.68 +        build.properties	- empty
    6.69 +        build.xml		- build description file, used by ant. The actual application name
    6.70 +        			  is specified here.
    6.71 +        default.properties	- holds the target ABI for the application, android-10 and up
    6.72 +        project.properties	- holds the target ABI for the application, android-10 and up
    6.73 +        local.properties	- holds the SDK path, you should change this to the path to your SDK
    6.74 +        jni/			- directory holding native code
    6.75 +        jni/Android.mk		- Android makefile that can call recursively the Android.mk files
    6.76 +        			  in all subdirectories
    6.77 +        jni/SDL/		- (symlink to) directory holding the SDL library files
    6.78 +        jni/SDL/Android.mk	- Android makefile for creating the SDL shared library
    6.79 +        jni/src/		- directory holding your C/C++ source
    6.80 +        jni/src/Android.mk	- Android makefile that you should customize to include your 
    6.81                                    source code and any library references
    6.82 -	res/			- directory holding resources for your application
    6.83 -	res/drawable-*		- directories holding icons for different phone hardware. Could be
    6.84 -				  one dir called "drawable".
    6.85 -	res/layout/main.xml	- Usually contains a file main.xml, which declares the screen layout.
    6.86 -				  We don't need it because we use the SDL video output.
    6.87 -	res/values/strings.xml	- strings used in your application, including the application name
    6.88 -				  shown on the phone.
    6.89 -	src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding
    6.90 -				  to SDL.  Be very careful changing this, as the SDL library relies
    6.91 -				  on this implementation.
    6.92 +        res/			- directory holding resources for your application
    6.93 +        res/drawable-*		- directories holding icons for different phone hardware. Could be
    6.94 +        			  one dir called "drawable".
    6.95 +        res/layout/main.xml	- Usually contains a file main.xml, which declares the screen layout.
    6.96 +        			  We don't need it because we use the SDL video output.
    6.97 +        res/values/strings.xml	- strings used in your application, including the application name
    6.98 +        			  shown on the phone.
    6.99 +        src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding
   6.100 +        			  to SDL.  Be very careful changing this, as the SDL library relies
   6.101 +        			  on this implementation.
   6.102  
   6.103  
   6.104  ================================================================================
   6.105 @@ -125,10 +127,10 @@
   6.106  4. create and export an environment variable named NDK_MODULE_PATH that points
   6.107     to the parent directory of this SDL directory. e.g.:
   6.108  
   6.109 -   export NDK_MODULE_PATH="$PWD"/..
   6.110 +       export NDK_MODULE_PATH="$PWD"/..
   6.111  
   6.112  5. Edit <project>/src/org/libsdl/app/SDLActivity.java and remove the call to
   6.113 -   System.loadLibrary("SDL2") line 42.
   6.114 +   System.loadLibrary("SDL2").
   6.115  6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
   6.116  
   6.117  
   6.118 @@ -141,21 +143,23 @@
   6.119  
   6.120  Then create a Java class extending SDLActivity and place it in a directory
   6.121  under src matching your package, e.g.
   6.122 -	src/com/gamemaker/game/MyGame.java
   6.123 +
   6.124 +    src/com/gamemaker/game/MyGame.java
   6.125  
   6.126  Here's an example of a minimal class file:
   6.127 ---- MyGame.java --------------------------
   6.128 -package com.gamemaker.game;
   6.129  
   6.130 -import org.libsdl.app.SDLActivity; 
   6.131 -
   6.132 -/* 
   6.133 - * A sample wrapper class that just calls SDLActivity 
   6.134 - */ 
   6.135 -
   6.136 -public class MyGame extends SDLActivity { }
   6.137 -
   6.138 -------------------------------------------
   6.139 +    --- MyGame.java --------------------------
   6.140 +    package com.gamemaker.game;
   6.141 +    
   6.142 +    import org.libsdl.app.SDLActivity; 
   6.143 +    
   6.144 +    /**
   6.145 +     * A sample wrapper class that just calls SDLActivity 
   6.146 +     */ 
   6.147 +    
   6.148 +    public class MyGame extends SDLActivity { }
   6.149 +    
   6.150 +    ------------------------------------------
   6.151  
   6.152  Then replace "SDLActivity" in AndroidManifest.xml with the name of your
   6.153  class, .e.g. "MyGame"
   6.154 @@ -182,9 +186,9 @@
   6.155  
   6.156  There are also a few Android specific functions that allow you to get other
   6.157  useful paths for saving and loading data:
   6.158 -SDL_AndroidGetInternalStoragePath()
   6.159 -SDL_AndroidGetExternalStorageState()
   6.160 -SDL_AndroidGetExternalStoragePath()
   6.161 +* SDL_AndroidGetInternalStoragePath()
   6.162 +* SDL_AndroidGetExternalStorageState()
   6.163 +* SDL_AndroidGetExternalStoragePath()
   6.164  
   6.165  See SDL_system.h for more details on these functions.
   6.166  
   6.167 @@ -226,11 +230,12 @@
   6.168  
   6.169  For a quick tour on how Linux native threads interoperate with the Java VM, take
   6.170  a look here: http://developer.android.com/guide/practices/jni.html
   6.171 +
   6.172  If you want to use threads in your SDL app, it's strongly recommended that you
   6.173  do so by creating them using SDL functions. This way, the required attach/detach
   6.174  handling is managed by SDL automagically. If you have threads created by other
   6.175  means and they make calls to SDL functions, make sure that you call
   6.176 -Android_JNI_SetupThread before doing anything else otherwise SDL will attach
   6.177 +Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
   6.178  your thread automatically anyway (when you make an SDL call), but it'll never
   6.179  detach it.
   6.180  
   6.181 @@ -240,7 +245,8 @@
   6.182  
   6.183  You can use STL in your project by creating an Application.mk file in the jni
   6.184  folder and adding the following line:
   6.185 -APP_STL := stlport_static
   6.186 +
   6.187 +    APP_STL := stlport_static
   6.188  
   6.189  For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
   6.190  
   6.191 @@ -266,7 +272,7 @@
   6.192   * Select the Android -> Android Project wizard and click Next
   6.193   * Enter the name you'd like your project to have
   6.194   * Select "Create project from existing source" and browse for your project directory
   6.195 - * Make sure the Build Target is set to Android 2.0
   6.196 + * Make sure the Build Target is set to Android 3.1 (API 12)
   6.197   * Click Finish
   6.198  
   6.199  
   6.200 @@ -290,49 +296,61 @@
   6.201   * Window -> Android SDK and AVD Manager
   6.202  
   6.203  You can see if adb can see any devices with the following command:
   6.204 -	adb devices
   6.205 +
   6.206 +    adb devices
   6.207  
   6.208  You can see the output of log messages on the default device with:
   6.209 -	adb logcat
   6.210 +
   6.211 +    adb logcat
   6.212  
   6.213  You can push files to the device with:
   6.214 -	adb push local_file remote_path_and_file
   6.215 +
   6.216 +    adb push local_file remote_path_and_file
   6.217  
   6.218  You can push files to the SD Card at /sdcard, for example:
   6.219 -	adb push moose.dat /sdcard/moose.dat
   6.220 +
   6.221 +    adb push moose.dat /sdcard/moose.dat
   6.222  
   6.223  You can see the files on the SD card with a shell command:
   6.224 -	adb shell ls /sdcard/
   6.225 +
   6.226 +    adb shell ls /sdcard/
   6.227  
   6.228  You can start a command shell on the default device with:
   6.229 -	adb shell
   6.230 +
   6.231 +    adb shell
   6.232  
   6.233  You can remove the library files of your project (and not the SDL lib files) with:
   6.234 -	ndk-build clean
   6.235 +
   6.236 +    ndk-build clean
   6.237  
   6.238  You can do a build with the following command:
   6.239 -	ndk-build
   6.240 +
   6.241 +    ndk-build
   6.242  
   6.243  You can see the complete command line that ndk-build is using by passing V=1 on the command line:
   6.244 -	ndk-build V=1
   6.245 +
   6.246 +    ndk-build V=1
   6.247  
   6.248  If your application crashes in native code, you can use addr2line to convert the
   6.249  addresses in the stack trace to lines in your code.
   6.250  
   6.251  For example, if your crash looks like this:
   6.252 -I/DEBUG   (   31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
   6.253 -I/DEBUG   (   31):  r0 00000000  r1 00001000  r2 00000003  r3 400085d4
   6.254 -I/DEBUG   (   31):  r4 400085d0  r5 40008000  r6 afd41504  r7 436c6a7c
   6.255 -I/DEBUG   (   31):  r8 436c6b30  r9 435c6fb0  10 435c6f9c  fp 4168d82c
   6.256 -I/DEBUG   (   31):  ip 8346aff0  sp 436c6a60  lr afd1c8ff  pc afd1c902  cpsr 60000030
   6.257 -I/DEBUG   (   31):          #00  pc 0001c902  /system/lib/libc.so
   6.258 -I/DEBUG   (   31):          #01  pc 0001ccf6  /system/lib/libc.so
   6.259 -I/DEBUG   (   31):          #02  pc 000014bc  /data/data/org.libsdl.app/lib/libmain.so
   6.260 -I/DEBUG   (   31):          #03  pc 00001506  /data/data/org.libsdl.app/lib/libmain.so
   6.261 +
   6.262 +    I/DEBUG   (   31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
   6.263 +    I/DEBUG   (   31):  r0 00000000  r1 00001000  r2 00000003  r3 400085d4
   6.264 +    I/DEBUG   (   31):  r4 400085d0  r5 40008000  r6 afd41504  r7 436c6a7c
   6.265 +    I/DEBUG   (   31):  r8 436c6b30  r9 435c6fb0  10 435c6f9c  fp 4168d82c
   6.266 +    I/DEBUG   (   31):  ip 8346aff0  sp 436c6a60  lr afd1c8ff  pc afd1c902  cpsr 60000030
   6.267 +    I/DEBUG   (   31):          #00  pc 0001c902  /system/lib/libc.so
   6.268 +    I/DEBUG   (   31):          #01  pc 0001ccf6  /system/lib/libc.so
   6.269 +    I/DEBUG   (   31):          #02  pc 000014bc  /data/data/org.libsdl.app/lib/libmain.so
   6.270 +    I/DEBUG   (   31):          #03  pc 00001506  /data/data/org.libsdl.app/lib/libmain.so
   6.271  
   6.272  You can see that there's a crash in the C library being called from the main code.
   6.273  I run addr2line with the debug version of my code:
   6.274 -	arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
   6.275 +
   6.276 +    arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
   6.277 +
   6.278  and then paste in the number after "pc" in the call stack, from the line that I care about:
   6.279  000014bc
   6.280  
   6.281 @@ -340,13 +358,14 @@
   6.282  
   6.283  You can add logging to your code to help show what's happening:
   6.284  
   6.285 -#include <android/log.h>
   6.286 -
   6.287 -	__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
   6.288 +    #include <android/log.h>
   6.289 +    
   6.290 +    __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
   6.291  
   6.292  If you need to build without optimization turned on, you can create a file called
   6.293  "Application.mk" in the jni directory, with the following line in it:
   6.294 -APP_OPTIM := debug
   6.295 +
   6.296 +    APP_OPTIM := debug
   6.297  
   6.298  
   6.299  ================================================================================
   6.300 @@ -355,7 +374,9 @@
   6.301  
   6.302  The best (and slowest) way to debug memory issues on Android is valgrind.
   6.303  Valgrind has support for Android out of the box, just grab code using:
   6.304 -	svn co svn://svn.valgrind.org/valgrind/trunk valgrind
   6.305 +
   6.306 +    svn co svn://svn.valgrind.org/valgrind/trunk valgrind
   6.307 +
   6.308  ... and follow the instructions in the file README.android to build it.
   6.309  
   6.310  One thing I needed to do on Mac OS X was change the path to the toolchain,
   6.311 @@ -364,20 +385,24 @@
   6.312  
   6.313  Once valgrind is built, you can create a wrapper script to launch your
   6.314  application with it, changing org.libsdl.app to your package identifier:
   6.315 ---- start_valgrind_app -------------------
   6.316 -#!/system/bin/sh
   6.317 -export TMPDIR=/data/data/org.libsdl.app
   6.318 -exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
   6.319 -------------------------------------------
   6.320 +
   6.321 +    --- start_valgrind_app -------------------
   6.322 +    #!/system/bin/sh
   6.323 +    export TMPDIR=/data/data/org.libsdl.app
   6.324 +    exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
   6.325 +    ------------------------------------------
   6.326  
   6.327  Then push it to the device:
   6.328 -	adb push start_valgrind_app /data/local
   6.329 +
   6.330 +    adb push start_valgrind_app /data/local
   6.331  
   6.332  and make it executable:
   6.333 -	adb shell chmod 755 /data/local/start_valgrind_app
   6.334 +
   6.335 +    adb shell chmod 755 /data/local/start_valgrind_app
   6.336  
   6.337  and tell Android to use the script to launch your application:
   6.338 -	adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
   6.339 +
   6.340 +    adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
   6.341  
   6.342  If the setprop command says "could not set property", it's likely that
   6.343  your package name is too long and you should make it shorter by changing
   6.344 @@ -387,10 +412,12 @@
   6.345  You can monitor the startup process with the logcat command above, and
   6.346  when it's done (or even while it's running) you can grab the valgrind
   6.347  output file:
   6.348 -	adb pull /sdcard/valgrind.log
   6.349 +
   6.350 +    adb pull /sdcard/valgrind.log
   6.351  
   6.352  When you're done instrumenting with valgrind, you can disable the wrapper:
   6.353 -	adb shell setprop wrap.org.libsdl.app ""
   6.354 +
   6.355 +    adb shell setprop wrap.org.libsdl.app ""
   6.356  
   6.357  ================================================================================
   6.358   Why is API level 10 the minimum required?
     7.1 --- a/docs/README-cmake.md	Fri Aug 08 15:14:09 2014 -0300
     7.2 +++ b/docs/README-cmake.md	Wed Aug 20 17:20:22 2014 -0300
     7.3 @@ -10,22 +10,23 @@
     7.4  without complication.
     7.5  While still experimental, the build system should be usable on the following
     7.6  platforms:
     7.7 -    
     7.8 -    * FreeBSD
     7.9 -    * Linux
    7.10 -    * VS.NET 2010
    7.11 -    * MinGW and Msys
    7.12 -    * OS X with support for XCode
    7.13 -    
    7.14 +
    7.15 +* FreeBSD
    7.16 +* Linux
    7.17 +* VS.NET 2010
    7.18 +* MinGW and Msys
    7.19 +* OS X with support for XCode
    7.20 +
    7.21 +
    7.22  ================================================================================
    7.23  Usage
    7.24  ================================================================================
    7.25  
    7.26  Assuming the source for SDL is located at ~/sdl
    7.27  
    7.28 -cd ~
    7.29 -mkdir build
    7.30 -cd build
    7.31 -cmake ../sdl
    7.32 +    cd ~
    7.33 +    mkdir build
    7.34 +    cd build
    7.35 +    cmake ../sdl
    7.36  
    7.37  This will build the static and dynamic versions of SDL in the ~/build directory.
     8.1 --- a/docs/README-directfb.md	Fri Aug 08 15:14:09 2014 -0300
     8.2 +++ b/docs/README-directfb.md	Wed Aug 20 17:20:22 2014 -0300
     8.3 @@ -11,9 +11,9 @@
     8.4  
     8.5  What you need:
     8.6  
     8.7 -DirectFB 1.0.1, 1.2.x, 1.3.0
     8.8 -Kernel-Framebuffer support: required: vesafb, radeonfb .... 
     8.9 -Mesa 7.0.x	   - optional for OpenGL
    8.10 +* DirectFB 1.0.1, 1.2.x, 1.3.0
    8.11 +* Kernel-Framebuffer support: required: vesafb, radeonfb .... 
    8.12 +* Mesa 7.0.x	   - optional for OpenGL
    8.13  
    8.14  /etc/directfbrc
    8.15  
     9.1 --- a/docs/README-gesture.md	Fri Aug 08 15:14:09 2014 -0300
     9.2 +++ b/docs/README-gesture.md	Wed Aug 20 17:20:22 2014 -0300
     9.3 @@ -14,18 +14,18 @@
     9.4  Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
     9.5  A SDL_DOLLARRECORD event is a dgesture with the following fields:
     9.6  
     9.7 -event.dgesture.touchId   - the Id of the touch used to record the gesture.
     9.8 -event.dgesture.gestureId - the unique id of the recorded gesture.
     9.9 +* event.dgesture.touchId   - the Id of the touch used to record the gesture.
    9.10 +* event.dgesture.gestureId - the unique id of the recorded gesture.
    9.11  
    9.12  
    9.13  Performing:
    9.14  -----------
    9.15  As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
    9.16  
    9.17 -event.dgesture.touchId    - the Id of the touch which performed the gesture.
    9.18 -event.dgesture.gestureId  - the unique id of the closest gesture to the performed stroke.
    9.19 -event.dgesture.error      - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
    9.20 -event.dgesture.numFingers - the number of fingers used to draw the stroke.
    9.21 +* event.dgesture.touchId    - the Id of the touch which performed the gesture.
    9.22 +* event.dgesture.gestureId  - the unique id of the closest gesture to the performed stroke.
    9.23 +* event.dgesture.error      - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
    9.24 +* event.dgesture.numFingers - the number of fingers used to draw the stroke.
    9.25  
    9.26  Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
    9.27  
    9.28 @@ -54,12 +54,12 @@
    9.29  SDL provides simple support for pinch/rotate/swipe gestures. 
    9.30  Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
    9.31  
    9.32 -event.mgesture.touchId - the Id of the touch on which the gesture was performed.
    9.33 -event.mgesture.x       - the normalized x coordinate of the gesture. (0..1)
    9.34 -event.mgesture.y       - the normalized y coordinate of the gesture. (0..1)
    9.35 -event.mgesture.dTheta  - the amount that the fingers rotated during this motion.
    9.36 -event.mgesture.dDist   - the amount that the fingers pinched during this motion.
    9.37 -event.mgesture.numFingers - the number of fingers used in the gesture.
    9.38 +* event.mgesture.touchId - the Id of the touch on which the gesture was performed.
    9.39 +* event.mgesture.x       - the normalized x coordinate of the gesture. (0..1)
    9.40 +* event.mgesture.y       - the normalized y coordinate of the gesture. (0..1)
    9.41 +* event.mgesture.dTheta  - the amount that the fingers rotated during this motion.
    9.42 +* event.mgesture.dDist   - the amount that the fingers pinched during this motion.
    9.43 +* event.mgesture.numFingers - the number of fingers used in the gesture.
    9.44  
    9.45  
    9.46  ===========================================================================
    10.1 --- a/docs/README-hg.md	Fri Aug 08 15:14:09 2014 -0300
    10.2 +++ b/docs/README-hg.md	Wed Aug 20 17:20:22 2014 -0300
    10.3 @@ -9,7 +9,7 @@
    10.4  information on using hg, where you can also download software for
    10.5  Mac OS X, Windows, and Unix systems.
    10.6  
    10.7 -  hg clone http://hg.libsdl.org/SDL
    10.8 +    hg clone http://hg.libsdl.org/SDL
    10.9  
   10.10  If you are building SDL with an IDE, you will need to copy the file
   10.11  include/SDL_config.h.default to include/SDL_config.h before building.
   10.12 @@ -18,7 +18,6 @@
   10.13  before running configure.
   10.14  
   10.15  There is a web interface to the subversion repository at:
   10.16 -
   10.17  	http://hg.libsdl.org/SDL/
   10.18  
   10.19  There is an RSS feed available at that URL, for those that want to
    11.1 --- a/docs/README-ios.md	Fri Aug 08 15:14:09 2014 -0300
    11.2 +++ b/docs/README-ios.md	Wed Aug 20 17:20:22 2014 -0300
    11.3 @@ -14,11 +14,12 @@
    11.4  There are three build targets:
    11.5  - libSDL.a:
    11.6  	Build SDL as a statically linked library
    11.7 -- testsdl
    11.8 +- testsdl:
    11.9  	Build a test program (there are known test failures which are fine)
   11.10  - Template:
   11.11  	Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers.  The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen.
   11.12  
   11.13 +
   11.14  ==============================================================================
   11.15  Build SDL for iOS from the command line
   11.16  ==============================================================================
   11.17 @@ -47,8 +48,8 @@
   11.18  
   11.19  Here is the easiest method:
   11.20  1.  Build the SDL libraries (libSDL.a and libSDLSimulator.a) and the iPhone SDL Application template.
   11.21 -1.  Install the iPhone SDL Application template by copying it to one of XCode's template directories.  I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there.
   11.22 -2.  Start a new project using the template.  The project should be immediately ready for use with SDL.
   11.23 +2.  Install the iPhone SDL Application template by copying it to one of XCode's template directories.  I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there.
   11.24 +3.  Start a new project using the template.  The project should be immediately ready for use with SDL.
   11.25  
   11.26  Here is a more manual method:
   11.27  1.  Create a new iPhone view based application.
   11.28 @@ -57,6 +58,7 @@
   11.29  4.  Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate.  Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically.
   11.30  5.  Delete the contents of main.m and program your app as a regular SDL program instead.  You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code.
   11.31  
   11.32 +
   11.33  ==============================================================================
   11.34  Notes -- Application events
   11.35  ==============================================================================
   11.36 @@ -68,56 +70,56 @@
   11.37  
   11.38  e.g.
   11.39  
   11.40 -int HandleAppEvents(void *userdata, SDL_Event *event)
   11.41 -{
   11.42 -    switch (event->type)
   11.43 +    int HandleAppEvents(void *userdata, SDL_Event *event)
   11.44      {
   11.45 -    case SDL_APP_TERMINATING:
   11.46 -        /* Terminate the app.
   11.47 -           Shut everything down before returning from this function.
   11.48 -        */
   11.49 +        switch (event->type)
   11.50 +        {
   11.51 +        case SDL_APP_TERMINATING:
   11.52 +            /* Terminate the app.
   11.53 +               Shut everything down before returning from this function.
   11.54 +            */
   11.55 +            return 0;
   11.56 +        case SDL_APP_LOWMEMORY:
   11.57 +            /* You will get this when your app is paused and iOS wants more memory.
   11.58 +               Release as much memory as possible.
   11.59 +            */
   11.60 +            return 0;
   11.61 +        case SDL_APP_WILLENTERBACKGROUND:
   11.62 +            /* Prepare your app to go into the background.  Stop loops, etc.
   11.63 +               This gets called when the user hits the home button, or gets a call.
   11.64 +            */
   11.65 +            return 0;
   11.66 +        case SDL_APP_DIDENTERBACKGROUND:
   11.67 +            /* This will get called if the user accepted whatever sent your app to the background.
   11.68 +               If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
   11.69 +               When you get this, you have 5 seconds to save all your state or the app will be terminated.
   11.70 +               Your app is NOT active at this point.
   11.71 +            */
   11.72 +            return 0;
   11.73 +        case SDL_APP_WILLENTERFOREGROUND:
   11.74 +            /* This call happens when your app is coming back to the foreground.
   11.75 +               Restore all your state here.
   11.76 +            */
   11.77 +            return 0;
   11.78 +        case SDL_APP_DIDENTERFOREGROUND:
   11.79 +            /* Restart your loops here.
   11.80 +               Your app is interactive and getting CPU again.
   11.81 +            */
   11.82 +            return 0;
   11.83 +        default:
   11.84 +            /* No special processing, add it to the event queue */
   11.85 +            return 1;
   11.86 +        }
   11.87 +    }
   11.88 +    
   11.89 +    int main(int argc, char *argv[])
   11.90 +    {
   11.91 +        SDL_SetEventFilter(HandleAppEvents, NULL);
   11.92 +    
   11.93 +        ... run your main loop
   11.94 +    
   11.95          return 0;
   11.96 -    case SDL_APP_LOWMEMORY:
   11.97 -        /* You will get this when your app is paused and iOS wants more memory.
   11.98 -           Release as much memory as possible.
   11.99 -        */
  11.100 -        return 0;
  11.101 -    case SDL_APP_WILLENTERBACKGROUND:
  11.102 -        /* Prepare your app to go into the background.  Stop loops, etc.
  11.103 -           This gets called when the user hits the home button, or gets a call.
  11.104 -        */
  11.105 -        return 0;
  11.106 -    case SDL_APP_DIDENTERBACKGROUND:
  11.107 -        /* This will get called if the user accepted whatever sent your app to the background.
  11.108 -           If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
  11.109 -           When you get this, you have 5 seconds to save all your state or the app will be terminated.
  11.110 -           Your app is NOT active at this point.
  11.111 -        */
  11.112 -        return 0;
  11.113 -    case SDL_APP_WILLENTERFOREGROUND:
  11.114 -        /* This call happens when your app is coming back to the foreground.
  11.115 -           Restore all your state here.
  11.116 -        */
  11.117 -        return 0;
  11.118 -    case SDL_APP_DIDENTERFOREGROUND:
  11.119 -        /* Restart your loops here.
  11.120 -           Your app is interactive and getting CPU again.
  11.121 -        */
  11.122 -        return 0;
  11.123 -    default:
  11.124 -        /* No special processing, add it to the event queue */
  11.125 -        return 1;
  11.126      }
  11.127 -}
  11.128 -
  11.129 -int main(int argc, char *argv[])
  11.130 -{
  11.131 -    SDL_SetEventFilter(HandleAppEvents, NULL);
  11.132 -
  11.133 -    ... run your main loop
  11.134 -
  11.135 -    return 0;
  11.136 -}
  11.137  
  11.138      
  11.139  ==============================================================================
  11.140 @@ -148,11 +150,14 @@
  11.141  
  11.142  void SDL_StartTextInput()
  11.143  	-- enables text events and reveals the onscreen keyboard.
  11.144 +
  11.145  void SDL_StopTextInput()
  11.146  	-- disables text events and hides the onscreen keyboard.
  11.147 +
  11.148  SDL_bool SDL_IsTextInputActive()
  11.149  	-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
  11.150  
  11.151 +
  11.152  ==============================================================================
  11.153  Notes -- Reading and Writing files
  11.154  ==============================================================================
  11.155 @@ -161,12 +166,12 @@
  11.156  
  11.157  Once your application is installed its directory tree looks like:
  11.158  
  11.159 -MySDLApp Home/
  11.160 -	MySDLApp.app
  11.161 -	Documents/
  11.162 -	Library/
  11.163 -		Preferences/
  11.164 -	tmp/
  11.165 +    MySDLApp Home/
  11.166 +        MySDLApp.app
  11.167 +        Documents/
  11.168 +        Library/
  11.169 +            Preferences/
  11.170 +        tmp/
  11.171  
  11.172  When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored.  You cannot write to this directory.  Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".  
  11.173  
  11.174 @@ -191,35 +196,35 @@
  11.175  ==============================================================================
  11.176  
  11.177  Game Center integration requires that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
  11.178 -    
  11.179 -int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
  11.180 +
  11.181 +    int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
  11.182  
  11.183  This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
  11.184  
  11.185  e.g.
  11.186  
  11.187 -extern "C"
  11.188 -void ShowFrame(void*)
  11.189 -{
  11.190 -    ... do event handling, frame logic and rendering
  11.191 -}
  11.192 -
  11.193 -int main(int argc, char *argv[])
  11.194 -{
  11.195 -   ... initialize game ...
  11.196 -
  11.197 -#if __IPHONEOS__
  11.198 +    extern "C"
  11.199 +    void ShowFrame(void*)
  11.200 +    {
  11.201 +        ... do event handling, frame logic and rendering ...
  11.202 +    }
  11.203 +    
  11.204 +    int main(int argc, char *argv[])
  11.205 +    {
  11.206 +        ... initialize game ...
  11.207 +    
  11.208 +    #if __IPHONEOS__
  11.209          // Initialize the Game Center for scoring and matchmaking
  11.210          InitGameCenter();
  11.211 -
  11.212 +    
  11.213          // Set up the game to run in the window animation callback on iOS
  11.214          // so that Game Center and so forth works correctly.
  11.215          SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
  11.216 -#else
  11.217 +    #else
  11.218          while ( running ) {
  11.219 -                ShowFrame(0);
  11.220 -                DelayFrame();
  11.221 +            ShowFrame(0);
  11.222 +            DelayFrame();
  11.223          }
  11.224 -#endif
  11.225 +    #endif
  11.226          return 0;
  11.227 -}
  11.228 +    }
    12.1 --- a/docs/README-macosx.md	Fri Aug 08 15:14:09 2014 -0300
    12.2 +++ b/docs/README-macosx.md	Wed Aug 20 17:20:22 2014 -0300
    12.3 @@ -45,28 +45,29 @@
    12.4    file with the app. To solve these issues, put the following code in your 
    12.5    NSApplicationDelegate implementation:
    12.6  
    12.7 -  - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
    12.8 -  {
    12.9 -      if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
   12.10 -          SDL_Event event;
   12.11 -          event.type = SDL_QUIT;
   12.12 -          SDL_PushEvent(&event);
   12.13 -      }
   12.14  
   12.15 -      return NSTerminateCancel;
   12.16 -  }
   12.17 -
   12.18 -  - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   12.19 -  {
   12.20 -      if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
   12.21 -          SDL_Event event;
   12.22 -          event.type = SDL_DROPFILE;
   12.23 -          event.drop.file = SDL_strdup([filename UTF8String]);
   12.24 -          return (SDL_PushEvent(&event) > 0);
   12.25 -      }
   12.26 -
   12.27 -      return NO;
   12.28 -  }
   12.29 +    - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
   12.30 +    {
   12.31 +        if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
   12.32 +            SDL_Event event;
   12.33 +            event.type = SDL_QUIT;
   12.34 +            SDL_PushEvent(&event);
   12.35 +        }
   12.36 +    
   12.37 +        return NSTerminateCancel;
   12.38 +    }
   12.39 +    
   12.40 +    - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   12.41 +    {
   12.42 +        if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
   12.43 +            SDL_Event event;
   12.44 +            event.type = SDL_DROPFILE;
   12.45 +            event.drop.file = SDL_strdup([filename UTF8String]);
   12.46 +            return (SDL_PushEvent(&event) > 0);
   12.47 +        }
   12.48 +    
   12.49 +        return NO;
   12.50 +    }
   12.51  
   12.52  ==============================================================================
   12.53  Using the Simple DirectMedia Layer with a traditional Makefile
    13.1 --- a/docs/README-nacl.md	Fri Aug 08 15:14:09 2014 -0300
    13.2 +++ b/docs/README-nacl.md	Wed Aug 20 17:20:22 2014 -0300
    13.3 @@ -2,9 +2,9 @@
    13.4  ================================================================================
    13.5  
    13.6  Requirements: 
    13.7 -    
    13.8 -    * Native Client SDK (https://developer.chrome.com/native-client), 
    13.9 -      (tested with Pepper version 33 or higher).
   13.10 +
   13.11 +* Native Client SDK (https://developer.chrome.com/native-client), 
   13.12 +  (tested with Pepper version 33 or higher).
   13.13  
   13.14  The SDL backend for Chrome's Native Client has been tested only with the PNaCl
   13.15  toolchain, which generates binaries designed to run on ARM and x86_32/64 
   13.16 @@ -91,9 +91,9 @@
   13.17  
   13.18  And add to manifest.json :
   13.19  
   13.20 -  "permissions": [
   13.21 -     "unlimitedStorage"
   13.22 -  ]
   13.23 +    "permissions": [
   13.24 +        "unlimitedStorage"
   13.25 +    ]
   13.26  
   13.27  ================================================================================
   13.28  TODO - Known Issues
    14.1 --- a/docs/README-platforms.md	Fri Aug 08 15:14:09 2014 -0300
    14.2 +++ b/docs/README-platforms.md	Wed Aug 20 17:20:22 2014 -0300
    14.3 @@ -8,27 +8,27 @@
    14.4  ==============================
    14.5  (code compiles, and thoroughly tested for release)
    14.6  ==============================
    14.7 -Windows XP/Vista/7/8
    14.8 -Mac OS X 10.5+
    14.9 -Linux 2.6+
   14.10 -iOS 5.1.1+
   14.11 -Android 2.3.3+
   14.12 +* Windows XP/Vista/7/8
   14.13 +* Mac OS X 10.5+
   14.14 +* Linux 2.6+
   14.15 +* iOS 5.1.1+
   14.16 +* Android 2.3.3+
   14.17  
   14.18  Unofficially supported platforms
   14.19  ================================
   14.20  (code compiles, but not thoroughly tested)
   14.21  ================================
   14.22 -FreeBSD
   14.23 -NetBSD
   14.24 -OpenBSD
   14.25 -Solaris
   14.26 +* FreeBSD
   14.27 +* NetBSD
   14.28 +* OpenBSD
   14.29 +* Solaris
   14.30  
   14.31  Platforms supported by volunteers
   14.32  =================================
   14.33 -Haiku - maintained by Axel Dörfler <axeld@pinc-software.de>
   14.34 -PSP - maintained by 527721088@qq.com
   14.35 -Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
   14.36 -NaCl - maintained by Gabriel Jacobo <gabomdq@gmail.com>
   14.37 +* Haiku - maintained by Axel Dörfler <axeld@pinc-software.de>
   14.38 +* PSP - maintained by 527721088@qq.com
   14.39 +* Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
   14.40 +* NaCl - maintained by Gabriel Jacobo <gabomdq@gmail.com>
   14.41  
   14.42  Platforms that need maintainers
   14.43  ===============================
    15.1 --- a/docs/README-raspberrypi.md	Fri Aug 08 15:14:09 2014 -0300
    15.2 +++ b/docs/README-raspberrypi.md	Wed Aug 20 17:20:22 2014 -0300
    15.3 @@ -15,6 +15,7 @@
    15.4  * Input (mouse/keyboard/joystick) via EVDEV
    15.5  * Hotplugging of input devices via UDEV
    15.6  
    15.7 +
    15.8  ================================================================================
    15.9   Raspbian Build Dependencies
   15.10  ================================================================================
    16.1 --- a/docs/README-touch.md	Fri Aug 08 15:14:09 2014 -0300
    16.2 +++ b/docs/README-touch.md	Wed Aug 20 17:20:22 2014 -0300
    16.3 @@ -20,18 +20,18 @@
    16.4  SDL_FINGERDOWN:
    16.5  Sent when a finger (or stylus) is placed on a touch device.
    16.6  Fields:
    16.7 -event.tfinger.touchId  - the Id of the touch device.
    16.8 -event.tfinger.fingerId - the Id of the finger which just went down.
    16.9 -event.tfinger.x        - the x coordinate of the touch (0..1)
   16.10 -event.tfinger.y        - the y coordinate of the touch (0..1)
   16.11 -event.tfinger.pressure - the pressure of the touch (0..1)
   16.12 +* event.tfinger.touchId  - the Id of the touch device.
   16.13 +* event.tfinger.fingerId - the Id of the finger which just went down.
   16.14 +* event.tfinger.x        - the x coordinate of the touch (0..1)
   16.15 +* event.tfinger.y        - the y coordinate of the touch (0..1)
   16.16 +* event.tfinger.pressure - the pressure of the touch (0..1)
   16.17  
   16.18  SDL_FINGERMOTION:
   16.19  Sent when a finger (or stylus) is moved on the touch device.
   16.20  Fields:
   16.21  Same as SDL_FINGERDOWN but with additional:
   16.22 -event.tfinger.dx       - change in x coordinate during this motion event.
   16.23 -event.tfinger.dy       - change in y coordinate during this motion event.
   16.24 +* event.tfinger.dx       - change in x coordinate during this motion event.
   16.25 +* event.tfinger.dy       - change in y coordinate during this motion event.
   16.26  
   16.27  SDL_FINGERUP:
   16.28  Sent when a finger (or stylus) is lifted from the touch device.
   16.29 @@ -70,11 +70,12 @@
   16.30  As a result, be very careful to check for NULL return values.
   16.31  
   16.32  A SDL_Finger has the following fields:
   16.33 ->x,y,pressure:
   16.34 +* x,y,pressure:
   16.35  	The current coordinates of the touch.
   16.36 ->pressure:
   16.37 +* pressure:
   16.38  	The pressure of the touch.
   16.39  
   16.40 +
   16.41  ===========================================================================
   16.42  Notes
   16.43  ===========================================================================
    17.1 --- a/docs/README.md	Fri Aug 08 15:14:09 2014 -0300
    17.2 +++ b/docs/README.md	Wed Aug 20 17:20:22 2014 -0300
    17.3 @@ -12,7 +12,7 @@
    17.4  to provide low level access to audio, keyboard, mouse, joystick, and graphics
    17.5  hardware via OpenGL and Direct3D. It is used by video playback software,
    17.6  emulators, and popular games including Valve's award winning catalog
    17.7 -and many Humble Bundle games. 42
    17.8 +and many Humble Bundle games.
    17.9  
   17.10  SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
   17.11  Support for other platforms may be found in the source code.
    18.1 --- a/docs/doxyfile	Fri Aug 08 15:14:09 2014 -0300
    18.2 +++ b/docs/doxyfile	Wed Aug 20 17:20:22 2014 -0300
    18.3 @@ -1510,7 +1510,7 @@
    18.4  # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
    18.5  # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
    18.6  
    18.7 -DOT_GRAPH_MAX_NODES    = 50
    18.8 +DOT_GRAPH_MAX_NODES    = 60
    18.9  
   18.10  # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
   18.11  # graphs generated by dot. A depth value of 3 means that only nodes reachable 
    19.1 --- a/include/SDL_config.h.cmake	Fri Aug 08 15:14:09 2014 -0300
    19.2 +++ b/include/SDL_config.h.cmake	Wed Aug 20 17:20:22 2014 -0300
    19.3 @@ -263,6 +263,7 @@
    19.4  #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
    19.5  #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
    19.6  #cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
    19.7 +#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
    19.8  
    19.9  #if 0
   19.10  /* !!! FIXME: in configure script version, missing here: */
    20.1 --- a/include/SDL_config_android.h	Fri Aug 08 15:14:09 2014 -0300
    20.2 +++ b/include/SDL_config_android.h	Wed Aug 20 17:20:22 2014 -0300
    20.3 @@ -141,7 +141,7 @@
    20.4  /* Enable system power support */
    20.5  #define SDL_POWER_ANDROID 1
    20.6  
    20.7 -/* !!! FIXME: what does Android do for filesystem stuff? */
    20.8 -#define SDL_FILESYSTEM_DUMMY   1
    20.9 +/* Enable the filesystem driver */
   20.10 +#define SDL_FILESYSTEM_ANDROID   1
   20.11  
   20.12  #endif /* _SDL_config_android_h */
    21.1 --- a/include/SDL_egl.h	Fri Aug 08 15:14:09 2014 -0300
    21.2 +++ b/include/SDL_egl.h	Wed Aug 20 17:20:22 2014 -0300
    21.3 @@ -20,9 +20,9 @@
    21.4  */
    21.5  
    21.6  /**
    21.7 - *  \file SDL_opengles.h
    21.8 + *  \file SDL_egl.h
    21.9   *
   21.10 - *  This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
   21.11 + *  This is a simple file to encapsulate the EGL API headers.
   21.12   */
   21.13  #ifndef _MSC_VER
   21.14  
    22.1 --- a/include/SDL_events.h	Fri Aug 08 15:14:09 2014 -0300
    22.2 +++ b/include/SDL_events.h	Wed Aug 20 17:20:22 2014 -0300
    22.3 @@ -59,7 +59,7 @@
    22.4      /* Application events */
    22.5      SDL_QUIT           = 0x100, /**< User-requested quit */
    22.6  
    22.7 -    /* These application events have special meaning on iOS, see README-ios.txt for details */
    22.8 +    /* These application events have special meaning on iOS, see README-ios.md for details */
    22.9      SDL_APP_TERMINATING,        /**< The application is being terminated by the OS
   22.10                                       Called on iOS in applicationWillTerminate()
   22.11                                       Called on Android in onDestroy()
    23.1 --- a/include/SDL_haptic.h	Fri Aug 08 15:14:09 2014 -0300
    23.2 +++ b/include/SDL_haptic.h	Wed Aug 20 17:20:22 2014 -0300
    23.3 @@ -370,7 +370,7 @@
    23.4                           ^
    23.5                           |
    23.6                           |
    23.7 -    (1,0)  West <----[ HAPTIC ]----> East (-1,0)
    23.8 +   (-1,0)  West <----[ HAPTIC ]----> East (1,0)
    23.9                           |
   23.10                           |
   23.11                           v
   23.12 @@ -395,9 +395,9 @@
   23.13   *  (X axis, Y axis and Z axis (with 3 axes)).  ::SDL_HAPTIC_CARTESIAN uses
   23.14   *  the first three \c dir parameters.  The cardinal directions would be:
   23.15   *   - North:  0,-1, 0
   23.16 - *   - East:  -1, 0, 0
   23.17 + *   - East:   1, 0, 0
   23.18   *   - South:  0, 1, 0
   23.19 - *   - West:   1, 0, 0
   23.20 + *   - West:  -1, 0, 0
   23.21   *
   23.22   *  The Z axis represents the height of the effect if supported, otherwise
   23.23   *  it's unused.  In cartesian encoding (1, 2) would be the same as (2, 4), you
   23.24 @@ -604,11 +604,11 @@
   23.25      Uint16 interval;        /**< How soon it can be triggered again after button. */
   23.26  
   23.27      /* Condition */
   23.28 -    Uint16 right_sat[3];    /**< Level when joystick is to the positive side. */
   23.29 -    Uint16 left_sat[3];     /**< Level when joystick is to the negative side. */
   23.30 +    Uint16 right_sat[3];    /**< Level when joystick is to the positive side; max 0xFFFF. */
   23.31 +    Uint16 left_sat[3];     /**< Level when joystick is to the negative side; max 0xFFFF. */
   23.32      Sint16 right_coeff[3];  /**< How fast to increase the force towards the positive side. */
   23.33      Sint16 left_coeff[3];   /**< How fast to increase the force towards the negative side. */
   23.34 -    Uint16 deadband[3];     /**< Size of the dead zone. */
   23.35 +    Uint16 deadband[3];     /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
   23.36      Sint16 center[3];       /**< Position of the dead zone. */
   23.37  } SDL_HapticCondition;
   23.38  
    24.1 --- a/include/SDL_hints.h	Fri Aug 08 15:14:09 2014 -0300
    24.2 +++ b/include/SDL_hints.h	Wed Aug 20 17:20:22 2014 -0300
    24.3 @@ -478,6 +478,18 @@
    24.4   */
    24.5  #define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
    24.6  
    24.7 +/**
    24.8 + * \brief A variable to control whether certain IMs should handle text editing internally instead of sending TEXTEDITING events.
    24.9 + *
   24.10 + *
   24.11 + * The variable can be set to the following values:
   24.12 + *   "0"       - TEXTEDITING events are sent, and it is the application's
   24.13 + *               responsibility to render the text from these events and 
   24.14 + *               differentiate it somehow from committed text. (default)
   24.15 + *   "1"       - If supported by the IM then TEXTEDITING events are not sent, 
   24.16 + *               and text that is being composed will be rendered in its own UI.
   24.17 + */
   24.18 +#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
   24.19  
   24.20  /**
   24.21   *  \brief  An enumeration of hint priorities
    25.1 --- a/include/SDL_opengl.h	Fri Aug 08 15:14:09 2014 -0300
    25.2 +++ b/include/SDL_opengl.h	Wed Aug 20 17:20:22 2014 -0300
    25.3 @@ -25,50 +25,6 @@
    25.4   *  This is a simple file to encapsulate the OpenGL API headers.
    25.5   */
    25.6  
    25.7 -#ifndef _SDL_opengl_h
    25.8 -#define _SDL_opengl_h
    25.9 -
   25.10 -#include "SDL_config.h"
   25.11 -
   25.12 -#ifndef __IPHONEOS__
   25.13 -
   25.14 -#ifdef __WIN32__
   25.15 -#ifndef WIN32_LEAN_AND_MEAN
   25.16 -#define WIN32_LEAN_AND_MEAN
   25.17 -#endif
   25.18 -#ifndef NOMINMAX
   25.19 -#define NOMINMAX                /* Don't defined min() and max() */
   25.20 -#endif
   25.21 -#include <windows.h>
   25.22 -#endif
   25.23 -
   25.24 -#ifdef __glext_h_
   25.25 -/* Someone has already included glext.h */
   25.26 -#define NO_SDL_GLEXT
   25.27 -#else
   25.28 -#define _SDL_CLEAR_GLEXT_HEADERGUARD
   25.29 -#define __glext_h_              /* Don't let gl.h include glext.h */
   25.30 -#endif
   25.31 -#if defined(__MACOSX__)
   25.32 -#include <OpenGL/gl.h>          /* Header File For The OpenGL Library */
   25.33 -#define __X_GL_H
   25.34 -#else
   25.35 -#include <GL/gl.h>              /* Header File For The OpenGL Library */
   25.36 -#endif
   25.37 -#ifdef _SDL_CLEAR_GLEXT_HEADERGUARD
   25.38 -#undef __glext_h_
   25.39 -#endif
   25.40 -
   25.41 -/**
   25.42 - *  \file SDL_opengl.h
   25.43 - *
   25.44 - *  This file is included because glext.h is not available on some systems.
   25.45 - *  If you don't want this version included, simply define ::NO_SDL_GLEXT.
   25.46 - *
   25.47 - *  The latest version is available from:
   25.48 - *      http://www.opengl.org/registry/
   25.49 - */
   25.50 -
   25.51  /**
   25.52   *  \def NO_SDL_GLEXT
   25.53   *
   25.54 @@ -76,9 +32,2142 @@
   25.55   *  version included in SDL_opengl.h.
   25.56   */
   25.57  
   25.58 +#ifndef _SDL_opengl_h
   25.59 +#define _SDL_opengl_h
   25.60 +
   25.61 +#include "SDL_config.h"
   25.62 +
   25.63 +#ifndef __IPHONEOS__  /* No OpenGL on iOS. */
   25.64 +
   25.65 +/*
   25.66 + * Mesa 3-D graphics library
   25.67 + *
   25.68 + * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
   25.69 + * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
   25.70 + *
   25.71 + * Permission is hereby granted, free of charge, to any person obtaining a
   25.72 + * copy of this software and associated documentation files (the "Software"),
   25.73 + * to deal in the Software without restriction, including without limitation
   25.74 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   25.75 + * and/or sell copies of the Software, and to permit persons to whom the
   25.76 + * Software is furnished to do so, subject to the following conditions:
   25.77 + *
   25.78 + * The above copyright notice and this permission notice shall be included
   25.79 + * in all copies or substantial portions of the Software.
   25.80 + *
   25.81 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   25.82 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   25.83 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   25.84 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   25.85 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   25.86 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   25.87 + * OTHER DEALINGS IN THE SOFTWARE.
   25.88 + */
   25.89 +
   25.90 +
   25.91 +#ifndef __gl_h_
   25.92 +#define __gl_h_
   25.93 +
   25.94 +#if defined(USE_MGL_NAMESPACE)
   25.95 +#include "gl_mangle.h"
   25.96 +#endif
   25.97 +
   25.98 +
   25.99 +/**********************************************************************
  25.100 + * Begin system-specific stuff.
  25.101 + */
  25.102 +
  25.103 +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
  25.104 +#define __WIN32__
  25.105 +#endif
  25.106 +
  25.107 +#if defined(__WIN32__) && !defined(__CYGWIN__)
  25.108 +#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
  25.109 +#    define GLAPI __declspec(dllexport)
  25.110 +#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
  25.111 +#    define GLAPI __declspec(dllimport)
  25.112 +#  else /* for use with static link lib build of Win32 edition only */
  25.113 +#    define GLAPI extern
  25.114 +#  endif /* _STATIC_MESA support */
  25.115 +#  if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE)  /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
  25.116 +#    define GLAPIENTRY 
  25.117 +#  else
  25.118 +#    define GLAPIENTRY __stdcall
  25.119 +#  endif
  25.120 +#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
  25.121 +#  define GLAPI extern
  25.122 +#  define GLAPIENTRY __stdcall
  25.123 +#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
  25.124 +#  define GLAPI __attribute__((visibility("default")))
  25.125 +#  define GLAPIENTRY
  25.126 +#endif /* WIN32 && !CYGWIN */
  25.127 +
  25.128 +/*
  25.129 + * WINDOWS: Include windows.h here to define APIENTRY.
  25.130 + * It is also useful when applications include this file by
  25.131 + * including only glut.h, since glut.h depends on windows.h.
  25.132 + * Applications needing to include windows.h with parms other
  25.133 + * than "WIN32_LEAN_AND_MEAN" may include windows.h before
  25.134 + * glut.h or gl.h.
  25.135 + */
  25.136 +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
  25.137 +#ifndef WIN32_LEAN_AND_MEAN
  25.138 +#define WIN32_LEAN_AND_MEAN 1
  25.139 +#endif
  25.140 +#ifndef NOMINMAX   /* don't define min() and max(). */
  25.141 +#define NOMINMAX
  25.142 +#endif
  25.143 +#include <windows.h>
  25.144 +#endif
  25.145 +
  25.146 +#ifndef GLAPI
  25.147 +#define GLAPI extern
  25.148 +#endif
  25.149 +
  25.150 +#ifndef GLAPIENTRY
  25.151 +#define GLAPIENTRY
  25.152 +#endif
  25.153 +
  25.154 +#ifndef APIENTRY
  25.155 +#define APIENTRY GLAPIENTRY
  25.156 +#endif
  25.157 +
  25.158 +/* "P" suffix to be used for a pointer to a function */
  25.159 +#ifndef APIENTRYP
  25.160 +#define APIENTRYP APIENTRY *
  25.161 +#endif
  25.162 +
  25.163 +#ifndef GLAPIENTRYP
  25.164 +#define GLAPIENTRYP GLAPIENTRY *
  25.165 +#endif
  25.166 +
  25.167 +#if defined(PRAGMA_EXPORT_SUPPORTED)
  25.168 +#pragma export on
  25.169 +#endif
  25.170 +
  25.171 +/*
  25.172 + * End system-specific stuff.
  25.173 + **********************************************************************/
  25.174 +
  25.175 +
  25.176 +
  25.177 +#ifdef __cplusplus
  25.178 +extern "C" {
  25.179 +#endif
  25.180 +
  25.181 +
  25.182 +
  25.183 +#define GL_VERSION_1_1   1
  25.184 +#define GL_VERSION_1_2   1
  25.185 +#define GL_VERSION_1_3   1
  25.186 +#define GL_ARB_imaging   1
  25.187 +
  25.188 +
  25.189 +/*
  25.190 + * Datatypes
  25.191 + */
  25.192 +typedef unsigned int	GLenum;
  25.193 +typedef unsigned char	GLboolean;
  25.194 +typedef unsigned int	GLbitfield;
  25.195 +typedef void		GLvoid;
  25.196 +typedef signed char	GLbyte;		/* 1-byte signed */
  25.197 +typedef short		GLshort;	/* 2-byte signed */
  25.198 +typedef int		GLint;		/* 4-byte signed */
  25.199 +typedef unsigned char	GLubyte;	/* 1-byte unsigned */
  25.200 +typedef unsigned short	GLushort;	/* 2-byte unsigned */
  25.201 +typedef unsigned int	GLuint;		/* 4-byte unsigned */
  25.202 +typedef int		GLsizei;	/* 4-byte signed */
  25.203 +typedef float		GLfloat;	/* single precision float */
  25.204 +typedef float		GLclampf;	/* single precision float in [0,1] */
  25.205 +typedef double		GLdouble;	/* double precision float */
  25.206 +typedef double		GLclampd;	/* double precision float in [0,1] */
  25.207 +
  25.208 +
  25.209 +
  25.210 +/*
  25.211 + * Constants
  25.212 + */
  25.213 +
  25.214 +/* Boolean values */
  25.215 +#define GL_FALSE				0
  25.216 +#define GL_TRUE					1
  25.217 +
  25.218 +/* Data types */
  25.219 +#define GL_BYTE					0x1400
  25.220 +#define GL_UNSIGNED_BYTE			0x1401
  25.221 +#define GL_SHORT				0x1402
  25.222 +#define GL_UNSIGNED_SHORT			0x1403
  25.223 +#define GL_INT					0x1404
  25.224 +#define GL_UNSIGNED_INT				0x1405
  25.225 +#define GL_FLOAT				0x1406
  25.226 +#define GL_2_BYTES				0x1407
  25.227 +#define GL_3_BYTES				0x1408
  25.228 +#define GL_4_BYTES				0x1409
  25.229 +#define GL_DOUBLE				0x140A
  25.230 +
  25.231 +/* Primitives */
  25.232 +#define GL_POINTS				0x0000
  25.233 +#define GL_LINES				0x0001
  25.234 +#define GL_LINE_LOOP				0x0002
  25.235 +#define GL_LINE_STRIP				0x0003
  25.236 +#define GL_TRIANGLES				0x0004
  25.237 +#define GL_TRIANGLE_STRIP			0x0005
  25.238 +#define GL_TRIANGLE_FAN				0x0006
  25.239 +#define GL_QUADS				0x0007
  25.240 +#define GL_QUAD_STRIP				0x0008
  25.241 +#define GL_POLYGON				0x0009
  25.242 +
  25.243 +/* Vertex Arrays */
  25.244 +#define GL_VERTEX_ARRAY				0x8074
  25.245 +#define GL_NORMAL_ARRAY				0x8075
  25.246 +#define GL_COLOR_ARRAY				0x8076
  25.247 +#define GL_INDEX_ARRAY				0x8077
  25.248 +#define GL_TEXTURE_COORD_ARRAY			0x8078
  25.249 +#define GL_EDGE_FLAG_ARRAY			0x8079
  25.250 +#define GL_VERTEX_ARRAY_SIZE			0x807A
  25.251 +#define GL_VERTEX_ARRAY_TYPE			0x807B
  25.252 +#define GL_VERTEX_ARRAY_STRIDE			0x807C
  25.253 +#define GL_NORMAL_ARRAY_TYPE			0x807E
  25.254 +#define GL_NORMAL_ARRAY_STRIDE			0x807F
  25.255 +#define GL_COLOR_ARRAY_SIZE			0x8081
  25.256 +#define GL_COLOR_ARRAY_TYPE			0x8082
  25.257 +#define GL_COLOR_ARRAY_STRIDE			0x8083
  25.258 +#define GL_INDEX_ARRAY_TYPE			0x8085
  25.259 +#define GL_INDEX_ARRAY_STRIDE			0x8086
  25.260 +#define GL_TEXTURE_COORD_ARRAY_SIZE		0x8088
  25.261 +#define GL_TEXTURE_COORD_ARRAY_TYPE		0x8089
  25.262 +#define GL_TEXTURE_COORD_ARRAY_STRIDE		0x808A
  25.263 +#define GL_EDGE_FLAG_ARRAY_STRIDE		0x808C
  25.264 +#define GL_VERTEX_ARRAY_POINTER			0x808E
  25.265 +#define GL_NORMAL_ARRAY_POINTER			0x808F
  25.266 +#define GL_COLOR_ARRAY_POINTER			0x8090
  25.267 +#define GL_INDEX_ARRAY_POINTER			0x8091
  25.268 +#define GL_TEXTURE_COORD_ARRAY_POINTER		0x8092
  25.269 +#define GL_EDGE_FLAG_ARRAY_POINTER		0x8093
  25.270 +#define GL_V2F					0x2A20
  25.271 +#define GL_V3F					0x2A21
  25.272 +#define GL_C4UB_V2F				0x2A22
  25.273 +#define GL_C4UB_V3F				0x2A23
  25.274 +#define GL_C3F_V3F				0x2A24
  25.275 +#define GL_N3F_V3F				0x2A25
  25.276 +#define GL_C4F_N3F_V3F				0x2A26
  25.277 +#define GL_T2F_V3F				0x2A27
  25.278 +#define GL_T4F_V4F				0x2A28
  25.279 +#define GL_T2F_C4UB_V3F				0x2A29
  25.280 +#define GL_T2F_C3F_V3F				0x2A2A
  25.281 +#define GL_T2F_N3F_V3F				0x2A2B
  25.282 +#define GL_T2F_C4F_N3F_V3F			0x2A2C
  25.283 +#define GL_T4F_C4F_N3F_V4F			0x2A2D
  25.284 +
  25.285 +/* Matrix Mode */
  25.286 +#define GL_MATRIX_MODE				0x0BA0
  25.287 +#define GL_MODELVIEW				0x1700
  25.288 +#define GL_PROJECTION				0x1701
  25.289 +#define GL_TEXTURE				0x1702
  25.290 +
  25.291 +/* Points */
  25.292 +#define GL_POINT_SMOOTH				0x0B10
  25.293 +#define GL_POINT_SIZE				0x0B11
  25.294 +#define GL_POINT_SIZE_GRANULARITY 		0x0B13
  25.295 +#define GL_POINT_SIZE_RANGE			0x0B12
  25.296 +
  25.297 +/* Lines */
  25.298 +#define GL_LINE_SMOOTH				0x0B20
  25.299 +#define GL_LINE_STIPPLE				0x0B24
  25.300 +#define GL_LINE_STIPPLE_PATTERN			0x0B25
  25.301 +#define GL_LINE_STIPPLE_REPEAT			0x0B26
  25.302 +#define GL_LINE_WIDTH				0x0B21
  25.303 +#define GL_LINE_WIDTH_GRANULARITY		0x0B23
  25.304 +#define GL_LINE_WIDTH_RANGE			0x0B22
  25.305 +
  25.306 +/* Polygons */
  25.307 +#define GL_POINT				0x1B00
  25.308 +#define GL_LINE					0x1B01
  25.309 +#define GL_FILL					0x1B02
  25.310 +#define GL_CW					0x0900
  25.311 +#define GL_CCW					0x0901
  25.312 +#define GL_FRONT				0x0404
  25.313 +#define GL_BACK					0x0405
  25.314 +#define GL_POLYGON_MODE				0x0B40
  25.315 +#define GL_POLYGON_SMOOTH			0x0B41
  25.316 +#define GL_POLYGON_STIPPLE			0x0B42
  25.317 +#define GL_EDGE_FLAG				0x0B43
  25.318 +#define GL_CULL_FACE				0x0B44
  25.319 +#define GL_CULL_FACE_MODE			0x0B45
  25.320 +#define GL_FRONT_FACE				0x0B46
  25.321 +#define GL_POLYGON_OFFSET_FACTOR		0x8038
  25.322 +#define GL_POLYGON_OFFSET_UNITS			0x2A00
  25.323 +#define GL_POLYGON_OFFSET_POINT			0x2A01
  25.324 +#define GL_POLYGON_OFFSET_LINE			0x2A02
  25.325 +#define GL_POLYGON_OFFSET_FILL			0x8037
  25.326 +
  25.327 +/* Display Lists */
  25.328 +#define GL_COMPILE				0x1300
  25.329 +#define GL_COMPILE_AND_EXECUTE			0x1301
  25.330 +#define GL_LIST_BASE				0x0B32
  25.331 +#define GL_LIST_INDEX				0x0B33
  25.332 +#define GL_LIST_MODE				0x0B30
  25.333 +
  25.334 +/* Depth buffer */
  25.335 +#define GL_NEVER				0x0200
  25.336 +#define GL_LESS					0x0201
  25.337 +#define GL_EQUAL				0x0202
  25.338 +#define GL_LEQUAL				0x0203
  25.339 +#define GL_GREATER				0x0204
  25.340 +#define GL_NOTEQUAL				0x0205
  25.341 +#define GL_GEQUAL				0x0206
  25.342 +#define GL_ALWAYS				0x0207
  25.343 +#define GL_DEPTH_TEST				0x0B71
  25.344 +#define GL_DEPTH_BITS				0x0D56
  25.345 +#define GL_DEPTH_CLEAR_VALUE			0x0B73
  25.346 +#define GL_DEPTH_FUNC				0x0B74
  25.347 +#define GL_DEPTH_RANGE				0x0B70
  25.348 +#define GL_DEPTH_WRITEMASK			0x0B72
  25.349 +#define GL_DEPTH_COMPONENT			0x1902
  25.350 +
  25.351 +/* Lighting */
  25.352 +#define GL_LIGHTING				0x0B50
  25.353 +#define GL_LIGHT0				0x4000
  25.354 +#define GL_LIGHT1				0x4001
  25.355 +#define GL_LIGHT2				0x4002
  25.356 +#define GL_LIGHT3				0x4003
  25.357 +#define GL_LIGHT4				0x4004
  25.358 +#define GL_LIGHT5				0x4005
  25.359 +#define GL_LIGHT6				0x4006
  25.360 +#define GL_LIGHT7				0x4007
  25.361 +#define GL_SPOT_EXPONENT			0x1205
  25.362 +#define GL_SPOT_CUTOFF				0x1206
  25.363 +#define GL_CONSTANT_ATTENUATION			0x1207
  25.364 +#define GL_LINEAR_ATTENUATION			0x1208
  25.365 +#define GL_QUADRATIC_ATTENUATION		0x1209
  25.366 +#define GL_AMBIENT				0x1200
  25.367 +#define GL_DIFFUSE				0x1201
  25.368 +#define GL_SPECULAR				0x1202
  25.369 +#define GL_SHININESS				0x1601
  25.370 +#define GL_EMISSION				0x1600
  25.371 +#define GL_POSITION				0x1203
  25.372 +#define GL_SPOT_DIRECTION			0x1204
  25.373 +#define GL_AMBIENT_AND_DIFFUSE			0x1602
  25.374 +#define GL_COLOR_INDEXES			0x1603
  25.375 +#define GL_LIGHT_MODEL_TWO_SIDE			0x0B52
  25.376 +#define GL_LIGHT_MODEL_LOCAL_VIEWER		0x0B51
  25.377 +#define GL_LIGHT_MODEL_AMBIENT			0x0B53
  25.378 +#define GL_FRONT_AND_BACK			0x0408
  25.379 +#define GL_SHADE_MODEL				0x0B54
  25.380 +#define GL_FLAT					0x1D00
  25.381 +#define GL_SMOOTH				0x1D01
  25.382 +#define GL_COLOR_MATERIAL			0x0B57
  25.383 +#define GL_COLOR_MATERIAL_FACE			0x0B55
  25.384 +#define GL_COLOR_MATERIAL_PARAMETER		0x0B56
  25.385 +#define GL_NORMALIZE				0x0BA1
  25.386 +
  25.387 +/* User clipping planes */
  25.388 +#define GL_CLIP_PLANE0				0x3000
  25.389 +#define GL_CLIP_PLANE1				0x3001
  25.390 +#define GL_CLIP_PLANE2				0x3002
  25.391 +#define GL_CLIP_PLANE3				0x3003
  25.392 +#define GL_CLIP_PLANE4				0x3004
  25.393 +#define GL_CLIP_PLANE5				0x3005
  25.394 +
  25.395 +/* Accumulation buffer */
  25.396 +#define GL_ACCUM_RED_BITS			0x0D58
  25.397 +#define GL_ACCUM_GREEN_BITS			0x0D59
  25.398 +#define GL_ACCUM_BLUE_BITS			0x0D5A
  25.399 +#define GL_ACCUM_ALPHA_BITS			0x0D5B
  25.400 +#define GL_ACCUM_CLEAR_VALUE			0x0B80
  25.401 +#define GL_ACCUM				0x0100
  25.402 +#define GL_ADD					0x0104
  25.403 +#define GL_LOAD					0x0101
  25.404 +#define GL_MULT					0x0103
  25.405 +#define GL_RETURN				0x0102
  25.406 +
  25.407 +/* Alpha testing */
  25.408 +#define GL_ALPHA_TEST				0x0BC0
  25.409 +#define GL_ALPHA_TEST_REF			0x0BC2
  25.410 +#define GL_ALPHA_TEST_FUNC			0x0BC1
  25.411 +
  25.412 +/* Blending */
  25.413 +#define GL_BLEND				0x0BE2
  25.414 +#define GL_BLEND_SRC				0x0BE1
  25.415 +#define GL_BLEND_DST				0x0BE0
  25.416 +#define GL_ZERO					0
  25.417 +#define GL_ONE					1
  25.418 +#define GL_SRC_COLOR				0x0300
  25.419 +#define GL_ONE_MINUS_SRC_COLOR			0x0301
  25.420 +#define GL_SRC_ALPHA				0x0302
  25.421 +#define GL_ONE_MINUS_SRC_ALPHA			0x0303
  25.422 +#define GL_DST_ALPHA				0x0304
  25.423 +#define GL_ONE_MINUS_DST_ALPHA			0x0305
  25.424 +#define GL_DST_COLOR				0x0306
  25.425 +#define GL_ONE_MINUS_DST_COLOR			0x0307
  25.426 +#define GL_SRC_ALPHA_SATURATE			0x0308
  25.427 +
  25.428 +/* Render Mode */
  25.429 +#define GL_FEEDBACK				0x1C01
  25.430 +#define GL_RENDER				0x1C00
  25.431 +#define GL_SELECT				0x1C02
  25.432 +
  25.433 +/* Feedback */
  25.434 +#define GL_2D					0x0600
  25.435 +#define GL_3D					0x0601
  25.436 +#define GL_3D_COLOR				0x0602
  25.437 +#define GL_3D_COLOR_TEXTURE			0x0603
  25.438 +#define GL_4D_COLOR_TEXTURE			0x0604
  25.439 +#define GL_POINT_TOKEN				0x0701
  25.440 +#define GL_LINE_TOKEN				0x0702
  25.441 +#define GL_LINE_RESET_TOKEN			0x0707
  25.442 +#define GL_POLYGON_TOKEN			0x0703
  25.443 +#define GL_BITMAP_TOKEN				0x0704
  25.444 +#define GL_DRAW_PIXEL_TOKEN			0x0705
  25.445 +#define GL_COPY_PIXEL_TOKEN			0x0706
  25.446 +#define GL_PASS_THROUGH_TOKEN			0x0700
  25.447 +#define GL_FEEDBACK_BUFFER_POINTER		0x0DF0
  25.448 +#define GL_FEEDBACK_BUFFER_SIZE			0x0DF1
  25.449 +#define GL_FEEDBACK_BUFFER_TYPE			0x0DF2
  25.450 +
  25.451 +/* Selection */
  25.452 +#define GL_SELECTION_BUFFER_POINTER		0x0DF3
  25.453 +#define GL_SELECTION_BUFFER_SIZE		0x0DF4
  25.454 +
  25.455 +/* Fog */
  25.456 +#define GL_FOG					0x0B60
  25.457 +#define GL_FOG_MODE				0x0B65
  25.458 +#define GL_FOG_DENSITY				0x0B62
  25.459 +#define GL_FOG_COLOR				0x0B66
  25.460 +#define GL_FOG_INDEX				0x0B61
  25.461 +#define GL_FOG_START				0x0B63
  25.462 +#define GL_FOG_END				0x0B64
  25.463 +#define GL_LINEAR				0x2601
  25.464 +#define GL_EXP					0x0800
  25.465 +#define GL_EXP2					0x0801
  25.466 +
  25.467 +/* Logic Ops */
  25.468 +#define GL_LOGIC_OP				0x0BF1
  25.469 +#define GL_INDEX_LOGIC_OP			0x0BF1
  25.470 +#define GL_COLOR_LOGIC_OP			0x0BF2
  25.471 +#define GL_LOGIC_OP_MODE			0x0BF0
  25.472 +#define GL_CLEAR				0x1500
  25.473 +#define GL_SET					0x150F
  25.474 +#define GL_COPY					0x1503
  25.475 +#define GL_COPY_INVERTED			0x150C
  25.476 +#define GL_NOOP					0x1505
  25.477 +#define GL_INVERT				0x150A
  25.478 +#define GL_AND					0x1501
  25.479 +#define GL_NAND					0x150E
  25.480 +#define GL_OR					0x1507
  25.481 +#define GL_NOR					0x1508
  25.482 +#define GL_XOR					0x1506
  25.483 +#define GL_EQUIV				0x1509
  25.484 +#define GL_AND_REVERSE				0x1502
  25.485 +#define GL_AND_INVERTED				0x1504
  25.486 +#define GL_OR_REVERSE				0x150B
  25.487 +#define GL_OR_INVERTED				0x150D
  25.488 +
  25.489 +/* Stencil */
  25.490 +#define GL_STENCIL_BITS				0x0D57
  25.491 +#define GL_STENCIL_TEST				0x0B90
  25.492 +#define GL_STENCIL_CLEAR_VALUE			0x0B91
  25.493 +#define GL_STENCIL_FUNC				0x0B92
  25.494 +#define GL_STENCIL_VALUE_MASK			0x0B93
  25.495 +#define GL_STENCIL_FAIL				0x0B94
  25.496 +#define GL_STENCIL_PASS_DEPTH_FAIL		0x0B95
  25.497 +#define GL_STENCIL_PASS_DEPTH_PASS		0x0B96
  25.498 +#define GL_STENCIL_REF				0x0B97
  25.499 +#define GL_STENCIL_WRITEMASK			0x0B98
  25.500 +#define GL_STENCIL_INDEX			0x1901
  25.501 +#define GL_KEEP					0x1E00
  25.502 +#define GL_REPLACE				0x1E01
  25.503 +#define GL_INCR					0x1E02
  25.504 +#define GL_DECR					0x1E03
  25.505 +
  25.506 +/* Buffers, Pixel Drawing/Reading */
  25.507 +#define GL_NONE					0
  25.508 +#define GL_LEFT					0x0406
  25.509 +#define GL_RIGHT				0x0407
  25.510 +/*GL_FRONT					0x0404 */
  25.511 +/*GL_BACK					0x0405 */
  25.512 +/*GL_FRONT_AND_BACK				0x0408 */
  25.513 +#define GL_FRONT_LEFT				0x0400
  25.514 +#define GL_FRONT_RIGHT				0x0401
  25.515 +#define GL_BACK_LEFT				0x0402
  25.516 +#define GL_BACK_RIGHT				0x0403
  25.517 +#define GL_AUX0					0x0409
  25.518 +#define GL_AUX1					0x040A
  25.519 +#define GL_AUX2					0x040B
  25.520 +#define GL_AUX3					0x040C
  25.521 +#define GL_COLOR_INDEX				0x1900
  25.522 +#define GL_RED					0x1903
  25.523 +#define GL_GREEN				0x1904
  25.524 +#define GL_BLUE					0x1905
  25.525 +#define GL_ALPHA				0x1906
  25.526 +#define GL_LUMINANCE				0x1909
  25.527 +#define GL_LUMINANCE_ALPHA			0x190A
  25.528 +#define GL_ALPHA_BITS				0x0D55
  25.529 +#define GL_RED_BITS				0x0D52
  25.530 +#define GL_GREEN_BITS				0x0D53
  25.531 +#define GL_BLUE_BITS				0x0D54
  25.532 +#define GL_INDEX_BITS				0x0D51
  25.533 +#define GL_SUBPIXEL_BITS			0x0D50
  25.534 +#define GL_AUX_BUFFERS				0x0C00
  25.535 +#define GL_READ_BUFFER				0x0C02
  25.536 +#define GL_DRAW_BUFFER				0x0C01
  25.537 +#define GL_DOUBLEBUFFER				0x0C32
  25.538 +#define GL_STEREO				0x0C33
  25.539 +#define GL_BITMAP				0x1A00
  25.540 +#define GL_COLOR				0x1800
  25.541 +#define GL_DEPTH				0x1801
  25.542 +#define GL_STENCIL				0x1802
  25.543 +#define GL_DITHER				0x0BD0
  25.544 +#define GL_RGB					0x1907
  25.545 +#define GL_RGBA					0x1908
  25.546 +
  25.547 +/* Implementation limits */
  25.548 +#define GL_MAX_LIST_NESTING			0x0B31
  25.549 +#define GL_MAX_EVAL_ORDER			0x0D30
  25.550 +#define GL_MAX_LIGHTS				0x0D31
  25.551 +#define GL_MAX_CLIP_PLANES			0x0D32
  25.552 +#define GL_MAX_TEXTURE_SIZE			0x0D33
  25.553 +#define GL_MAX_PIXEL_MAP_TABLE			0x0D34
  25.554 +#define GL_MAX_ATTRIB_STACK_DEPTH		0x0D35
  25.555 +#define GL_MAX_MODELVIEW_STACK_DEPTH		0x0D36
  25.556 +#define GL_MAX_NAME_STACK_DEPTH			0x0D37
  25.557 +#define GL_MAX_PROJECTION_STACK_DEPTH		0x0D38
  25.558 +#define GL_MAX_TEXTURE_STACK_DEPTH		0x0D39
  25.559 +#define GL_MAX_VIEWPORT_DIMS			0x0D3A
  25.560 +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH	0x0D3B
  25.561 +
  25.562 +/* Gets */
  25.563 +#define GL_ATTRIB_STACK_DEPTH			0x0BB0
  25.564 +#define GL_CLIENT_ATTRIB_STACK_DEPTH		0x0BB1
  25.565 +#define GL_COLOR_CLEAR_VALUE			0x0C22
  25.566 +#define GL_COLOR_WRITEMASK			0x0C23
  25.567 +#define GL_CURRENT_INDEX			0x0B01
  25.568 +#define GL_CURRENT_COLOR			0x0B00
  25.569 +#define GL_CURRENT_NORMAL			0x0B02
  25.570 +#define GL_CURRENT_RASTER_COLOR			0x0B04
  25.571 +#define GL_CURRENT_RASTER_DISTANCE		0x0B09
  25.572 +#define GL_CURRENT_RASTER_INDEX			0x0B05
  25.573 +#define GL_CURRENT_RASTER_POSITION		0x0B07
  25.574 +#define GL_CURRENT_RASTER_TEXTURE_COORDS	0x0B06
  25.575 +#define GL_CURRENT_RASTER_POSITION_VALID	0x0B08
  25.576 +#define GL_CURRENT_TEXTURE_COORDS		0x0B03
  25.577 +#define GL_INDEX_CLEAR_VALUE			0x0C20
  25.578 +#define GL_INDEX_MODE				0x0C30
  25.579 +#define GL_INDEX_WRITEMASK			0x0C21
  25.580 +#define GL_MODELVIEW_MATRIX			0x0BA6
  25.581 +#define GL_MODELVIEW_STACK_DEPTH		0x0BA3
  25.582 +#define GL_NAME_STACK_DEPTH			0x0D70
  25.583 +#define GL_PROJECTION_MATRIX			0x0BA7
  25.584 +#define GL_PROJECTION_STACK_DEPTH		0x0BA4
  25.585 +#define GL_RENDER_MODE				0x0C40
  25.586 +#define GL_RGBA_MODE				0x0C31
  25.587 +#define GL_TEXTURE_MATRIX			0x0BA8
  25.588 +#define GL_TEXTURE_STACK_DEPTH			0x0BA5
  25.589 +#define GL_VIEWPORT				0x0BA2
  25.590 +
  25.591 +/* Evaluators */
  25.592 +#define GL_AUTO_NORMAL				0x0D80
  25.593 +#define GL_MAP1_COLOR_4				0x0D90
  25.594 +#define GL_MAP1_INDEX				0x0D91
  25.595 +#define GL_MAP1_NORMAL				0x0D92
  25.596 +#define GL_MAP1_TEXTURE_COORD_1			0x0D93
  25.597 +#define GL_MAP1_TEXTURE_COORD_2			0x0D94
  25.598 +#define GL_MAP1_TEXTURE_COORD_3			0x0D95
  25.599 +#define GL_MAP1_TEXTURE_COORD_4			0x0D96
  25.600 +#define GL_MAP1_VERTEX_3			0x0D97
  25.601 +#define GL_MAP1_VERTEX_4			0x0D98
  25.602 +#define GL_MAP2_COLOR_4				0x0DB0
  25.603 +#define GL_MAP2_INDEX				0x0DB1
  25.604 +#define GL_MAP2_NORMAL				0x0DB2
  25.605 +#define GL_MAP2_TEXTURE_COORD_1			0x0DB3
  25.606 +#define GL_MAP2_TEXTURE_COORD_2			0x0DB4
  25.607 +#define GL_MAP2_TEXTURE_COORD_3			0x0DB5
  25.608 +#define GL_MAP2_TEXTURE_COORD_4			0x0DB6
  25.609 +#define GL_MAP2_VERTEX_3			0x0DB7
  25.610 +#define GL_MAP2_VERTEX_4			0x0DB8
  25.611 +#define GL_MAP1_GRID_DOMAIN			0x0DD0
  25.612 +#define GL_MAP1_GRID_SEGMENTS			0x0DD1
  25.613 +#define GL_MAP2_GRID_DOMAIN			0x0DD2
  25.614 +#define GL_MAP2_GRID_SEGMENTS			0x0DD3
  25.615 +#define GL_COEFF				0x0A00
  25.616 +#define GL_ORDER				0x0A01
  25.617 +#define GL_DOMAIN				0x0A02
  25.618 +
  25.619 +/* Hints */
  25.620 +#define GL_PERSPECTIVE_CORRECTION_HINT		0x0C50
  25.621 +#define GL_POINT_SMOOTH_HINT			0x0C51
  25.622 +#define GL_LINE_SMOOTH_HINT			0x0C52
  25.623 +#define GL_POLYGON_SMOOTH_HINT			0x0C53
  25.624 +#define GL_FOG_HINT				0x0C54
  25.625 +#define GL_DONT_CARE				0x1100
  25.626 +#define GL_FASTEST				0x1101
  25.627 +#define GL_NICEST				0x1102
  25.628 +
  25.629 +/* Scissor box */
  25.630 +#define GL_SCISSOR_BOX				0x0C10
  25.631 +#define GL_SCISSOR_TEST				0x0C11
  25.632 +
  25.633 +/* Pixel Mode / Transfer */
  25.634 +#define GL_MAP_COLOR				0x0D10
  25.635 +#define GL_MAP_STENCIL				0x0D11
  25.636 +#define GL_INDEX_SHIFT				0x0D12
  25.637 +#define GL_INDEX_OFFSET				0x0D13
  25.638 +#define GL_RED_SCALE				0x0D14
  25.639 +#define GL_RED_BIAS				0x0D15
  25.640 +#define GL_GREEN_SCALE				0x0D18
  25.641 +#define GL_GREEN_BIAS				0x0D19
  25.642 +#define GL_BLUE_SCALE				0x0D1A
  25.643 +#define GL_BLUE_BIAS				0x0D1B
  25.644 +#define GL_ALPHA_SCALE				0x0D1C
  25.645 +#define GL_ALPHA_BIAS				0x0D1D
  25.646 +#define GL_DEPTH_SCALE				0x0D1E
  25.647 +#define GL_DEPTH_BIAS				0x0D1F
  25.648 +#define GL_PIXEL_MAP_S_TO_S_SIZE		0x0CB1
  25.649 +#define GL_PIXEL_MAP_I_TO_I_SIZE		0x0CB0
  25.650 +#define GL_PIXEL_MAP_I_TO_R_SIZE		0x0CB2
  25.651 +#define GL_PIXEL_MAP_I_TO_G_SIZE		0x0CB3
  25.652 +#define GL_PIXEL_MAP_I_TO_B_SIZE		0x0CB4
  25.653 +#define GL_PIXEL_MAP_I_TO_A_SIZE		0x0CB5
  25.654 +#define GL_PIXEL_MAP_R_TO_R_SIZE		0x0CB6
  25.655 +#define GL_PIXEL_MAP_G_TO_G_SIZE		0x0CB7
  25.656 +#define GL_PIXEL_MAP_B_TO_B_SIZE		0x0CB8
  25.657 +#define GL_PIXEL_MAP_A_TO_A_SIZE		0x0CB9
  25.658 +#define GL_PIXEL_MAP_S_TO_S			0x0C71
  25.659 +#define GL_PIXEL_MAP_I_TO_I			0x0C70
  25.660 +#define GL_PIXEL_MAP_I_TO_R			0x0C72
  25.661 +#define GL_PIXEL_MAP_I_TO_G			0x0C73
  25.662 +#define GL_PIXEL_MAP_I_TO_B			0x0C74
  25.663 +#define GL_PIXEL_MAP_I_TO_A			0x0C75
  25.664 +#define GL_PIXEL_MAP_R_TO_R			0x0C76
  25.665 +#define GL_PIXEL_MAP_G_TO_G			0x0C77
  25.666 +#define GL_PIXEL_MAP_B_TO_B			0x0C78
  25.667 +#define GL_PIXEL_MAP_A_TO_A			0x0C79
  25.668 +#define GL_PACK_ALIGNMENT			0x0D05
  25.669 +#define GL_PACK_LSB_FIRST			0x0D01
  25.670 +#define GL_PACK_ROW_LENGTH			0x0D02
  25.671 +#define GL_PACK_SKIP_PIXELS			0x0D04
  25.672 +#define GL_PACK_SKIP_ROWS			0x0D03
  25.673 +#define GL_PACK_SWAP_BYTES			0x0D00
  25.674 +#define GL_UNPACK_ALIGNMENT			0x0CF5
  25.675 +#define GL_UNPACK_LSB_FIRST			0x0CF1
  25.676 +#define GL_UNPACK_ROW_LENGTH			0x0CF2
  25.677 +#define GL_UNPACK_SKIP_PIXELS			0x0CF4
  25.678 +#define GL_UNPACK_SKIP_ROWS			0x0CF3
  25.679 +#define GL_UNPACK_SWAP_BYTES			0x0CF0
  25.680 +#define GL_ZOOM_X				0x0D16
  25.681 +#define GL_ZOOM_Y				0x0D17
  25.682 +
  25.683 +/* Texture mapping */
  25.684 +#define GL_TEXTURE_ENV				0x2300
  25.685 +#define GL_TEXTURE_ENV_MODE			0x2200
  25.686 +#define GL_TEXTURE_1D				0x0DE0
  25.687 +#define GL_TEXTURE_2D				0x0DE1
  25.688 +#define GL_TEXTURE_WRAP_S			0x2802
  25.689 +#define GL_TEXTURE_WRAP_T			0x2803
  25.690 +#define GL_TEXTURE_MAG_FILTER			0x2800
  25.691 +#define GL_TEXTURE_MIN_FILTER			0x2801
  25.692 +#define GL_TEXTURE_ENV_COLOR			0x2201
  25.693 +#define GL_TEXTURE_GEN_S			0x0C60
  25.694 +#define GL_TEXTURE_GEN_T			0x0C61
  25.695 +#define GL_TEXTURE_GEN_R			0x0C62
  25.696 +#define GL_TEXTURE_GEN_Q			0x0C63
  25.697 +#define GL_TEXTURE_GEN_MODE			0x2500
  25.698 +#define GL_TEXTURE_BORDER_COLOR			0x1004
  25.699 +#define GL_TEXTURE_WIDTH			0x1000
  25.700 +#define GL_TEXTURE_HEIGHT			0x1001
  25.701 +#define GL_TEXTURE_BORDER			0x1005
  25.702 +#define GL_TEXTURE_COMPONENTS			0x1003
  25.703 +#define GL_TEXTURE_RED_SIZE			0x805C
  25.704 +#define GL_TEXTURE_GREEN_SIZE			0x805D
  25.705 +#define GL_TEXTURE_BLUE_SIZE			0x805E
  25.706 +#define GL_TEXTURE_ALPHA_SIZE			0x805F
  25.707 +#define GL_TEXTURE_LUMINANCE_SIZE		0x8060
  25.708 +#define GL_TEXTURE_INTENSITY_SIZE		0x8061
  25.709 +#define GL_NEAREST_MIPMAP_NEAREST		0x2700
  25.710 +#define GL_NEAREST_MIPMAP_LINEAR		0x2702
  25.711 +#define GL_LINEAR_MIPMAP_NEAREST		0x2701
  25.712 +#define GL_LINEAR_MIPMAP_LINEAR			0x2703
  25.713 +#define GL_OBJECT_LINEAR			0x2401
  25.714 +#define GL_OBJECT_PLANE				0x2501
  25.715 +#define GL_EYE_LINEAR				0x2400
  25.716 +#define GL_EYE_PLANE				0x2502
  25.717 +#define GL_SPHERE_MAP				0x2402
  25.718 +#define GL_DECAL				0x2101
  25.719 +#define GL_MODULATE				0x2100
  25.720 +#define GL_NEAREST				0x2600
  25.721 +#define GL_REPEAT				0x2901
  25.722 +#define GL_CLAMP				0x2900
  25.723 +#define GL_S					0x2000
  25.724 +#define GL_T					0x2001
  25.725 +#define GL_R					0x2002
  25.726 +#define GL_Q					0x2003
  25.727 +
  25.728 +/* Utility */
  25.729 +#define GL_VENDOR				0x1F00
  25.730 +#define GL_RENDERER				0x1F01
  25.731 +#define GL_VERSION				0x1F02
  25.732 +#define GL_EXTENSIONS				0x1F03
  25.733 +
  25.734 +/* Errors */
  25.735 +#define GL_NO_ERROR 				0
  25.736 +#define GL_INVALID_ENUM				0x0500
  25.737 +#define GL_INVALID_VALUE			0x0501
  25.738 +#define GL_INVALID_OPERATION			0x0502
  25.739 +#define GL_STACK_OVERFLOW			0x0503
  25.740 +#define GL_STACK_UNDERFLOW			0x0504
  25.741 +#define GL_OUT_OF_MEMORY			0x0505
  25.742 +
  25.743 +/* glPush/PopAttrib bits */
  25.744 +#define GL_CURRENT_BIT				0x00000001
  25.745 +#define GL_POINT_BIT				0x00000002
  25.746 +#define GL_LINE_BIT				0x00000004
  25.747 +#define GL_POLYGON_BIT				0x00000008
  25.748 +#define GL_POLYGON_STIPPLE_BIT			0x00000010
  25.749 +#define GL_PIXEL_MODE_BIT			0x00000020
  25.750 +#define GL_LIGHTING_BIT				0x00000040
  25.751 +#define GL_FOG_BIT				0x00000080
  25.752 +#define GL_DEPTH_BUFFER_BIT			0x00000100
  25.753 +#define GL_ACCUM_BUFFER_BIT			0x00000200
  25.754 +#define GL_STENCIL_BUFFER_BIT			0x00000400
  25.755 +#define GL_VIEWPORT_BIT				0x00000800
  25.756 +#define GL_TRANSFORM_BIT			0x00001000
  25.757 +#define GL_ENABLE_BIT				0x00002000
  25.758 +#define GL_COLOR_BUFFER_BIT			0x00004000
  25.759 +#define GL_HINT_BIT				0x00008000
  25.760 +#define GL_EVAL_BIT				0x00010000
  25.761 +#define GL_LIST_BIT				0x00020000
  25.762 +#define GL_TEXTURE_BIT				0x00040000
  25.763 +#define GL_SCISSOR_BIT				0x00080000
  25.764 +#define GL_ALL_ATTRIB_BITS			0x000FFFFF
  25.765 +
  25.766 +
  25.767 +/* OpenGL 1.1 */
  25.768 +#define GL_PROXY_TEXTURE_1D			0x8063
  25.769 +#define GL_PROXY_TEXTURE_2D			0x8064
  25.770 +#define GL_TEXTURE_PRIORITY			0x8066
  25.771 +#define GL_TEXTURE_RESIDENT			0x8067
  25.772 +#define GL_TEXTURE_BINDING_1D			0x8068
  25.773 +#define GL_TEXTURE_BINDING_2D			0x8069
  25.774 +#define GL_TEXTURE_INTERNAL_FORMAT		0x1003
  25.775 +#define GL_ALPHA4				0x803B
  25.776 +#define GL_ALPHA8				0x803C
  25.777 +#define GL_ALPHA12				0x803D
  25.778 +#define GL_ALPHA16				0x803E
  25.779 +#define GL_LUMINANCE4				0x803F
  25.780 +#define GL_LUMINANCE8				0x8040
  25.781 +#define GL_LUMINANCE12				0x8041
  25.782 +#define GL_LUMINANCE16				0x8042
  25.783 +#define GL_LUMINANCE4_ALPHA4			0x8043
  25.784 +#define GL_LUMINANCE6_ALPHA2			0x8044
  25.785 +#define GL_LUMINANCE8_ALPHA8			0x8045
  25.786 +#define GL_LUMINANCE12_ALPHA4			0x8046
  25.787 +#define GL_LUMINANCE12_ALPHA12			0x8047
  25.788 +#define GL_LUMINANCE16_ALPHA16			0x8048
  25.789 +#define GL_INTENSITY				0x8049
  25.790 +#define GL_INTENSITY4				0x804A
  25.791 +#define GL_INTENSITY8				0x804B
  25.792 +#define GL_INTENSITY12				0x804C
  25.793 +#define GL_INTENSITY16				0x804D
  25.794 +#define GL_R3_G3_B2				0x2A10
  25.795 +#define GL_RGB4					0x804F
  25.796 +#define GL_RGB5					0x8050
  25.797 +#define GL_RGB8					0x8051
  25.798 +#define GL_RGB10				0x8052
  25.799 +#define GL_RGB12				0x8053
  25.800 +#define GL_RGB16				0x8054
  25.801 +#define GL_RGBA2				0x8055
  25.802 +#define GL_RGBA4				0x8056
  25.803 +#define GL_RGB5_A1				0x8057
  25.804 +#define GL_RGBA8				0x8058
  25.805 +#define GL_RGB10_A2				0x8059
  25.806 +#define GL_RGBA12				0x805A
  25.807 +#define GL_RGBA16				0x805B
  25.808 +#define GL_CLIENT_PIXEL_STORE_BIT		0x00000001
  25.809 +#define GL_CLIENT_VERTEX_ARRAY_BIT		0x00000002
  25.810 +#define GL_ALL_CLIENT_ATTRIB_BITS 		0xFFFFFFFF
  25.811 +#define GL_CLIENT_ALL_ATTRIB_BITS 		0xFFFFFFFF
  25.812 +
  25.813 +
  25.814 +
  25.815 +/*
  25.816 + * Miscellaneous
  25.817 + */
  25.818 +
  25.819 +GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
  25.820 +
  25.821 +GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
  25.822 +
  25.823 +GLAPI void GLAPIENTRY glClear( GLbitfield mask );
  25.824 +
  25.825 +GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
  25.826 +
  25.827 +GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
  25.828 +
  25.829 +GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
  25.830 +
  25.831 +GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
  25.832 +
  25.833 +GLAPI void GLAPIENTRY glLogicOp( GLenum opcode );
  25.834 +
  25.835 +GLAPI void GLAPIENTRY glCullFace( GLenum mode );
  25.836 +
  25.837 +GLAPI void GLAPIENTRY glFrontFace( GLenum mode );
  25.838 +
  25.839 +GLAPI void GLAPIENTRY glPointSize( GLfloat size );
  25.840 +
  25.841 +GLAPI void GLAPIENTRY glLineWidth( GLfloat width );
  25.842 +
  25.843 +GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern );
  25.844 +
  25.845 +GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode );
  25.846 +
  25.847 +GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
  25.848 +
  25.849 +GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask );
  25.850 +
  25.851 +GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask );
  25.852 +
  25.853 +GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
  25.854 +
  25.855 +GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
  25.856 +
  25.857 +GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
  25.858 +
  25.859 +GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
  25.860 +
  25.861 +GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation );
  25.862 +
  25.863 +GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode );
  25.864 +
  25.865 +GLAPI void GLAPIENTRY glReadBuffer( GLenum mode );
  25.866 +
  25.867 +GLAPI void GLAPIENTRY glEnable( GLenum cap );
  25.868 +
  25.869 +GLAPI void GLAPIENTRY glDisable( GLenum cap );
  25.870 +
  25.871 +GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap );
  25.872 +
  25.873 +
  25.874 +GLAPI void GLAPIENTRY glEnableClientState( GLenum cap );  /* 1.1 */
  25.875 +
  25.876 +GLAPI void GLAPIENTRY glDisableClientState( GLenum cap );  /* 1.1 */
  25.877 +
  25.878 +
  25.879 +GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params );
  25.880 +
  25.881 +GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params );
  25.882 +
  25.883 +GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params );
  25.884 +
  25.885 +GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params );
  25.886 +
  25.887 +
  25.888 +GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask );
  25.889 +
  25.890 +GLAPI void GLAPIENTRY glPopAttrib( void );
  25.891 +
  25.892 +
  25.893 +GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask );  /* 1.1 */
  25.894 +
  25.895 +GLAPI void GLAPIENTRY glPopClientAttrib( void );  /* 1.1 */
  25.896 +
  25.897 +
  25.898 +GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode );
  25.899 +
  25.900 +GLAPI GLenum GLAPIENTRY glGetError( void );
  25.901 +
  25.902 +GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name );
  25.903 +
  25.904 +GLAPI void GLAPIENTRY glFinish( void );
  25.905 +
  25.906 +GLAPI void GLAPIENTRY glFlush( void );
  25.907 +
  25.908 +GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode );
  25.909 +
  25.910 +
  25.911 +/*
  25.912 + * Depth Buffer
  25.913 + */
  25.914 +
  25.915 +GLAPI void GLAPIENTRY glClearDepth( GLclampd depth );
  25.916 +
  25.917 +GLAPI void GLAPIENTRY glDepthFunc( GLenum func );
  25.918 +
  25.919 +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag );
  25.920 +
  25.921 +GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
  25.922 +
  25.923 +
  25.924 +/*
  25.925 + * Accumulation Buffer
  25.926 + */
  25.927 +
  25.928 +GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
  25.929 +
  25.930 +GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
  25.931 +
  25.932 +
  25.933 +/*
  25.934 + * Transformation
  25.935 + */
  25.936 +
  25.937 +GLAPI void GLAPIENTRY glMatrixMode( GLenum mode );
  25.938 +
  25.939 +GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right,
  25.940 +                                 GLdouble bottom, GLdouble top,
  25.941 +                                 GLdouble near_val, GLdouble far_val );
  25.942 +
  25.943 +GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right,
  25.944 +                                   GLdouble bottom, GLdouble top,
  25.945 +                                   GLdouble near_val, GLdouble far_val );
  25.946 +
  25.947 +GLAPI void GLAPIENTRY glViewport( GLint x, GLint y,
  25.948 +                                    GLsizei width, GLsizei height );
  25.949 +
  25.950 +GLAPI void GLAPIENTRY glPushMatrix( void );
  25.951 +
  25.952 +GLAPI void GLAPIENTRY glPopMatrix( void );
  25.953 +
  25.954 +GLAPI void GLAPIENTRY glLoadIdentity( void );
  25.955 +
  25.956 +GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m );
  25.957 +GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m );
  25.958 +
  25.959 +GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m );
  25.960 +GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m );
  25.961 +
  25.962 +GLAPI void GLAPIENTRY glRotated( GLdouble angle,
  25.963 +                                   GLdouble x, GLdouble y, GLdouble z );
  25.964 +GLAPI void GLAPIENTRY glRotatef( GLfloat angle,
  25.965 +                                   GLfloat x, GLfloat y, GLfloat z );
  25.966 +
  25.967 +GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z );
  25.968 +GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
  25.969 +
  25.970 +GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z );
  25.971 +GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z );
  25.972 +
  25.973 +
  25.974 +/*
  25.975 + * Display Lists
  25.976 + */
  25.977 +
  25.978 +GLAPI GLboolean GLAPIENTRY glIsList( GLuint list );
  25.979 +
  25.980 +GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range );
  25.981 +
  25.982 +GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range );
  25.983 +
  25.984 +GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode );
  25.985 +
  25.986 +GLAPI void GLAPIENTRY glEndList( void );
  25.987 +
  25.988 +GLAPI void GLAPIENTRY glCallList( GLuint list );
  25.989 +
  25.990 +GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type,
  25.991 +                                     const GLvoid *lists );
  25.992 +
  25.993 +GLAPI void GLAPIENTRY glListBase( GLuint base );
  25.994 +
  25.995 +
  25.996 +/*
  25.997 + * Drawing Functions
  25.998 + */
  25.999 +
 25.1000 +GLAPI void GLAPIENTRY glBegin( GLenum mode );
 25.1001 +
 25.1002 +GLAPI void GLAPIENTRY glEnd( void );
 25.1003 +
 25.1004 +
 25.1005 +GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y );
 25.1006 +GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y );
 25.1007 +GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y );
 25.1008 +GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y );
 25.1009 +
 25.1010 +GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z );
 25.1011 +GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z );
 25.1012 +GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z );
 25.1013 +GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z );
 25.1014 +
 25.1015 +GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
 25.1016 +GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
 25.1017 +GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w );
 25.1018 +GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
 25.1019 +
 25.1020 +GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v );
 25.1021 +GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v );
 25.1022 +GLAPI void GLAPIENTRY glVertex2iv( const GLint *v );
 25.1023 +GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v );
 25.1024 +
 25.1025 +GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v );
 25.1026 +GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v );
 25.1027 +GLAPI void GLAPIENTRY glVertex3iv( const GLint *v );
 25.1028 +GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v );
 25.1029 +
 25.1030 +GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v );
 25.1031 +GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v );
 25.1032 +GLAPI void GLAPIENTRY glVertex4iv( const GLint *v );
 25.1033 +GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v );
 25.1034 +
 25.1035 +
 25.1036 +GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
 25.1037 +GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
 25.1038 +GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
 25.1039 +GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz );
 25.1040 +GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz );
 25.1041 +
 25.1042 +GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
 25.1043 +GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v );
 25.1044 +GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v );
 25.1045 +GLAPI void GLAPIENTRY glNormal3iv( const GLint *v );
 25.1046 +GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v );
 25.1047 +
 25.1048 +
 25.1049 +GLAPI void GLAPIENTRY glIndexd( GLdouble c );
 25.1050 +GLAPI void GLAPIENTRY glIndexf( GLfloat c );
 25.1051 +GLAPI void GLAPIENTRY glIndexi( GLint c );
 25.1052 +GLAPI void GLAPIENTRY glIndexs( GLshort c );
 25.1053 +GLAPI void GLAPIENTRY glIndexub( GLubyte c );  /* 1.1 */
 25.1054 +
 25.1055 +GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c );
 25.1056 +GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c );
 25.1057 +GLAPI void GLAPIENTRY glIndexiv( const GLint *c );
 25.1058 +GLAPI void GLAPIENTRY glIndexsv( const GLshort *c );
 25.1059 +GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c );  /* 1.1 */
 25.1060 +
 25.1061 +GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue );
 25.1062 +GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue );
 25.1063 +GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue );
 25.1064 +GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue );
 25.1065 +GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue );
 25.1066 +GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
 25.1067 +GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue );
 25.1068 +GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue );
 25.1069 +
 25.1070 +GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green,
 25.1071 +                                   GLbyte blue, GLbyte alpha );
 25.1072 +GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green,
 25.1073 +                                   GLdouble blue, GLdouble alpha );
 25.1074 +GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green,
 25.1075 +                                   GLfloat blue, GLfloat alpha );
 25.1076 +GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green,
 25.1077 +                                   GLint blue, GLint alpha );
 25.1078 +GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green,
 25.1079 +                                   GLshort blue, GLshort alpha );
 25.1080 +GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green,
 25.1081 +                                    GLubyte blue, GLubyte alpha );
 25.1082 +GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green,
 25.1083 +                                    GLuint blue, GLuint alpha );
 25.1084 +GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green,
 25.1085 +                                    GLushort blue, GLushort alpha );
 25.1086 +
 25.1087 +
 25.1088 +GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v );
 25.1089 +GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v );
 25.1090 +GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v );
 25.1091 +GLAPI void GLAPIENTRY glColor3iv( const GLint *v );
 25.1092 +GLAPI void GLAPIENTRY glColor3sv( const GLshort *v );
 25.1093 +GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v );
 25.1094 +GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v );
 25.1095 +GLAPI void GLAPIENTRY glColor3usv( const GLushort *v );
 25.1096 +
 25.1097 +GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v );
 25.1098 +GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v );
 25.1099 +GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v );
 25.1100 +GLAPI void GLAPIENTRY glColor4iv( const GLint *v );
 25.1101 +GLAPI void GLAPIENTRY glColor4sv( const GLshort *v );
 25.1102 +GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v );
 25.1103 +GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v );
 25.1104 +GLAPI void GLAPIENTRY glColor4usv( const GLushort *v );
 25.1105 +
 25.1106 +
 25.1107 +GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s );
 25.1108 +GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s );
 25.1109 +GLAPI void GLAPIENTRY glTexCoord1i( GLint s );
 25.1110 +GLAPI void GLAPIENTRY glTexCoord1s( GLshort s );
 25.1111 +
 25.1112 +GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t );
 25.1113 +GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t );
 25.1114 +GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t );
 25.1115 +GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t );
 25.1116 +
 25.1117 +GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
 25.1118 +GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
 25.1119 +GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r );
 25.1120 +GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r );
 25.1121 +
 25.1122 +GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
 25.1123 +GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
 25.1124 +GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q );
 25.1125 +GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
 25.1126 +
 25.1127 +GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
 25.1128 +GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
 25.1129 +GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v );
 25.1130 +GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v );
 25.1131 +
 25.1132 +GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v );
 25.1133 +GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v );
 25.1134 +GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v );
 25.1135 +GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v );
 25.1136 +
 25.1137 +GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v );
 25.1138 +GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v );
 25.1139 +GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v );
 25.1140 +GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v );
 25.1141 +
 25.1142 +GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v );
 25.1143 +GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v );
 25.1144 +GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v );
 25.1145 +GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v );
 25.1146 +
 25.1147 +
 25.1148 +GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y );
 25.1149 +GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y );
 25.1150 +GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y );
 25.1151 +GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y );
 25.1152 +
 25.1153 +GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
 25.1154 +GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
 25.1155 +GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z );
 25.1156 +GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z );
 25.1157 +
 25.1158 +GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
 25.1159 +GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
 25.1160 +GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w );
 25.1161 +GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
 25.1162 +
 25.1163 +GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v );
 25.1164 +GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v );
 25.1165 +GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v );
 25.1166 +GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v );
 25.1167 +
 25.1168 +GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v );
 25.1169 +GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v );
 25.1170 +GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v );
 25.1171 +GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v );
 25.1172 +
 25.1173 +GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v );
 25.1174 +GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v );
 25.1175 +GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v );
 25.1176 +GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v );
 25.1177 +
 25.1178 +
 25.1179 +GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
 25.1180 +GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
 25.1181 +GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
 25.1182 +GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
 25.1183 +
 25.1184 +
 25.1185 +GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 );
 25.1186 +GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 );
 25.1187 +GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 );
 25.1188 +GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 );
 25.1189 +
 25.1190 +
 25.1191 +/*
 25.1192 + * Vertex Arrays  (1.1)
 25.1193 + */
 25.1194 +
 25.1195 +GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type,
 25.1196 +                                       GLsizei stride, const GLvoid *ptr );
 25.1197 +
 25.1198 +GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride,
 25.1199 +                                       const GLvoid *ptr );
 25.1200 +
 25.1201 +GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type,
 25.1202 +                                      GLsizei stride, const GLvoid *ptr );
 25.1203 +
 25.1204 +GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride,
 25.1205 +                                      const GLvoid *ptr );
 25.1206 +
 25.1207 +GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type,
 25.1208 +                                         GLsizei stride, const GLvoid *ptr );
 25.1209 +
 25.1210 +GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr );
 25.1211 +
 25.1212 +GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params );
 25.1213 +
 25.1214 +GLAPI void GLAPIENTRY glArrayElement( GLint i );
 25.1215 +
 25.1216 +GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
 25.1217 +
 25.1218 +GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count,
 25.1219 +                                      GLenum type, const GLvoid *indices );
 25.1220 +
 25.1221 +GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride,
 25.1222 +                                           const GLvoid *pointer );
 25.1223 +
 25.1224 +/*
 25.1225 + * Lighting
 25.1226 + */
 25.1227 +
 25.1228 +GLAPI void GLAPIENTRY glShadeModel( GLenum mode );
 25.1229 +
 25.1230 +GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param );
 25.1231 +GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param );
 25.1232 +GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname,
 25.1233 +                                 const GLfloat *params );
 25.1234 +GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname,
 25.1235 +                                 const GLint *params );
 25.1236 +
 25.1237 +GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname,
 25.1238 +                                    GLfloat *params );
 25.1239 +GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname,
 25.1240 +                                    GLint *params );
 25.1241 +
 25.1242 +GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param );
 25.1243 +GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param );
 25.1244 +GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params );
 25.1245 +GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params );
 25.1246 +
 25.1247 +GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
 25.1248 +GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param );
 25.1249 +GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
 25.1250 +GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params );
 25.1251 +
 25.1252 +GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
 25.1253 +GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params );
 25.1254 +
 25.1255 +GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode );
 25.1256 +
 25.1257 +
 25.1258 +/*
 25.1259 + * Raster functions
 25.1260 + */
 25.1261 +
 25.1262 +GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor );
 25.1263 +
 25.1264 +GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param );
 25.1265 +GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param );
 25.1266 +
 25.1267 +GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param );
 25.1268 +GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param );
 25.1269 +
 25.1270 +GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize,
 25.1271 +                                    const GLfloat *values );
 25.1272 +GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize,
 25.1273 +                                     const GLuint *values );
 25.1274 +GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize,
 25.1275 +                                     const GLushort *values );
 25.1276 +
 25.1277 +GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values );
 25.1278 +GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values );
 25.1279 +GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values );
 25.1280 +
 25.1281 +GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height,
 25.1282 +                                GLfloat xorig, GLfloat yorig,
 25.1283 +                                GLfloat xmove, GLfloat ymove,
 25.1284 +                                const GLubyte *bitmap );
 25.1285 +
 25.1286 +GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y,
 25.1287 +                                    GLsizei width, GLsizei height,
 25.1288 +                                    GLenum format, GLenum type,
 25.1289 +                                    GLvoid *pixels );
 25.1290 +
 25.1291 +GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height,
 25.1292 +                                    GLenum format, GLenum type,
 25.1293 +                                    const GLvoid *pixels );
 25.1294 +
 25.1295 +GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y,
 25.1296 +                                    GLsizei width, GLsizei height,
 25.1297 +                                    GLenum type );
 25.1298 +
 25.1299 +/*
 25.1300 + * Stenciling
 25.1301 + */
 25.1302 +
 25.1303 +GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask );
 25.1304 +
 25.1305 +GLAPI void GLAPIENTRY glStencilMask( GLuint mask );
 25.1306 +
 25.1307 +GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
 25.1308 +
 25.1309 +GLAPI void GLAPIENTRY glClearStencil( GLint s );
 25.1310 +
 25.1311 +
 25.1312 +
 25.1313 +/*
 25.1314 + * Texture mapping
 25.1315 + */
 25.1316 +
 25.1317 +GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param );
 25.1318 +GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param );
 25.1319 +GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param );
 25.1320 +
 25.1321 +GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params );
 25.1322 +GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
 25.1323 +GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params );
 25.1324 +
 25.1325 +GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
 25.1326 +GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
 25.1327 +GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
 25.1328 +
 25.1329 +
 25.1330 +GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
 25.1331 +GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param );
 25.1332 +
 25.1333 +GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
 25.1334 +GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params );
 25.1335 +
 25.1336 +GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
 25.1337 +GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params );
 25.1338 +
 25.1339 +
 25.1340 +GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param );
 25.1341 +GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
 25.1342 +
 25.1343 +GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname,
 25.1344 +                                          const GLfloat *params );
 25.1345 +GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname,
 25.1346 +                                          const GLint *params );
 25.1347 +
 25.1348 +GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target,
 25.1349 +                                           GLenum pname, GLfloat *params);
 25.1350 +GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target,
 25.1351 +                                           GLenum pname, GLint *params );
 25.1352 +
 25.1353 +GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level,
 25.1354 +                                                GLenum pname, GLfloat *params );
 25.1355 +GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level,
 25.1356 +                                                GLenum pname, GLint *params );
 25.1357 +
 25.1358 +
 25.1359 +GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level,
 25.1360 +                                    GLint internalFormat,
 25.1361 +                                    GLsizei width, GLint border,
 25.1362 +                                    GLenum format, GLenum type,
 25.1363 +                                    const GLvoid *pixels );
 25.1364 +
 25.1365 +GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level,
 25.1366 +                                    GLint internalFormat,
 25.1367 +                                    GLsizei width, GLsizei height,
 25.1368 +                                    GLint border, GLenum format, GLenum type,
 25.1369 +                                    const GLvoid *pixels );
 25.1370 +
 25.1371 +GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level,
 25.1372 +                                     GLenum format, GLenum type,
 25.1373 +                                     GLvoid *pixels );
 25.1374 +
 25.1375 +
 25.1376 +/* 1.1 functions */
 25.1377 +
 25.1378 +GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures );
 25.1379 +
 25.1380 +GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures);
 25.1381 +
 25.1382 +GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture );
 25.1383 +
 25.1384 +GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n,
 25.1385 +                                            const GLuint *textures,
 25.1386 +                                            const GLclampf *priorities );
 25.1387 +
 25.1388 +GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n,
 25.1389 +                                                  const GLuint *textures,
 25.1390 +                                                  GLboolean *residences );
 25.1391 +
 25.1392 +GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture );
 25.1393 +
 25.1394 +
 25.1395 +GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level,
 25.1396 +                                       GLint xoffset,
 25.1397 +                                       GLsizei width, GLenum format,
 25.1398 +                                       GLenum type, const GLvoid *pixels );
 25.1399 +
 25.1400 +
 25.1401 +GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level,
 25.1402 +                                       GLint xoffset, GLint yoffset,
 25.1403 +                                       GLsizei width, GLsizei height,
 25.1404 +                                       GLenum format, GLenum type,
 25.1405 +                                       const GLvoid *pixels );
 25.1406 +
 25.1407 +
 25.1408 +GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level,
 25.1409 +                                        GLenum internalformat,
 25.1410 +                                        GLint x, GLint y,
 25.1411 +                                        GLsizei width, GLint border );
 25.1412 +
 25.1413 +
 25.1414 +GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level,
 25.1415 +                                        GLenum internalformat,
 25.1416 +                                        GLint x, GLint y,
 25.1417 +                                        GLsizei width, GLsizei height,
 25.1418 +                                        GLint border );
 25.1419 +
 25.1420 +
 25.1421 +GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level,
 25.1422 +                                           GLint xoffset, GLint x, GLint y,
 25.1423 +                                           GLsizei width );
 25.1424 +
 25.1425 +
 25.1426 +GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level,
 25.1427 +                                           GLint xoffset, GLint yoffset,
 25.1428 +                                           GLint x, GLint y,
 25.1429 +                                           GLsizei width, GLsizei height );
 25.1430 +
 25.1431 +
 25.1432 +/*
 25.1433 + * Evaluators
 25.1434 + */
 25.1435 +
 25.1436 +GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2,
 25.1437 +                               GLint stride,
 25.1438 +                               GLint order, const GLdouble *points );
 25.1439 +GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2,
 25.1440 +                               GLint stride,
 25.1441 +                               GLint order, const GLfloat *points );
 25.1442 +
 25.1443 +GLAPI void GLAPIENTRY glMap2d( GLenum target,
 25.1444 +		     GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
 25.1445 +		     GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
 25.1446 +		     const GLdouble *points );
 25.1447 +GLAPI void GLAPIENTRY glMap2f( GLenum target,
 25.1448 +		     GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
 25.1449 +		     GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
 25.1450 +		     const GLfloat *points );
 25.1451 +
 25.1452 +GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v );
 25.1453 +GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v );
 25.1454 +GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v );
 25.1455 +
 25.1456 +GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u );
 25.1457 +GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u );
 25.1458 +
 25.1459 +GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u );
 25.1460 +GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u );
 25.1461 +
 25.1462 +GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v );
 25.1463 +GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v );
 25.1464 +
 25.1465 +GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u );
 25.1466 +GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u );
 25.1467 +
 25.1468 +GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
 25.1469 +GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
 25.1470 +
 25.1471 +GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2,
 25.1472 +                                   GLint vn, GLdouble v1, GLdouble v2 );
 25.1473 +GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2,
 25.1474 +                                   GLint vn, GLfloat v1, GLfloat v2 );
 25.1475 +
 25.1476 +GLAPI void GLAPIENTRY glEvalPoint1( GLint i );
 25.1477 +
 25.1478 +GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j );
 25.1479 +
 25.1480 +GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 );
 25.1481 +
 25.1482 +GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
 25.1483 +
 25.1484 +
 25.1485 +/*
 25.1486 + * Fog
 25.1487 + */
 25.1488 +
 25.1489 +GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param );
 25.1490 +
 25.1491 +GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param );
 25.1492 +
 25.1493 +GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params );
 25.1494 +
 25.1495 +GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params );
 25.1496 +
 25.1497 +
 25.1498 +/*
 25.1499 + * Selection and Feedback
 25.1500 + */
 25.1501 +
 25.1502 +GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
 25.1503 +
 25.1504 +GLAPI void GLAPIENTRY glPassThrough( GLfloat token );
 25.1505 +
 25.1506 +GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer );
 25.1507 +
 25.1508 +GLAPI void GLAPIENTRY glInitNames( void );
 25.1509 +
 25.1510 +GLAPI void GLAPIENTRY glLoadName( GLuint name );
 25.1511 +
 25.1512 +GLAPI void GLAPIENTRY glPushName( GLuint name );
 25.1513 +
 25.1514 +GLAPI void GLAPIENTRY glPopName( void );
 25.1515 +
 25.1516 +
 25.1517 +
 25.1518 +/*
 25.1519 + * OpenGL 1.2
 25.1520 + */
 25.1521 +
 25.1522 +#define GL_RESCALE_NORMAL			0x803A
 25.1523 +#define GL_CLAMP_TO_EDGE			0x812F
 25.1524 +#define GL_MAX_ELEMENTS_VERTICES		0x80E8
 25.1525 +#define GL_MAX_ELEMENTS_INDICES			0x80E9
 25.1526 +#define GL_BGR					0x80E0
 25.1527 +#define GL_BGRA					0x80E1
 25.1528 +#define GL_UNSIGNED_BYTE_3_3_2			0x8032
 25.1529 +#define GL_UNSIGNED_BYTE_2_3_3_REV		0x8362
 25.1530 +#define GL_UNSIGNED_SHORT_5_6_5			0x8363
 25.1531 +#define GL_UNSIGNED_SHORT_5_6_5_REV		0x8364
 25.1532 +#define GL_UNSIGNED_SHORT_4_4_4_4		0x8033
 25.1533 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV		0x8365
 25.1534 +#define GL_UNSIGNED_SHORT_5_5_5_1		0x8034
 25.1535 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV		0x8366
 25.1536 +#define GL_UNSIGNED_INT_8_8_8_8			0x8035
 25.1537 +#define GL_UNSIGNED_INT_8_8_8_8_REV		0x8367
 25.1538 +#define GL_UNSIGNED_INT_10_10_10_2		0x8036
 25.1539 +#define GL_UNSIGNED_INT_2_10_10_10_REV		0x8368
 25.1540 +#define GL_LIGHT_MODEL_COLOR_CONTROL		0x81F8
 25.1541 +#define GL_SINGLE_COLOR				0x81F9
 25.1542 +#define GL_SEPARATE_SPECULAR_COLOR		0x81FA
 25.1543 +#define GL_TEXTURE_MIN_LOD			0x813A
 25.1544 +#define GL_TEXTURE_MAX_LOD			0x813B
 25.1545 +#define GL_TEXTURE_BASE_LEVEL			0x813C
 25.1546 +#define GL_TEXTURE_MAX_LEVEL			0x813D
 25.1547 +#define GL_SMOOTH_POINT_SIZE_RANGE		0x0B12
 25.1548 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY	0x0B13
 25.1549 +#define GL_SMOOTH_LINE_WIDTH_RANGE		0x0B22
 25.1550 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY	0x0B23
 25.1551 +#define GL_ALIASED_POINT_SIZE_RANGE		0x846D
 25.1552 +#define GL_ALIASED_LINE_WIDTH_RANGE		0x846E
 25.1553 +#define GL_PACK_SKIP_IMAGES			0x806B
 25.1554 +#define GL_PACK_IMAGE_HEIGHT			0x806C
 25.1555 +#define GL_UNPACK_SKIP_IMAGES			0x806D
 25.1556 +#define GL_UNPACK_IMAGE_HEIGHT			0x806E
 25.1557 +#define GL_TEXTURE_3D				0x806F
 25.1558 +#define GL_PROXY_TEXTURE_3D			0x8070
 25.1559 +#define GL_TEXTURE_DEPTH			0x8071
 25.1560 +#define GL_TEXTURE_WRAP_R			0x8072
 25.1561 +#define GL_MAX_3D_TEXTURE_SIZE			0x8073
 25.1562 +#define GL_TEXTURE_BINDING_3D			0x806A
 25.1563 +
 25.1564 +GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start,
 25.1565 +	GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
 25.1566 +
 25.1567 +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
 25.1568 +                                      GLint internalFormat,
 25.1569 +                                      GLsizei width, GLsizei height,
 25.1570 +                                      GLsizei depth, GLint border,
 25.1571 +                                      GLenum format, GLenum type,
 25.1572 +                                      const GLvoid *pixels );
 25.1573 +
 25.1574 +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
 25.1575 +                                         GLint xoffset, GLint yoffset,
 25.1576 +                                         GLint zoffset, GLsizei width,
 25.1577 +                                         GLsizei height, GLsizei depth,
 25.1578 +                                         GLenum format,
 25.1579 +                                         GLenum type, const GLvoid *pixels);
 25.1580 +
 25.1581 +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
 25.1582 +                                             GLint xoffset, GLint yoffset,
 25.1583 +                                             GLint zoffset, GLint x,
 25.1584 +                                             GLint y, GLsizei width,
 25.1585 +                                             GLsizei height );
 25.1586 +
 25.1587 +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
 25.1588 +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
 25.1589 +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
 25.1590 +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
 25.1591 +
 25.1592 +
 25.1593 +/*
 25.1594 + * GL_ARB_imaging
 25.1595 + */
 25.1596 +
 25.1597 +#define GL_CONSTANT_COLOR			0x8001
 25.1598 +#define GL_ONE_MINUS_CONSTANT_COLOR		0x8002
 25.1599 +#define GL_CONSTANT_ALPHA			0x8003
 25.1600 +#define GL_ONE_MINUS_CONSTANT_ALPHA		0x8004
 25.1601 +#define GL_COLOR_TABLE				0x80D0
 25.1602 +#define GL_POST_CONVOLUTION_COLOR_TABLE		0x80D1
 25.1603 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE	0x80D2
 25.1604 +#define GL_PROXY_COLOR_TABLE			0x80D3
 25.1605 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE	0x80D4
 25.1606 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE	0x80D5
 25.1607 +#define GL_COLOR_TABLE_SCALE			0x80D6
 25.1608 +#define GL_COLOR_TABLE_BIAS			0x80D7
 25.1609 +#define GL_COLOR_TABLE_FORMAT			0x80D8
 25.1610 +#define GL_COLOR_TABLE_WIDTH			0x80D9
 25.1611 +#define GL_COLOR_TABLE_RED_SIZE			0x80DA
 25.1612 +#define GL_COLOR_TABLE_GREEN_SIZE		0x80DB
 25.1613 +#define GL_COLOR_TABLE_BLUE_SIZE		0x80DC
 25.1614 +#define GL_COLOR_TABLE_ALPHA_SIZE		0x80DD
 25.1615 +#define GL_COLOR_TABLE_LUMINANCE_SIZE		0x80DE
 25.1616 +#define GL_COLOR_TABLE_INTENSITY_SIZE		0x80DF
 25.1617 +#define GL_CONVOLUTION_1D			0x8010
 25.1618 +#define GL_CONVOLUTION_2D			0x8011
 25.1619 +#define GL_SEPARABLE_2D				0x8012
 25.1620 +#define GL_CONVOLUTION_BORDER_MODE		0x8013
 25.1621 +#define GL_CONVOLUTION_FILTER_SCALE		0x8014
 25.1622 +#define GL_CONVOLUTION_FILTER_BIAS		0x8015
 25.1623 +#define GL_REDUCE				0x8016
 25.1624 +#define GL_CONVOLUTION_FORMAT			0x8017
 25.1625 +#define GL_CONVOLUTION_WIDTH			0x8018
 25.1626 +#define GL_CONVOLUTION_HEIGHT			0x8019
 25.1627 +#define GL_MAX_CONVOLUTION_WIDTH		0x801A
 25.1628 +#define GL_MAX_CONVOLUTION_HEIGHT		0x801B
 25.1629 +#define GL_POST_CONVOLUTION_RED_SCALE		0x801C
 25.1630 +#define GL_POST_CONVOLUTION_GREEN_SCALE		0x801D
 25.1631 +#define GL_POST_CONVOLUTION_BLUE_SCALE		0x801E
 25.1632 +#define GL_POST_CONVOLUTION_ALPHA_SCALE		0x801F
 25.1633 +#define GL_POST_CONVOLUTION_RED_BIAS		0x8020
 25.1634 +#define GL_POST_CONVOLUTION_GREEN_BIAS		0x8021
 25.1635 +#define GL_POST_CONVOLUTION_BLUE_BIAS		0x8022
 25.1636 +#define GL_POST_CONVOLUTION_ALPHA_BIAS		0x8023
 25.1637 +#define GL_CONSTANT_BORDER			0x8151
 25.1638 +#define GL_REPLICATE_BORDER			0x8153
 25.1639 +#define GL_CONVOLUTION_BORDER_COLOR		0x8154
 25.1640 +#define GL_COLOR_MATRIX				0x80B1
 25.1641 +#define GL_COLOR_MATRIX_STACK_DEPTH		0x80B2
 25.1642 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH		0x80B3
 25.1643 +#define GL_POST_COLOR_MATRIX_RED_SCALE		0x80B4
 25.1644 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE	0x80B5
 25.1645 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE		0x80B6
 25.1646 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE	0x80B7
 25.1647 +#define GL_POST_COLOR_MATRIX_RED_BIAS		0x80B8
 25.1648 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS		0x80B9
 25.1649 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS		0x80BA
 25.1650 +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS		0x80BB
 25.1651 +#define GL_HISTOGRAM				0x8024
 25.1652 +#define GL_PROXY_HISTOGRAM			0x8025
 25.1653 +#define GL_HISTOGRAM_WIDTH			0x8026
 25.1654 +#define GL_HISTOGRAM_FORMAT			0x8027
 25.1655 +#define GL_HISTOGRAM_RED_SIZE			0x8028
 25.1656 +#define GL_HISTOGRAM_GREEN_SIZE			0x8029
 25.1657 +#define GL_HISTOGRAM_BLUE_SIZE			0x802A
 25.1658 +#define GL_HISTOGRAM_ALPHA_SIZE			0x802B
 25.1659 +#define GL_HISTOGRAM_LUMINANCE_SIZE		0x802C
 25.1660 +#define GL_HISTOGRAM_SINK			0x802D
 25.1661 +#define GL_MINMAX				0x802E
 25.1662 +#define GL_MINMAX_FORMAT			0x802F
 25.1663 +#define GL_MINMAX_SINK				0x8030
 25.1664 +#define GL_TABLE_TOO_LARGE			0x8031
 25.1665 +#define GL_BLEND_EQUATION			0x8009
 25.1666 +#define GL_MIN					0x8007
 25.1667 +#define GL_MAX					0x8008
 25.1668 +#define GL_FUNC_ADD				0x8006
 25.1669 +#define GL_FUNC_SUBTRACT			0x800A
 25.1670 +#define GL_FUNC_REVERSE_SUBTRACT		0x800B
 25.1671 +#define GL_BLEND_COLOR				0x8005
 25.1672 +
 25.1673 +
 25.1674 +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
 25.1675 +                                    GLsizei width, GLenum format,
 25.1676 +                                    GLenum type, const GLvoid *table );
 25.1677 +
 25.1678 +GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
 25.1679 +                                       GLsizei start, GLsizei count,
 25.1680 +                                       GLenum format, GLenum type,
 25.1681 +                                       const GLvoid *data );
 25.1682 +
 25.1683 +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
 25.1684 +                                              const GLint *params);
 25.1685 +
 25.1686 +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
 25.1687 +                                              const GLfloat *params);
 25.1688 +
 25.1689 +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
 25.1690 +                                           GLint x, GLint y, GLsizei width );
 25.1691 +
 25.1692 +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
 25.1693 +                                        GLint x, GLint y, GLsizei width );
 25.1694 +
 25.1695 +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
 25.1696 +                                       GLenum type, GLvoid *table );
 25.1697 +
 25.1698 +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
 25.1699 +                                                  GLfloat *params );
 25.1700 +
 25.1701 +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
 25.1702 +                                                  GLint *params );
 25.1703 +
 25.1704 +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
 25.1705 +
 25.1706 +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
 25.1707 +                                    GLclampf blue, GLclampf alpha );
 25.1708 +
 25.1709 +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
 25.1710 +				   GLenum internalformat, GLboolean sink );
 25.1711 +
 25.1712 +GLAPI void GLAPIENTRY glResetHistogram( GLenum target );
 25.1713 +
 25.1714 +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
 25.1715 +				      GLenum format, GLenum type,
 25.1716 +				      GLvoid *values );
 25.1717 +
 25.1718 +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
 25.1719 +						 GLfloat *params );
 25.1720 +
 25.1721 +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
 25.1722 +						 GLint *params );
 25.1723 +
 25.1724 +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
 25.1725 +				GLboolean sink );
 25.1726 +
 25.1727 +GLAPI void GLAPIENTRY glResetMinmax( GLenum target );
 25.1728 +
 25.1729 +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
 25.1730 +                                   GLenum format, GLenum types,
 25.1731 +                                   GLvoid *values );
 25.1732 +
 25.1733 +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
 25.1734 +					      GLfloat *params );
 25.1735 +
 25.1736 +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
 25.1737 +					      GLint *params );
 25.1738 +
 25.1739 +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
 25.1740 +	GLenum internalformat, GLsizei width, GLenum format, GLenum type,
 25.1741 +	const GLvoid *image );
 25.1742 +
 25.1743 +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
 25.1744 +	GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
 25.1745 +	GLenum type, const GLvoid *image );
 25.1746 +
 25.1747 +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
 25.1748 +	GLfloat params );
 25.1749 +
 25.1750 +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
 25.1751 +	const GLfloat *params );
 25.1752 +
 25.1753 +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
 25.1754 +	GLint params );
 25.1755 +
 25.1756 +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
 25.1757 +	const GLint *params );
 25.1758 +
 25.1759 +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
 25.1760 +	GLenum internalformat, GLint x, GLint y, GLsizei width );
 25.1761 +
 25.1762 +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
 25.1763 +	GLenum internalformat, GLint x, GLint y, GLsizei width,
 25.1764 +	GLsizei height);
 25.1765 +
 25.1766 +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
 25.1767 +	GLenum type, GLvoid *image );
 25.1768 +
 25.1769 +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
 25.1770 +	GLfloat *params );
 25.1771 +
 25.1772 +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
 25.1773 +	GLint *params );
 25.1774 +
 25.1775 +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
 25.1776 +	GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
 25.1777 +	GLenum type, const GLvoid *row, const GLvoid *column );
 25.1778 +
 25.1779 +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
 25.1780 +	GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
 25.1781 +
 25.1782 +
 25.1783 +
 25.1784 +
 25.1785 +/*
 25.1786 + * OpenGL 1.3
 25.1787 + */
 25.1788 +
 25.1789 +/* multitexture */
 25.1790 +#define GL_TEXTURE0				0x84C0
 25.1791 +#define GL_TEXTURE1				0x84C1
 25.1792 +#define GL_TEXTURE2				0x84C2
 25.1793 +#define GL_TEXTURE3				0x84C3
 25.1794 +#define GL_TEXTURE4				0x84C4
 25.1795 +#define GL_TEXTURE5				0x84C5
 25.1796 +#define GL_TEXTURE6				0x84C6
 25.1797 +#define GL_TEXTURE7				0x84C7
 25.1798 +#define GL_TEXTURE8				0x84C8
 25.1799 +#define GL_TEXTURE9				0x84C9
 25.1800 +#define GL_TEXTURE10				0x84CA
 25.1801 +#define GL_TEXTURE11				0x84CB
 25.1802 +#define GL_TEXTURE12				0x84CC
 25.1803 +#define GL_TEXTURE13				0x84CD
 25.1804 +#define GL_TEXTURE14				0x84CE
 25.1805 +#define GL_TEXTURE15				0x84CF
 25.1806 +#define GL_TEXTURE16				0x84D0
 25.1807 +#define GL_TEXTURE17				0x84D1
 25.1808 +#define GL_TEXTURE18				0x84D2
 25.1809 +#define GL_TEXTURE19				0x84D3
 25.1810 +#define GL_TEXTURE20				0x84D4
 25.1811 +#define GL_TEXTURE21				0x84D5
 25.1812 +#define GL_TEXTURE22				0x84D6
 25.1813 +#define GL_TEXTURE23				0x84D7
 25.1814 +#define GL_TEXTURE24				0x84D8
 25.1815 +#define GL_TEXTURE25				0x84D9
 25.1816 +#define GL_TEXTURE26				0x84DA
 25.1817 +#define GL_TEXTURE27				0x84DB
 25.1818 +#define GL_TEXTURE28				0x84DC
 25.1819 +#define GL_TEXTURE29				0x84DD
 25.1820 +#define GL_TEXTURE30				0x84DE
 25.1821 +#define GL_TEXTURE31				0x84DF
 25.1822 +#define GL_ACTIVE_TEXTURE			0x84E0
 25.1823 +#define GL_CLIENT_ACTIVE_TEXTURE		0x84E1
 25.1824 +#define GL_MAX_TEXTURE_UNITS			0x84E2
 25.1825 +/* texture_cube_map */
 25.1826 +#define GL_NORMAL_MAP				0x8511
 25.1827 +#define GL_REFLECTION_MAP			0x8512
 25.1828 +#define GL_TEXTURE_CUBE_MAP			0x8513
 25.1829 +#define GL_TEXTURE_BINDING_CUBE_MAP		0x8514
 25.1830 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X		0x8515
 25.1831 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X		0x8516
 25.1832 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y		0x8517
 25.1833 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y		0x8518
 25.1834 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z		0x8519
 25.1835 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z		0x851A
 25.1836 +#define GL_PROXY_TEXTURE_CUBE_MAP		0x851B
 25.1837 +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE		0x851C
 25.1838 +/* texture_compression */
 25.1839 +#define GL_COMPRESSED_ALPHA			0x84E9
 25.1840 +#define GL_COMPRESSED_LUMINANCE			0x84EA
 25.1841 +#define GL_COMPRESSED_LUMINANCE_ALPHA		0x84EB
 25.1842 +#define GL_COMPRESSED_INTENSITY			0x84EC
 25.1843 +#define GL_COMPRESSED_RGB			0x84ED
 25.1844 +#define GL_COMPRESSED_RGBA			0x84EE
 25.1845 +#define GL_TEXTURE_COMPRESSION_HINT		0x84EF
 25.1846 +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE	0x86A0
 25.1847 +#define GL_TEXTURE_COMPRESSED			0x86A1
 25.1848 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS	0x86A2
 25.1849 +#define GL_COMPRESSED_TEXTURE_FORMATS		0x86A3
 25.1850 +/* multisample */
 25.1851 +#define GL_MULTISAMPLE				0x809D
 25.1852 +#define GL_SAMPLE_ALPHA_TO_COVERAGE		0x809E
 25.1853 +#define GL_SAMPLE_ALPHA_TO_ONE			0x809F
 25.1854 +#define GL_SAMPLE_COVERAGE			0x80A0
 25.1855 +#define GL_SAMPLE_BUFFERS			0x80A8
 25.1856 +#define GL_SAMPLES				0x80A9
 25.1857 +#define GL_SAMPLE_COVERAGE_VALUE		0x80AA
 25.1858 +#define GL_SAMPLE_COVERAGE_INVERT		0x80AB
 25.1859 +#define GL_MULTISAMPLE_BIT			0x20000000
 25.1860 +/* transpose_matrix */
 25.1861 +#define GL_TRANSPOSE_MODELVIEW_MATRIX		0x84E3
 25.1862 +#define GL_TRANSPOSE_PROJECTION_MATRIX		0x84E4
 25.1863 +#define GL_TRANSPOSE_TEXTURE_MATRIX		0x84E5
 25.1864 +#define GL_TRANSPOSE_COLOR_MATRIX		0x84E6
 25.1865 +/* texture_env_combine */
 25.1866 +#define GL_COMBINE				0x8570
 25.1867 +#define GL_COMBINE_RGB				0x8571
 25.1868 +#define GL_COMBINE_ALPHA			0x8572
 25.1869 +#define GL_SOURCE0_RGB				0x8580
 25.1870 +#define GL_SOURCE1_RGB				0x8581
 25.1871 +#define GL_SOURCE2_RGB				0x8582
 25.1872 +#define GL_SOURCE0_ALPHA			0x8588
 25.1873 +#define GL_SOURCE1_ALPHA			0x8589
 25.1874 +#define GL_SOURCE2_ALPHA			0x858A
 25.1875 +#define GL_OPERAND0_RGB				0x8590
 25.1876 +#define GL_OPERAND1_RGB				0x8591
 25.1877 +#define GL_OPERAND2_RGB				0x8592
 25.1878 +#define GL_OPERAND0_ALPHA			0x8598
 25.1879 +#define GL_OPERAND1_ALPHA			0x8599
 25.1880 +#define GL_OPERAND2_ALPHA			0x859A
 25.1881 +#define GL_RGB_SCALE				0x8573
 25.1882 +#define GL_ADD_SIGNED				0x8574
 25.1883 +#define GL_INTERPOLATE				0x8575
 25.1884 +#define GL_SUBTRACT				0x84E7
 25.1885 +#define GL_CONSTANT				0x8576
 25.1886 +#define GL_PRIMARY_COLOR			0x8577
 25.1887 +#define GL_PREVIOUS				0x8578
 25.1888 +/* texture_env_dot3 */
 25.1889 +#define GL_DOT3_RGB				0x86AE
 25.1890 +#define GL_DOT3_RGBA				0x86AF
 25.1891 +/* texture_border_clamp */
 25.1892 +#define GL_CLAMP_TO_BORDER			0x812D
 25.1893 +
 25.1894 +GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
 25.1895 +
 25.1896 +GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
 25.1897 +
 25.1898 +GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
 25.1899 +
 25.1900 +GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
 25.1901 +
 25.1902 +GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
 25.1903 +
 25.1904 +GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
 25.1905 +
 25.1906 +GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
 25.1907 +
 25.1908 +GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
 25.1909 +
 25.1910 +GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
 25.1911 +
 25.1912 +GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
 25.1913 +
 25.1914 +GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
 25.1915 +
 25.1916 +GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
 25.1917 +
 25.1918 +GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
 25.1919 +
 25.1920 +GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
 25.1921 +
 25.1922 +GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
 25.1923 +
 25.1924 +GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
 25.1925 +
 25.1926 +GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
 25.1927 +
 25.1928 +GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
 25.1929 +
 25.1930 +GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
 25.1931 +
 25.1932 +GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
 25.1933 +
 25.1934 +GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
 25.1935 +
 25.1936 +GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
 25.1937 +
 25.1938 +GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
 25.1939 +
 25.1940 +GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
 25.1941 +
 25.1942 +GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
 25.1943 +
 25.1944 +GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
 25.1945 +
 25.1946 +GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
 25.1947 +
 25.1948 +GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
 25.1949 +
 25.1950 +GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
 25.1951 +
 25.1952 +GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
 25.1953 +
 25.1954 +GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
 25.1955 +
 25.1956 +GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
 25.1957 +
 25.1958 +GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
 25.1959 +
 25.1960 +GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
 25.1961 +
 25.1962 +GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
 25.1963 +
 25.1964 +GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
 25.1965 +
 25.1966 +GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
 25.1967 +
 25.1968 +GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
 25.1969 +
 25.1970 +GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
 25.1971 +
 25.1972 +GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
 25.1973 +
 25.1974 +GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
 25.1975 +
 25.1976 +
 25.1977 +GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
 25.1978 +
 25.1979 +GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
 25.1980 +
 25.1981 +GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
 25.1982 +
 25.1983 +GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
 25.1984 +
 25.1985 +GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
 25.1986 +
 25.1987 +
 25.1988 +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
 25.1989 +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
 25.1990 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
 25.1991 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
 25.1992 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
 25.1993 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
 25.1994 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
 25.1995 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
 25.1996 +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
 25.1997 +
 25.1998 +
 25.1999 +
 25.2000 +/*
 25.2001 + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
 25.2002 + */
 25.2003 +#ifndef GL_ARB_multitexture
 25.2004 +#define GL_ARB_multitexture 1
 25.2005 +
 25.2006 +#define GL_TEXTURE0_ARB				0x84C0
 25.2007 +#define GL_TEXTURE1_ARB				0x84C1
 25.2008 +#define GL_TEXTURE2_ARB				0x84C2
 25.2009 +#define GL_TEXTURE3_ARB				0x84C3
 25.2010 +#define GL_TEXTURE4_ARB				0x84C4
 25.2011 +#define GL_TEXTURE5_ARB				0x84C5
 25.2012 +#define GL_TEXTURE6_ARB				0x84C6
 25.2013 +#define GL_TEXTURE7_ARB				0x84C7
 25.2014 +#define GL_TEXTURE8_ARB				0x84C8
 25.2015 +#define GL_TEXTURE9_ARB				0x84C9
 25.2016 +#define GL_TEXTURE10_ARB			0x84CA
 25.2017 +#define GL_TEXTURE11_ARB			0x84CB
 25.2018 +#define GL_TEXTURE12_ARB			0x84CC
 25.2019 +#define GL_TEXTURE13_ARB			0x84CD
 25.2020 +#define GL_TEXTURE14_ARB			0x84CE
 25.2021 +#define GL_TEXTURE15_ARB			0x84CF
 25.2022 +#define GL_TEXTURE16_ARB			0x84D0
 25.2023 +#define GL_TEXTURE17_ARB			0x84D1
 25.2024 +#define GL_TEXTURE18_ARB			0x84D2
 25.2025 +#define GL_TEXTURE19_ARB			0x84D3
 25.2026 +#define GL_TEXTURE20_ARB			0x84D4
 25.2027 +#define GL_TEXTURE21_ARB			0x84D5
 25.2028 +#define GL_TEXTURE22_ARB			0x84D6
 25.2029 +#define GL_TEXTURE23_ARB			0x84D7
 25.2030 +#define GL_TEXTURE24_ARB			0x84D8
 25.2031 +#define GL_TEXTURE25_ARB			0x84D9
 25.2032 +#define GL_TEXTURE26_ARB			0x84DA
 25.2033 +#define GL_TEXTURE27_ARB			0x84DB
 25.2034 +#define GL_TEXTURE28_ARB			0x84DC
 25.2035 +#define GL_TEXTURE29_ARB			0x84DD
 25.2036 +#define GL_TEXTURE30_ARB			0x84DE
 25.2037 +#define GL_TEXTURE31_ARB			0x84DF
 25.2038 +#define GL_ACTIVE_TEXTURE_ARB			0x84E0
 25.2039 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB		0x84E1
 25.2040 +#define GL_MAX_TEXTURE_UNITS_ARB		0x84E2
 25.2041 +
 25.2042 +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
 25.2043 +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture);
 25.2044 +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s);
 25.2045 +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v);
 25.2046 +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s);
 25.2047 +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v);
 25.2048 +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s);
 25.2049 +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v);
 25.2050 +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s);
 25.2051 +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v);
 25.2052 +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
 25.2053 +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v);
 25.2054 +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
 25.2055 +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v);
 25.2056 +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
 25.2057 +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v);
 25.2058 +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
 25.2059 +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v);
 25.2060 +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
 25.2061 +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v);
 25.2062 +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
 25.2063 +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v);
 25.2064 +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
 25.2065 +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v);
 25.2066 +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
 25.2067 +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v);
 25.2068 +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
 25.2069 +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v);
 25.2070 +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
 25.2071 +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v);
 25.2072 +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
 25.2073 +GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
 25.2074 +GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
 25.2075 +GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
 25.2076 +
 25.2077 +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
 25.2078 +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
 25.2079 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
 25.2080 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
 25.2081 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
 25.2082 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
 25.2083 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
 25.2084 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
 25.2085 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
 25.2086 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
 25.2087 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
 25.2088 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
 25.2089 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
 25.2090 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
 25.2091 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
 25.2092 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
 25.2093 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
 25.2094 +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
 25.2095 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
 25.2096 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
 25.2097 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
 25.2098 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
 25.2099 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
 25.2100 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
 25.2101 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
 25.2102 +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
 25.2103 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
 25.2104 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
 25.2105 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
 25.2106 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
 25.2107 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
 25.2108 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
 25.2109 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
 25.2110 +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
 25.2111 +
 25.2112 +#endif /* GL_ARB_multitexture */
 25.2113 +
 25.2114 +
 25.2115 +
 25.2116 +/*
 25.2117 + * Define this token if you want "old-style" header file behaviour (extensions
 25.2118 + * defined in gl.h).  Otherwise, extensions will be included from glext.h.
 25.2119 + */
 25.2120  #if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
 25.2121  #include "SDL_opengl_glext.h"
 25.2122 -#endif /* NO_SDL_GLEXT */
 25.2123 +#endif  /* GL_GLEXT_LEGACY */
 25.2124 +
 25.2125 +
 25.2126 +
 25.2127 +/*
 25.2128 + * ???. GL_MESA_packed_depth_stencil
 25.2129 + * XXX obsolete
 25.2130 + */
 25.2131 +#ifndef GL_MESA_packed_depth_stencil
 25.2132 +#define GL_MESA_packed_depth_stencil 1
 25.2133 +
 25.2134 +#define GL_DEPTH_STENCIL_MESA			0x8750
 25.2135 +#define GL_UNSIGNED_INT_24_8_MESA		0x8751
 25.2136 +#define GL_UNSIGNED_INT_8_24_REV_MESA		0x8752
 25.2137 +#define GL_UNSIGNED_SHORT_15_1_MESA		0x8753
 25.2138 +#define GL_UNSIGNED_SHORT_1_15_REV_MESA		0x8754
 25.2139 +
 25.2140 +#endif /* GL_MESA_packed_depth_stencil */
 25.2141 +
 25.2142 +
 25.2143 +#ifndef GL_ATI_blend_equation_separate
 25.2144 +#define GL_ATI_blend_equation_separate 1
 25.2145 +
 25.2146 +#define GL_ALPHA_BLEND_EQUATION_ATI	        0x883D
 25.2147 +
 25.2148 +GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA );
 25.2149 +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA);
 25.2150 +
 25.2151 +#endif /* GL_ATI_blend_equation_separate */
 25.2152 +
 25.2153 +
 25.2154 +/* GL_OES_EGL_image */
 25.2155 +#ifndef GL_OES_EGL_image
 25.2156 +typedef void* GLeglImageOES;
 25.2157 +#endif
 25.2158 +
 25.2159 +#ifndef GL_OES_EGL_image
 25.2160 +#define GL_OES_EGL_image 1
 25.2161 +#ifdef GL_GLEXT_PROTOTYPES
 25.2162 +GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
 25.2163 +GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
 25.2164 +#endif
 25.2165 +typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
 25.2166 +typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
 25.2167 +#endif
 25.2168 +
 25.2169 +
 25.2170 +/**
 25.2171 + ** NOTE!!!!!  If you add new functions to this file, or update
 25.2172 + ** glext.h be sure to regenerate the gl_mangle.h file.  See comments
 25.2173 + ** in that file for details.
 25.2174 + **/
 25.2175 +
 25.2176 +
 25.2177 +
 25.2178 +/**********************************************************************
 25.2179 + * Begin system-specific stuff
 25.2180 + */
 25.2181 +#if defined(PRAGMA_EXPORT_SUPPORTED)
 25.2182 +#pragma export off
 25.2183 +#endif
 25.2184 +
 25.2185 +/*
 25.2186 + * End system-specific stuff
 25.2187 + **********************************************************************/
 25.2188 +
 25.2189 +
 25.2190 +#ifdef __cplusplus
 25.2191 +}
 25.2192 +#endif
 25.2193 +
 25.2194 +#endif /* __gl_h_ */
 25.2195  
 25.2196  #endif /* !__IPHONEOS__ */
 25.2197  
    26.1 --- a/include/SDL_opengl_glext.h	Fri Aug 08 15:14:09 2014 -0300
    26.2 +++ b/include/SDL_opengl_glext.h	Wed Aug 20 17:20:22 2014 -0300
    26.3 @@ -465,8 +465,13 @@
    26.4  #ifndef GL_VERSION_1_5
    26.5  #define GL_VERSION_1_5 1
    26.6  #include <stddef.h>
    26.7 +#ifdef __MACOSX__
    26.8 +typedef long GLsizeiptr;
    26.9 +typedef long GLintptr;
   26.10 +#else
   26.11  typedef ptrdiff_t GLsizeiptr;
   26.12  typedef ptrdiff_t GLintptr;
   26.13 +#endif
   26.14  #define GL_BUFFER_SIZE                    0x8764
   26.15  #define GL_BUFFER_USAGE                   0x8765
   26.16  #define GL_QUERY_COUNTER_BITS             0x8864
    27.1 --- a/include/SDL_opengles2.h	Fri Aug 08 15:14:09 2014 -0300
    27.2 +++ b/include/SDL_opengles2.h	Wed Aug 20 17:20:22 2014 -0300
    27.3 @@ -20,7 +20,7 @@
    27.4  */
    27.5  
    27.6  /**
    27.7 - *  \file SDL_opengles.h
    27.8 + *  \file SDL_opengles2.h
    27.9   *
   27.10   *  This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
   27.11   */
    28.1 --- a/include/SDL_pixels.h	Fri Aug 08 15:14:09 2014 -0300
    28.2 +++ b/include/SDL_pixels.h	Wed Aug 20 17:20:22 2014 -0300
    28.3 @@ -248,7 +248,11 @@
    28.4      SDL_PIXELFORMAT_UYVY =      /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
    28.5          SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
    28.6      SDL_PIXELFORMAT_YVYU =      /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
    28.7 -        SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U')
    28.8 +        SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
    28.9 +    SDL_PIXELFORMAT_NV12 =      /**< Planar mode: Y + U/V interleaved  (2 planes) */
   28.10 +        SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
   28.11 +    SDL_PIXELFORMAT_NV21 =      /**< Planar mode: Y + V/U interleaved  (2 planes) */
   28.12 +        SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
   28.13  };
   28.14  
   28.15  typedef struct SDL_Color
    29.1 --- a/include/SDL_syswm.h	Fri Aug 08 15:14:09 2014 -0300
    29.2 +++ b/include/SDL_syswm.h	Wed Aug 20 17:20:22 2014 -0300
    29.3 @@ -208,20 +208,20 @@
    29.4  #if defined(SDL_VIDEO_DRIVER_COCOA)
    29.5          struct
    29.6          {
    29.7 -#if defined(__OBJC__) && __has_feature(objc_arc)
    29.8 -            NSWindow * __unsafe_unretained window; /* The Cocoa window */
    29.9 +#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
   29.10 +            NSWindow __unsafe_unretained *window; /* The Cocoa window */
   29.11  #else
   29.12 -            NSWindow *window;                      /* The Cocoa window */
   29.13 +            NSWindow *window;                     /* The Cocoa window */
   29.14  #endif
   29.15          } cocoa;
   29.16  #endif
   29.17  #if defined(SDL_VIDEO_DRIVER_UIKIT)
   29.18          struct
   29.19          {
   29.20 -#if defined(__OBJC__) && __has_feature(objc_arc)
   29.21 -            UIWindow * __unsafe_unretained window; /* The UIKit window */
   29.22 +#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
   29.23 +            UIWindow __unsafe_unretained *window; /* The UIKit window */
   29.24  #else
   29.25 -            UIWindow *window;                      /* The UIKit window */
   29.26 +            UIWindow *window;                     /* The UIKit window */
   29.27  #endif
   29.28          } uikit;
   29.29  #endif
    30.1 --- a/src/audio/xaudio2/SDL_xaudio2.c	Fri Aug 08 15:14:09 2014 -0300
    30.2 +++ b/src/audio/xaudio2/SDL_xaudio2.c	Wed Aug 20 17:20:22 2014 -0300
    30.3 @@ -58,7 +58,7 @@
    30.4  /* The configure script already did any necessary checking */
    30.5  #  define SDL_XAUDIO2_HAS_SDK 1
    30.6  #elif defined(__WINRT__)
    30.7 -/* WinRT always has access to the the XAudio 2 SDK */
    30.8 +/* WinRT always has access to the XAudio 2 SDK */
    30.9  #  define SDL_XAUDIO2_HAS_SDK
   30.10  #else
   30.11  /* XAudio2 exists as of the March 2008 DirectX SDK 
    31.1 --- a/src/core/linux/SDL_ibus.c	Fri Aug 08 15:14:09 2014 -0300
    31.2 +++ b/src/core/linux/SDL_ibus.c	Wed Aug 20 17:20:22 2014 -0300
    31.3 @@ -22,10 +22,16 @@
    31.4  
    31.5  #ifdef HAVE_IBUS_IBUS_H
    31.6  #include "SDL.h"
    31.7 +#include "SDL_syswm.h"
    31.8  #include "SDL_ibus.h"
    31.9  #include "SDL_dbus.h"
   31.10  #include "../../video/SDL_sysvideo.h"
   31.11  #include "../../events/SDL_keyboard_c.h"
   31.12 +
   31.13 +#if SDL_VIDEO_DRIVER_X11
   31.14 +    #include "../../video/x11/SDL_x11video.h"
   31.15 +#endif
   31.16 +
   31.17  #include <sys/inotify.h>
   31.18  #include <unistd.h>
   31.19  #include <fcntl.h>
   31.20 @@ -39,7 +45,7 @@
   31.21  static SDL_Rect ibus_cursor_rect = {0};
   31.22  static DBusConnection *ibus_conn = NULL;
   31.23  static char *ibus_addr_file = NULL;
   31.24 -int inotify_fd = -1;
   31.25 +int inotify_fd = -1, inotify_wd = -1;
   31.26  
   31.27  static Uint32
   31.28  IBus_ModState(void)
   31.29 @@ -160,8 +166,6 @@
   31.30                  i += sz;
   31.31                  cursor += chars;
   31.32              }
   31.33 -        } else {
   31.34 -            SDL_SendEditingText("", 0, 0);
   31.35          }
   31.36          
   31.37          SDL_IBus_UpdateTextRect(NULL);
   31.38 @@ -169,6 +173,11 @@
   31.39          return DBUS_HANDLER_RESULT_HANDLED;
   31.40      }
   31.41      
   31.42 +    if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")){
   31.43 +    	SDL_SendEditingText("", 0, 0);
   31.44 +    	return DBUS_HANDLER_RESULT_HANDLED;
   31.45 +    }
   31.46 +    
   31.47      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
   31.48  }
   31.49  
   31.50 @@ -279,6 +288,41 @@
   31.51      return SDL_strdup(file_path);
   31.52  }
   31.53  
   31.54 +static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus);
   31.55 +
   31.56 +static void
   31.57 +IBus_SetCapabilities(void *data, const char *name, const char *old_val,
   31.58 +                                                   const char *internal_editing)
   31.59 +{
   31.60 +    SDL_DBusContext *dbus = SDL_DBus_GetContext();
   31.61 +    
   31.62 +    if(IBus_CheckConnection(dbus)){
   31.63 +
   31.64 +        DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE,
   31.65 +                                                         input_ctx_path,
   31.66 +                                                         IBUS_INPUT_INTERFACE,
   31.67 +                                                         "SetCapabilities");
   31.68 +        if(msg){
   31.69 +            Uint32 caps = IBUS_CAP_FOCUS;
   31.70 +            if(!(internal_editing && *internal_editing == '1')){
   31.71 +                caps |= IBUS_CAP_PREEDIT_TEXT;
   31.72 +            }
   31.73 +            
   31.74 +            dbus->message_append_args(msg,
   31.75 +                                      DBUS_TYPE_UINT32, &caps,
   31.76 +                                      DBUS_TYPE_INVALID);
   31.77 +        }
   31.78 +        
   31.79 +        if(msg){
   31.80 +            if(dbus->connection_send(ibus_conn, msg, NULL)){
   31.81 +                dbus->connection_flush(ibus_conn);
   31.82 +            }
   31.83 +            dbus->message_unref(msg);
   31.84 +        }
   31.85 +    }
   31.86 +}
   31.87 +
   31.88 +
   31.89  static SDL_bool
   31.90  IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
   31.91  {
   31.92 @@ -331,30 +375,14 @@
   31.93      }
   31.94  
   31.95      if(result){
   31.96 -        msg = dbus->message_new_method_call(IBUS_SERVICE,
   31.97 -                                            input_ctx_path,
   31.98 -                                            IBUS_INPUT_INTERFACE,
   31.99 -                                            "SetCapabilities");
  31.100 -        if(msg){
  31.101 -            Uint32 caps = IBUS_CAP_FOCUS | IBUS_CAP_PREEDIT_TEXT;
  31.102 -            dbus->message_append_args(msg,
  31.103 -                                      DBUS_TYPE_UINT32, &caps,
  31.104 -                                      DBUS_TYPE_INVALID);
  31.105 -        }
  31.106 -        
  31.107 -        if(msg){
  31.108 -            if(dbus->connection_send(ibus_conn, msg, NULL)){
  31.109 -                dbus->connection_flush(ibus_conn);
  31.110 -            }
  31.111 -            dbus->message_unref(msg);
  31.112 -        }
  31.113 +        SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
  31.114          
  31.115          dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL);
  31.116          dbus->connection_add_filter(ibus_conn, &IBus_MessageFilter, dbus, NULL);
  31.117          dbus->connection_flush(ibus_conn);
  31.118      }
  31.119  
  31.120 -    SDL_IBus_SetFocus(SDL_GetFocusWindow() != NULL);
  31.121 +    SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL);
  31.122      SDL_IBus_UpdateTextRect(NULL);
  31.123      
  31.124      return result;
  31.125 @@ -369,7 +397,7 @@
  31.126          return SDL_TRUE;
  31.127      }
  31.128      
  31.129 -    if(inotify_fd != -1){
  31.130 +    if(inotify_fd > 0 && inotify_wd > 0){
  31.131          char buf[1024];
  31.132          ssize_t readsize = read(inotify_fd, buf, sizeof(buf));
  31.133          if(readsize > 0){
  31.134 @@ -422,15 +450,17 @@
  31.135          
  31.136          char *addr = IBus_ReadAddressFromFile(addr_file);
  31.137          
  31.138 -        inotify_fd = inotify_init();
  31.139 -        fcntl(inotify_fd, F_SETFL, O_NONBLOCK);
  31.140 +        if(inotify_fd < 0){
  31.141 +            inotify_fd = inotify_init();
  31.142 +            fcntl(inotify_fd, F_SETFL, O_NONBLOCK);
  31.143 +        }
  31.144          
  31.145          char *addr_file_dir = SDL_strrchr(addr_file, '/');
  31.146          if(addr_file_dir){
  31.147              *addr_file_dir = 0;
  31.148          }
  31.149          
  31.150 -        inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY);
  31.151 +        inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY);
  31.152          SDL_free(addr_file);
  31.153          
  31.154          result = IBus_SetupConnection(dbus, addr);
  31.155 @@ -460,6 +490,13 @@
  31.156          dbus->connection_unref(ibus_conn);
  31.157      }
  31.158      
  31.159 +    if(inotify_fd > 0 && inotify_wd > 0){
  31.160 +        inotify_rm_watch(inotify_fd, inotify_wd);
  31.161 +        inotify_wd = -1;
  31.162 +    }
  31.163 +    
  31.164 +    SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
  31.165 +    
  31.166      SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect));
  31.167  }
  31.168  
  31.169 @@ -532,6 +569,8 @@
  31.170          
  31.171      }
  31.172      
  31.173 +    SDL_IBus_UpdateTextRect(NULL);
  31.174 +
  31.175      return result;
  31.176  }
  31.177  
  31.178 @@ -542,12 +581,34 @@
  31.179          SDL_memcpy(&ibus_cursor_rect, rect, sizeof(ibus_cursor_rect));
  31.180      }
  31.181      
  31.182 -    SDL_Window *focused_win = SDL_GetFocusWindow();
  31.183 +    SDL_Window *focused_win = SDL_GetKeyboardFocus();
  31.184  
  31.185      if(!focused_win) return;
  31.186 +    
  31.187 +    SDL_SysWMinfo info;
  31.188 +    SDL_VERSION(&info.version);
  31.189 +    
  31.190 +    if(!SDL_GetWindowWMInfo(focused_win, &info)) return;
  31.191 +    
  31.192 +    int x = 0, y = 0;
  31.193 +    
  31.194 +    SDL_GetWindowPosition(focused_win, &x, &y);
  31.195 +   
  31.196 +#if SDL_VIDEO_DRIVER_X11    
  31.197 +    if(info.subsystem == SDL_SYSWM_X11){
  31.198 +        SDL_DisplayData *displaydata =
  31.199 +            (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
  31.200 +            
  31.201 +        Display *x_disp = info.info.x11.display;
  31.202 +        Window x_win = info.info.x11.window;
  31.203 +        int x_screen = displaydata->screen;
  31.204 +        Window unused;
  31.205 +            
  31.206 +        X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen),
  31.207 +            0, 0, &x, &y, &unused);
  31.208 +    }
  31.209 +#endif
  31.210  
  31.211 -    int x = 0, y = 0;
  31.212 -    SDL_GetWindowPosition(focused_win, &x, &y);
  31.213      x += ibus_cursor_rect.x;
  31.214      y += ibus_cursor_rect.y;
  31.215          
    32.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Fri Aug 08 15:14:09 2014 -0300
    32.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Wed Aug 20 17:20:22 2014 -0300
    32.3 @@ -246,7 +246,7 @@
    32.4      a = 0;
    32.5  #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
    32.6      asm(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx");
    32.7 -#elif defined(_MSC_VER) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
    32.8 +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
    32.9      a = (int)_xgetbv(0);
   32.10  #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
   32.11      __asm
    33.1 --- a/src/file/cocoa/SDL_rwopsbundlesupport.m	Fri Aug 08 15:14:09 2014 -0300
    33.2 +++ b/src/file/cocoa/SDL_rwopsbundlesupport.m	Wed Aug 20 17:20:22 2014 -0300
    33.3 @@ -33,6 +33,7 @@
    33.4   Also, note the bundle layouts are different for iPhone and Mac.
    33.5  */
    33.6  FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
    33.7 +{ @autoreleasepool
    33.8  {
    33.9      FILE* fp = NULL;
   33.10  
   33.11 @@ -41,22 +42,20 @@
   33.12          return fopen(file, mode);
   33.13      }
   33.14  
   33.15 -    @autoreleasepool {
   33.16 -        NSFileManager* file_manager = [NSFileManager defaultManager];
   33.17 -        NSString* resource_path = [[NSBundle mainBundle] resourcePath];
   33.18 +    NSFileManager* file_manager = [NSFileManager defaultManager];
   33.19 +    NSString* resource_path = [[NSBundle mainBundle] resourcePath];
   33.20  
   33.21 -        NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
   33.22 +    NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
   33.23  
   33.24 -        NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
   33.25 -        if([file_manager fileExistsAtPath:full_path_with_file_to_try]) {
   33.26 -            fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
   33.27 -        } else {
   33.28 -            fp = fopen(file, mode);
   33.29 -        }
   33.30 +    NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
   33.31 +    if([file_manager fileExistsAtPath:full_path_with_file_to_try]) {
   33.32 +        fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
   33.33 +    } else {
   33.34 +        fp = fopen(file, mode);
   33.35      }
   33.36  
   33.37      return fp;
   33.38 -}
   33.39 +}}
   33.40  
   33.41  #endif /* __APPLE__ */
   33.42  
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/filesystem/android/SDL_sysfilesystem.c	Wed Aug 20 17:20:22 2014 -0300
    34.3 @@ -0,0 +1,62 @@
    34.4 +/*
    34.5 +  Simple DirectMedia Layer
    34.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    34.7 +
    34.8 +  This software is provided 'as-is', without any express or implied
    34.9 +  warranty.  In no event will the authors be held liable for any damages
   34.10 +  arising from the use of this software.
   34.11 +
   34.12 +  Permission is granted to anyone to use this software for any purpose,
   34.13 +  including commercial applications, and to alter it and redistribute it
   34.14 +  freely, subject to the following restrictions:
   34.15 +
   34.16 +  1. The origin of this software must not be misrepresented; you must not
   34.17 +     claim that you wrote the original software. If you use this software
   34.18 +     in a product, an acknowledgment in the product documentation would be
   34.19 +     appreciated but is not required.
   34.20 +  2. Altered source versions must be plainly marked as such, and must not be
   34.21 +     misrepresented as being the original software.
   34.22 +  3. This notice may not be removed or altered from any source distribution.
   34.23 +*/
   34.24 +#include "../../SDL_internal.h"
   34.25 +
   34.26 +#ifdef SDL_FILESYSTEM_ANDROID
   34.27 +
   34.28 +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
   34.29 +/* System dependent filesystem routines                                */
   34.30 +
   34.31 +#include <unistd.h>
   34.32 +#include <errno.h>
   34.33 +
   34.34 +#include "SDL_error.h"
   34.35 +#include "SDL_filesystem.h"
   34.36 +#include "SDL_system.h"
   34.37 +
   34.38 +
   34.39 +char *
   34.40 +SDL_GetBasePath(void)
   34.41 +{
   34.42 +    /* The current working directory is / on Android */
   34.43 +    return NULL;
   34.44 +}
   34.45 +
   34.46 +char *
   34.47 +SDL_GetPrefPath(const char *org, const char *app)
   34.48 +{
   34.49 +    const char *path = SDL_AndroidGetInternalStoragePath();
   34.50 +    if (path) {
   34.51 +        size_t pathlen = SDL_strlen(path)+2;
   34.52 +        char *fullpath = (char *)SDL_malloc(pathlen);
   34.53 +        if (!fullpath) {
   34.54 +            SDL_OutOfMemory();
   34.55 +            return NULL;
   34.56 +        }
   34.57 +        SDL_snprintf(fullpath, pathlen, "%s/", path);
   34.58 +        return fullpath;
   34.59 +    }
   34.60 +    return NULL;
   34.61 +}
   34.62 +
   34.63 +#endif /* SDL_FILESYSTEM_ANDROID */
   34.64 +
   34.65 +/* vi: set ts=4 sw=4 expandtab: */
    35.1 --- a/src/filesystem/cocoa/SDL_sysfilesystem.m	Fri Aug 08 15:14:09 2014 -0300
    35.2 +++ b/src/filesystem/cocoa/SDL_sysfilesystem.m	Wed Aug 20 17:20:22 2014 -0300
    35.3 @@ -35,72 +35,71 @@
    35.4  
    35.5  char *
    35.6  SDL_GetBasePath(void)
    35.7 +{ @autoreleasepool
    35.8 +{
    35.9 +    NSBundle *bundle = [NSBundle mainBundle];
   35.10 +    const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String];
   35.11 +    const char *base = NULL;
   35.12 +    char *retval = NULL;
   35.13 +
   35.14 +    if (baseType == NULL) {
   35.15 +        baseType = "resource";
   35.16 +    }
   35.17 +    if (SDL_strcasecmp(baseType, "bundle")==0) {
   35.18 +        base = [[bundle bundlePath] fileSystemRepresentation];
   35.19 +    } else if (SDL_strcasecmp(baseType, "parent")==0) {
   35.20 +        base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation];
   35.21 +    } else {
   35.22 +        /* this returns the exedir for non-bundled  and the resourceDir for bundled apps */
   35.23 +        base = [[bundle resourcePath] fileSystemRepresentation];
   35.24 +    }
   35.25 +
   35.26 +    if (base) {
   35.27 +        const size_t len = SDL_strlen(base) + 2;
   35.28 +        retval = (char *) SDL_malloc(len);
   35.29 +        if (retval == NULL) {
   35.30 +            SDL_OutOfMemory();
   35.31 +        } else {
   35.32 +            SDL_snprintf(retval, len, "%s/", base);
   35.33 +        }
   35.34 +    }
   35.35 +
   35.36 +    return retval;
   35.37 +}}
   35.38 +
   35.39 +char *
   35.40 +SDL_GetPrefPath(const char *org, const char *app)
   35.41 +{ @autoreleasepool
   35.42  {
   35.43      char *retval = NULL;
   35.44  
   35.45 -    @autoreleasepool {
   35.46 -        const char *base = NULL;
   35.47 -        NSBundle *bundle = [NSBundle mainBundle];
   35.48 -        const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String];
   35.49 -        if (baseType == NULL) {
   35.50 -            baseType = "resource";
   35.51 -        }
   35.52 -        if (SDL_strcasecmp(baseType, "bundle")==0) {
   35.53 -            base = [[bundle bundlePath] fileSystemRepresentation];
   35.54 -        } else if (SDL_strcasecmp(baseType, "parent")==0) {
   35.55 -            base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation];
   35.56 -        } else {
   35.57 -            /* this returns the exedir for non-bundled  and the resourceDir for bundled apps */
   35.58 -            base = [[bundle resourcePath] fileSystemRepresentation];
   35.59 -        }
   35.60 +    NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
   35.61  
   35.62 +    if ([array count] > 0) {  /* we only want the first item in the list. */
   35.63 +        NSString *str = [array objectAtIndex:0];
   35.64 +        const char *base = [str fileSystemRepresentation];
   35.65          if (base) {
   35.66 -            const size_t len = SDL_strlen(base) + 2;
   35.67 +            const size_t len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4;
   35.68              retval = (char *) SDL_malloc(len);
   35.69              if (retval == NULL) {
   35.70                  SDL_OutOfMemory();
   35.71              } else {
   35.72 -                SDL_snprintf(retval, len, "%s/", base);
   35.73 +                char *ptr;
   35.74 +                SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app);
   35.75 +                for (ptr = retval+1; *ptr; ptr++) {
   35.76 +                    if (*ptr == '/') {
   35.77 +                        *ptr = '\0';
   35.78 +                        mkdir(retval, 0700);
   35.79 +                        *ptr = '/';
   35.80 +                    }
   35.81 +                }
   35.82 +                mkdir(retval, 0700);
   35.83              }
   35.84          }
   35.85      }
   35.86  
   35.87      return retval;
   35.88 -}
   35.89 -
   35.90 -char *
   35.91 -SDL_GetPrefPath(const char *org, const char *app)
   35.92 -{
   35.93 -    char *retval = NULL;
   35.94 -
   35.95 -    @autoreleasepool {
   35.96 -        NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
   35.97 -
   35.98 -        if ([array count] > 0) {  /* we only want the first item in the list. */
   35.99 -            NSString *str = [array objectAtIndex:0];
  35.100 -            const char *base = [str fileSystemRepresentation];
  35.101 -            if (base) {
  35.102 -                const size_t len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4;
  35.103 -                retval = (char *) SDL_malloc(len);
  35.104 -                if (retval == NULL) {
  35.105 -                    SDL_OutOfMemory();
  35.106 -                } else {
  35.107 -                    char *ptr;
  35.108 -                    SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app);
  35.109 -                    for (ptr = retval+1; *ptr; ptr++) {
  35.110 -                        if (*ptr == '/') {
  35.111 -                            *ptr = '\0';
  35.112 -                            mkdir(retval, 0700);
  35.113 -                            *ptr = '/';
  35.114 -                        }
  35.115 -                    }
  35.116 -                    mkdir(retval, 0700);
  35.117 -                }
  35.118 -            }
  35.119 -        }
  35.120 -    }
  35.121 -    return retval;
  35.122 -}
  35.123 +}}
  35.124  
  35.125  #endif /* SDL_FILESYSTEM_COCOA */
  35.126  
    36.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Fri Aug 08 15:14:09 2014 -0300
    36.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Wed Aug 20 17:20:22 2014 -0300
    36.3 @@ -924,10 +924,10 @@
    36.4              condition[i].lNegativeCoefficient =
    36.5                  CONVERT(hap_condition->left_coeff[i]);
    36.6              condition[i].dwPositiveSaturation =
    36.7 -                CCONVERT(hap_condition->right_sat[i]);
    36.8 +                CCONVERT(hap_condition->right_sat[i] / 2);
    36.9              condition[i].dwNegativeSaturation =
   36.10 -                CCONVERT(hap_condition->left_sat[i]);
   36.11 -            condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i]);
   36.12 +                CCONVERT(hap_condition->left_sat[i] / 2);
   36.13 +            condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i] / 2);
   36.14          }
   36.15          dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes;
   36.16          dest->lpvTypeSpecificParams = condition;
    37.1 --- a/src/haptic/linux/SDL_syshaptic.c	Fri Aug 08 15:14:09 2014 -0300
    37.2 +++ b/src/haptic/linux/SDL_syshaptic.c	Wed Aug 20 17:20:22 2014 -0300
    37.3 @@ -652,15 +652,14 @@
    37.4  
    37.5  
    37.6  /*
    37.7 - * Returns the ff_effect usable direction from a SDL_HapticDirection.
    37.8 + * Initializes the ff_effect usable direction from a SDL_HapticDirection.
    37.9   */
   37.10 -static Uint16
   37.11 -SDL_SYS_ToDirection(SDL_HapticDirection * dir)
   37.12 +static int
   37.13 +SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
   37.14  {
   37.15      Uint32 tmp;
   37.16 -    float f;                    /* Ideally we'd use fixed point math instead of floats... */
   37.17  
   37.18 -    switch (dir->type) {
   37.19 +    switch (src->type) {
   37.20      case SDL_HAPTIC_POLAR:
   37.21          /* Linux directions start from south.
   37.22                  (and range from 0 to 0xFFFF)
   37.23 @@ -671,24 +670,31 @@
   37.24                          180 deg -> 0x8000 (up)
   37.25                          270 deg -> 0xC000 (right)
   37.26                      */
   37.27 -        tmp = (((18000 + dir->dir[0]) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
   37.28 -        return (Uint16) tmp;
   37.29 +        tmp = ((src->dir[0] % 36000) * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
   37.30 +        *dest = (Uint16) tmp;
   37.31 +        break;
   37.32  
   37.33 -       case SDL_HAPTIC_SPHERICAL:
   37.34 +    case SDL_HAPTIC_SPHERICAL:
   37.35              /*
   37.36                  We convert to polar, because that's the only supported direction on Linux.
   37.37                  The first value of a spherical direction is practically the same as a
   37.38                  Polar direction, except that we have to add 90 degrees. It is the angle
   37.39                  from EAST {1,0} towards SOUTH {0,1}.
   37.40                  --> add 9000
   37.41 -                --> finally add 18000 and convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
   37.42 +                --> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
   37.43              */
   37.44 -            tmp = ((dir->dir[0]) + 9000) % 36000;    /* Convert to polars */
   37.45 -        tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
   37.46 -        return (Uint16) tmp;
   37.47 +            tmp = ((src->dir[0]) + 9000) % 36000;    /* Convert to polars */
   37.48 +        tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
   37.49 +        *dest = (Uint16) tmp;
   37.50 +        break;
   37.51  
   37.52      case SDL_HAPTIC_CARTESIAN:
   37.53 -        f = atan2(dir->dir[1], dir->dir[0]);
   37.54 +        if (!src->dir[1])
   37.55 +            *dest = (src->dir[0] >= 0 ? 0x4000 : 0xC000);
   37.56 +        else if (!src->dir[0])
   37.57 +            *dest = (src->dir[1] >= 0 ? 0x8000 : 0);
   37.58 +        else {
   37.59 +            float f = atan2(src->dir[1], src->dir[0]);    /* Ideally we'd use fixed point math instead of floats... */
   37.60                      /*
   37.61                        atan2 takes the parameters: Y-axis-value and X-axis-value (in that order)
   37.62                         - Y-axis-value is the second coordinate (from center to SOUTH)
   37.63 @@ -697,14 +703,16 @@
   37.64                          have the first spherical value. Therefore we proceed as in case
   37.65                          SDL_HAPTIC_SPHERICAL and add another 9000 to get the polar value.
   37.66                        --> add 45000 in total
   37.67 -                      --> finally add 18000 and convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
   37.68 +                      --> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
   37.69                      */
   37.70 -                tmp = (((int) (f * 18000. / M_PI)) + 45000) % 36000;
   37.71 -        tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
   37.72 -        return (Uint16) tmp;
   37.73 +                tmp = (((Sint32) (f * 18000. / M_PI)) + 45000) % 36000;
   37.74 +            tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
   37.75 +            *dest = (Uint16) tmp;
   37.76 +        }
   37.77 +        break;
   37.78  
   37.79      default:
   37.80 -        return (Uint16) SDL_SetError("Haptic: Unsupported direction type.");
   37.81 +        return SDL_SetError("Haptic: Unsupported direction type.");
   37.82      }
   37.83  
   37.84      return 0;
   37.85 @@ -735,8 +743,7 @@
   37.86  
   37.87          /* Header */
   37.88          dest->type = FF_CONSTANT;
   37.89 -        dest->direction = SDL_SYS_ToDirection(&constant->direction);
   37.90 -        if (dest->direction == (Uint16) - 1)
   37.91 +        if (SDL_SYS_ToDirection(&dest->direction, &constant->direction) == -1)
   37.92              return -1;
   37.93  
   37.94          /* Replay */
   37.95 @@ -771,8 +778,7 @@
   37.96  
   37.97          /* Header */
   37.98          dest->type = FF_PERIODIC;
   37.99 -        dest->direction = SDL_SYS_ToDirection(&periodic->direction);
  37.100 -        if (dest->direction == (Uint16) - 1)
  37.101 +        if (SDL_SYS_ToDirection(&dest->direction, &periodic->direction) == -1)
  37.102              return -1;
  37.103  
  37.104          /* Replay */
  37.105 @@ -841,20 +847,18 @@
  37.106  
  37.107          /* Condition */
  37.108          /* X axis */
  37.109 -        dest->u.condition[0].right_saturation =
  37.110 -            CLAMP(condition->right_sat[0]);
  37.111 -        dest->u.condition[0].left_saturation = CLAMP(condition->left_sat[0]);
  37.112 +        dest->u.condition[0].right_saturation = condition->right_sat[0];
  37.113 +        dest->u.condition[0].left_saturation = condition->left_sat[0];
  37.114          dest->u.condition[0].right_coeff = condition->right_coeff[0];
  37.115          dest->u.condition[0].left_coeff = condition->left_coeff[0];
  37.116 -        dest->u.condition[0].deadband = CLAMP(condition->deadband[0]);
  37.117 +        dest->u.condition[0].deadband = condition->deadband[0];
  37.118          dest->u.condition[0].center = condition->center[0];
  37.119          /* Y axis */
  37.120 -        dest->u.condition[1].right_saturation =
  37.121 -            CLAMP(condition->right_sat[1]);
  37.122 -        dest->u.condition[1].left_saturation = CLAMP(condition->left_sat[1]);
  37.123 +        dest->u.condition[1].right_saturation = condition->right_sat[1];
  37.124 +        dest->u.condition[1].left_saturation = condition->left_sat[1];
  37.125          dest->u.condition[1].right_coeff = condition->right_coeff[1];
  37.126          dest->u.condition[1].left_coeff = condition->left_coeff[1];
  37.127 -        dest->u.condition[1].deadband = CLAMP(condition->deadband[1]);
  37.128 +        dest->u.condition[1].deadband = condition->deadband[1];
  37.129          dest->u.condition[1].center = condition->center[1];
  37.130  
  37.131          /*
  37.132 @@ -868,8 +872,7 @@
  37.133  
  37.134          /* Header */
  37.135          dest->type = FF_RAMP;
  37.136 -        dest->direction = SDL_SYS_ToDirection(&ramp->direction);
  37.137 -        if (dest->direction == (Uint16) - 1)
  37.138 +        if (SDL_SYS_ToDirection(&dest->direction, &ramp->direction) == -1)
  37.139              return -1;
  37.140  
  37.141          /* Replay */
    38.1 --- a/src/haptic/windows/SDL_dinputhaptic.c	Fri Aug 08 15:14:09 2014 -0300
    38.2 +++ b/src/haptic/windows/SDL_dinputhaptic.c	Wed Aug 20 17:20:22 2014 -0300
    38.3 @@ -602,7 +602,10 @@
    38.4      }
    38.5  }
    38.6  
    38.7 -#define CONVERT(x)   (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
    38.8 +/* Clamps and converts. */
    38.9 +#define CCONVERT(x)   (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
   38.10 +/* Just converts. */
   38.11 +#define CONVERT(x)    (((x)*10000) / 0x7FFF)
   38.12  /*
   38.13   * Creates the DIEFFECT from a SDL_HapticEffect.
   38.14   */
   38.15 @@ -689,9 +692,9 @@
   38.16              SDL_free(dest->lpEnvelope);
   38.17              dest->lpEnvelope = NULL;
   38.18          } else {
   38.19 -            envelope->dwAttackLevel = CONVERT(hap_constant->attack_level);
   38.20 +            envelope->dwAttackLevel = CCONVERT(hap_constant->attack_level);
   38.21              envelope->dwAttackTime = hap_constant->attack_length * 1000;
   38.22 -            envelope->dwFadeLevel = CONVERT(hap_constant->fade_level);
   38.23 +            envelope->dwFadeLevel = CCONVERT(hap_constant->fade_level);
   38.24              envelope->dwFadeTime = hap_constant->fade_length * 1000;
   38.25          }
   38.26  
   38.27 @@ -736,9 +739,9 @@
   38.28              SDL_free(dest->lpEnvelope);
   38.29              dest->lpEnvelope = NULL;
   38.30          } else {
   38.31 -            envelope->dwAttackLevel = CONVERT(hap_periodic->attack_level);
   38.32 +            envelope->dwAttackLevel = CCONVERT(hap_periodic->attack_level);
   38.33              envelope->dwAttackTime = hap_periodic->attack_length * 1000;
   38.34 -            envelope->dwFadeLevel = CONVERT(hap_periodic->fade_level);
   38.35 +            envelope->dwFadeLevel = CCONVERT(hap_periodic->fade_level);
   38.36              envelope->dwFadeTime = hap_periodic->fade_length * 1000;
   38.37          }
   38.38  
   38.39 @@ -763,10 +766,10 @@
   38.40              condition[i].lNegativeCoefficient =
   38.41                  CONVERT(hap_condition->left_coeff[i]);
   38.42              condition[i].dwPositiveSaturation =
   38.43 -                CONVERT(hap_condition->right_sat[i]);
   38.44 +                CCONVERT(hap_condition->right_sat[i] / 2);
   38.45              condition[i].dwNegativeSaturation =
   38.46 -                CONVERT(hap_condition->left_sat[i]);
   38.47 -            condition[i].lDeadBand = CONVERT(hap_condition->deadband[i]);
   38.48 +                CCONVERT(hap_condition->left_sat[i] / 2);
   38.49 +            condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i] / 2);
   38.50          }
   38.51          dest->cbTypeSpecificParams = sizeof(DICONDITION) * dest->cAxes;
   38.52          dest->lpvTypeSpecificParams = condition;
   38.53 @@ -819,9 +822,9 @@
   38.54              SDL_free(dest->lpEnvelope);
   38.55              dest->lpEnvelope = NULL;
   38.56          } else {
   38.57 -            envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level);
   38.58 +            envelope->dwAttackLevel = CCONVERT(hap_ramp->attack_level);
   38.59              envelope->dwAttackTime = hap_ramp->attack_length * 1000;
   38.60 -            envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level);
   38.61 +            envelope->dwFadeLevel = CCONVERT(hap_ramp->fade_level);
   38.62              envelope->dwFadeTime = hap_ramp->fade_length * 1000;
   38.63          }
   38.64  
   38.65 @@ -842,7 +845,7 @@
   38.66          custom->rglForceData =
   38.67              SDL_malloc(sizeof(LONG) * custom->cSamples * custom->cChannels);
   38.68          for (i = 0; i < hap_custom->samples * hap_custom->channels; i++) {      /* Copy data. */
   38.69 -            custom->rglForceData[i] = CONVERT(hap_custom->data[i]);
   38.70 +            custom->rglForceData[i] = CCONVERT(hap_custom->data[i]);
   38.71          }
   38.72          dest->cbTypeSpecificParams = sizeof(DICUSTOMFORCE);
   38.73          dest->lpvTypeSpecificParams = custom;
   38.74 @@ -864,9 +867,9 @@
   38.75              SDL_free(dest->lpEnvelope);
   38.76              dest->lpEnvelope = NULL;
   38.77          } else {
   38.78 -            envelope->dwAttackLevel = CONVERT(hap_custom->attack_level);
   38.79 +            envelope->dwAttackLevel = CCONVERT(hap_custom->attack_level);
   38.80              envelope->dwAttackTime = hap_custom->attack_length * 1000;
   38.81 -            envelope->dwFadeLevel = CONVERT(hap_custom->fade_level);
   38.82 +            envelope->dwFadeLevel = CCONVERT(hap_custom->fade_level);
   38.83              envelope->dwFadeTime = hap_custom->fade_length * 1000;
   38.84          }
   38.85  
    39.1 --- a/src/joystick/SDL_gamecontrollerdb.h	Fri Aug 08 15:14:09 2014 -0300
    39.2 +++ b/src/joystick/SDL_gamecontrollerdb.h	Wed Aug 20 17:20:22 2014 -0300
    39.3 @@ -67,6 +67,7 @@
    39.4      "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
    39.5      "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
    39.6      "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
    39.7 +    "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    39.8      "03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    39.9      "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
   39.10      "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    40.1 --- a/src/render/SDL_render.c	Fri Aug 08 15:14:09 2014 -0300
    40.2 +++ b/src/render/SDL_render.c	Wed Aug 20 17:20:22 2014 -0300
    40.3 @@ -115,6 +115,12 @@
    40.4              }
    40.5  
    40.6              if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
    40.7 +                /* Make sure we're operating on the default render target */
    40.8 +                SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
    40.9 +                if (saved_target) {
   40.10 +                    SDL_SetRenderTarget(renderer, NULL);
   40.11 +                }
   40.12 +
   40.13                  if (renderer->logical_w) {
   40.14                      UpdateLogicalSize(renderer);
   40.15                  } else {
   40.16 @@ -140,6 +146,10 @@
   40.17                          renderer->UpdateViewport(renderer);
   40.18                      }
   40.19                  }
   40.20 +
   40.21 +                if (saved_target) {
   40.22 +                    SDL_SetRenderTarget(renderer, saved_target);
   40.23 +                }
   40.24              } else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) {
   40.25                  renderer->hidden = SDL_TRUE;
   40.26              } else if (event->window.event == SDL_WINDOWEVENT_SHOWN) {
   40.27 @@ -540,6 +550,10 @@
   40.28  
   40.29          /* Set up a destination surface for the texture update */
   40.30          dst_fmt = SDL_AllocFormat(format);
   40.31 +        if (!dst_fmt) {
   40.32 +           SDL_DestroyTexture(texture);
   40.33 +           return NULL;
   40.34 +        }
   40.35          temp = SDL_ConvertSurface(surface, dst_fmt, 0);
   40.36          SDL_FreeFormat(dst_fmt);
   40.37          if (temp) {
   40.38 @@ -912,12 +926,12 @@
   40.39          SDL_assert(!texture->native);
   40.40          renderer = texture->renderer;
   40.41          SDL_assert(renderer->UpdateTextureYUV);
   40.42 -		if (renderer->UpdateTextureYUV) {
   40.43 -			return renderer->UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
   40.44 -		} else {
   40.45 -			return SDL_Unsupported();
   40.46 -		}
   40.47 -	}
   40.48 +        if (renderer->UpdateTextureYUV) {
   40.49 +            return renderer->UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
   40.50 +        } else {
   40.51 +            return SDL_Unsupported();
   40.52 +        }
   40.53 +    }
   40.54  }
   40.55  
   40.56  static int
    41.1 --- a/src/render/direct3d/SDL_render_d3d.c	Fri Aug 08 15:14:09 2014 -0300
    41.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Wed Aug 20 17:20:22 2014 -0300
    41.3 @@ -193,6 +193,9 @@
    41.4  typedef struct
    41.5  {
    41.6      SDL_bool dirty;
    41.7 +    int w, h;
    41.8 +    DWORD usage;
    41.9 +    Uint32 format;
   41.10      IDirect3DTexture9 *texture;
   41.11      IDirect3DTexture9 *staging;
   41.12  } D3D_TextureRep;
   41.13 @@ -819,6 +822,10 @@
   41.14      HRESULT result;
   41.15  
   41.16      texture->dirty = SDL_FALSE;
   41.17 +    texture->w = w;
   41.18 +    texture->h = h;
   41.19 +    texture->usage = usage;
   41.20 +    texture->format = format;
   41.21  
   41.22      result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage,
   41.23          PixelFormatToD3DFMT(format),
   41.24 @@ -826,10 +833,18 @@
   41.25      if (FAILED(result)) {
   41.26          return D3D_SetError("CreateTexture(D3DPOOL_DEFAULT)", result);
   41.27      }
   41.28 +    return 0;
   41.29 +}
   41.30  
   41.31 -    if (usage != D3DUSAGE_RENDERTARGET) {
   41.32 -        result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage,
   41.33 -            PixelFormatToD3DFMT(format),
   41.34 +
   41.35 +static int
   41.36 +D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture)
   41.37 +{
   41.38 +    HRESULT result;
   41.39 +
   41.40 +    if (texture->staging == NULL) {
   41.41 +        result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, texture->usage,
   41.42 +            PixelFormatToD3DFMT(texture->format),
   41.43              D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
   41.44          if (FAILED(result)) {
   41.45              return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result);
   41.46 @@ -845,14 +860,8 @@
   41.47  
   41.48      if (texture->dirty && texture->staging) {
   41.49          if (!texture->texture) {
   41.50 -            D3DSURFACE_DESC desc;
   41.51 -            result = IDirect3DTexture9_GetLevelDesc(texture->staging, 0, &desc);
   41.52 -            if (FAILED(result)) {
   41.53 -                return D3D_SetError("GetLevelDesc", result);
   41.54 -            }
   41.55 -
   41.56 -            result = IDirect3DDevice9_CreateTexture(device, desc.Width, desc.Height, 1, 0,
   41.57 -                desc.Format, D3DPOOL_DEFAULT, &texture->texture, NULL);
   41.58 +            result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, texture->usage,
   41.59 +                PixelFormatToD3DFMT(texture->format), D3DPOOL_DEFAULT, &texture->texture, NULL);
   41.60              if (FAILED(result)) {
   41.61                  return D3D_SetError("CreateTexture(D3DPOOL_DEFAULT)", result);
   41.62              }
   41.63 @@ -878,8 +887,10 @@
   41.64          IDirect3DTexture9_Release(texture->texture);
   41.65          texture->texture = NULL;
   41.66      }
   41.67 -    IDirect3DTexture9_AddDirtyRect(texture->staging, NULL);
   41.68 -    texture->dirty = SDL_TRUE;
   41.69 +    if (texture->staging) {
   41.70 +        IDirect3DTexture9_AddDirtyRect(texture->staging, NULL);
   41.71 +        texture->dirty = SDL_TRUE;
   41.72 +    }
   41.73      return 0;
   41.74  }
   41.75  
   41.76 @@ -893,10 +904,15 @@
   41.77      int row, length;
   41.78      HRESULT result;
   41.79  
   41.80 +    if (D3D_CreateStagingTexture(device, texture) < 0) {
   41.81 +        return -1;
   41.82 +    }
   41.83 +
   41.84      d3drect.left = x;
   41.85      d3drect.right = x + w;
   41.86      d3drect.top = y;
   41.87      d3drect.bottom = y + h;
   41.88 +    
   41.89      result = IDirect3DTexture9_LockRect(texture->staging, 0, &locked, &d3drect, 0);
   41.90      if (FAILED(result)) {
   41.91          return D3D_SetError("LockRect()", result);
   41.92 @@ -1068,7 +1084,9 @@
   41.93  D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   41.94                  const SDL_Rect * rect, void **pixels, int *pitch)
   41.95  {
   41.96 +    D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
   41.97      D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
   41.98 +    IDirect3DDevice9 *device = data->device;
   41.99  
  41.100      if (!texturedata) {
  41.101          SDL_SetError("Texture is not currently available");
  41.102 @@ -1095,6 +1113,10 @@
  41.103          D3DLOCKED_RECT locked;
  41.104          HRESULT result;
  41.105  
  41.106 +        if (D3D_CreateStagingTexture(device, &texturedata->texture) < 0) {
  41.107 +            return -1;
  41.108 +        }
  41.109 +
  41.110          d3drect.left = rect->x;
  41.111          d3drect.right = rect->x + rect->w;
  41.112          d3drect.top = rect->y;
  41.113 @@ -1137,7 +1159,9 @@
  41.114  {
  41.115      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  41.116      D3D_TextureData *texturedata;
  41.117 +    D3D_TextureRep *texturerep;
  41.118      HRESULT result;
  41.119 +    IDirect3DDevice9 *device = data->device;
  41.120  
  41.121      /* Release the previous render target if it wasn't the default one */
  41.122      if (data->currentRenderTarget != NULL) {
  41.123 @@ -1156,6 +1180,24 @@
  41.124          return -1;
  41.125      }
  41.126  
  41.127 +    /* Make sure the render target is updated if it was locked and written to */
  41.128 +    texturerep = &texturedata->texture;
  41.129 +    if (texturerep->dirty && texturerep->staging) {
  41.130 +        if (!texturerep->texture) {
  41.131 +            result = IDirect3DDevice9_CreateTexture(device, texturerep->w, texturerep->h, 1, texturerep->usage,
  41.132 +                PixelFormatToD3DFMT(texturerep->format), D3DPOOL_DEFAULT, &texturerep->texture, NULL);
  41.133 +            if (FAILED(result)) {
  41.134 +                return D3D_SetError("CreateTexture(D3DPOOL_DEFAULT)", result);
  41.135 +            }
  41.136 +        }
  41.137 +
  41.138 +        result = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)texturerep->staging, (IDirect3DBaseTexture9 *)texturerep->texture);
  41.139 +        if (FAILED(result)) {
  41.140 +            return D3D_SetError("UpdateTexture()", result);
  41.141 +        }
  41.142 +        texturerep->dirty = SDL_FALSE;
  41.143 +    }
  41.144 +
  41.145      result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture.texture, 0, &data->currentRenderTarget);
  41.146      if(FAILED(result)) {
  41.147          return D3D_SetError("GetSurfaceLevel()", result);
  41.148 @@ -1789,9 +1831,10 @@
  41.149      D3DLOCKED_RECT locked;
  41.150      HRESULT result;
  41.151  
  41.152 -    result = IDirect3DDevice9_GetBackBuffer(data->device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer);
  41.153 -    if (FAILED(result)) {
  41.154 -        return D3D_SetError("GetBackBuffer()", result);
  41.155 +    if (data->currentRenderTarget) {
  41.156 +        backBuffer = data->currentRenderTarget;
  41.157 +    } else {
  41.158 +        backBuffer = data->defaultRenderTarget;
  41.159      }
  41.160  
  41.161      result = IDirect3DSurface9_GetDesc(backBuffer, &desc);
  41.162 @@ -1832,7 +1875,6 @@
  41.163      IDirect3DSurface9_UnlockRect(surface);
  41.164  
  41.165      IDirect3DSurface9_Release(surface);
  41.166 -    IDirect3DSurface9_Release(backBuffer);
  41.167  
  41.168      return 0;
  41.169  }
    42.1 --- a/src/render/opengl/SDL_render_gl.c	Fri Aug 08 15:14:09 2014 -0300
    42.2 +++ b/src/render/opengl/SDL_render_gl.c	Wed Aug 20 17:20:22 2014 -0300
    42.3 @@ -121,6 +121,7 @@
    42.4      GLDEBUGPROCARB next_error_callback;
    42.5      GLvoid *next_error_userparam;
    42.6  
    42.7 +    SDL_bool GL_ARB_texture_non_power_of_two_supported;
    42.8      SDL_bool GL_ARB_texture_rectangle_supported;
    42.9      struct {
   42.10          GL_Shader shader;
   42.11 @@ -164,8 +165,9 @@
   42.12      int pitch;
   42.13      SDL_Rect locked_rect;
   42.14  
   42.15 -    /* YV12 texture support */
   42.16 +    /* YUV texture support */
   42.17      SDL_bool yuv;
   42.18 +    SDL_bool nv12;
   42.19      GLuint utexture;
   42.20      GLuint vtexture;
   42.21  
   42.22 @@ -498,9 +500,13 @@
   42.23          data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
   42.24      }
   42.25  
   42.26 -    if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle")
   42.27 -        || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
   42.28 +    if (SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) {
   42.29 +        data->GL_ARB_texture_non_power_of_two_supported = SDL_TRUE;
   42.30 +    } else if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") ||
   42.31 +               SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
   42.32          data->GL_ARB_texture_rectangle_supported = SDL_TRUE;
   42.33 +    }
   42.34 +    if (data->GL_ARB_texture_rectangle_supported) {
   42.35          data->glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &value);
   42.36          renderer->info.max_texture_width = value;
   42.37          renderer->info.max_texture_height = value;
   42.38 @@ -531,6 +537,8 @@
   42.39      if (data->shaders && data->num_texture_units >= 3) {
   42.40          renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
   42.41          renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
   42.42 +        renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12;
   42.43 +        renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
   42.44      }
   42.45  
   42.46  #ifdef __MACOSX__
   42.47 @@ -611,16 +619,18 @@
   42.48          break;
   42.49      case SDL_PIXELFORMAT_YV12:
   42.50      case SDL_PIXELFORMAT_IYUV:
   42.51 +    case SDL_PIXELFORMAT_NV12:
   42.52 +    case SDL_PIXELFORMAT_NV21:
   42.53          *internalFormat = GL_LUMINANCE;
   42.54          *format = GL_LUMINANCE;
   42.55          *type = GL_UNSIGNED_BYTE;
   42.56          break;
   42.57  #ifdef __MACOSX__
   42.58      case SDL_PIXELFORMAT_UYVY:
   42.59 -		*internalFormat = GL_RGB8;
   42.60 -		*format = GL_YCBCR_422_APPLE;
   42.61 -		*type = GL_UNSIGNED_SHORT_8_8_APPLE;
   42.62 -		break;
   42.63 +        *internalFormat = GL_RGB8;
   42.64 +        *format = GL_YCBCR_422_APPLE;
   42.65 +        *type = GL_UNSIGNED_SHORT_8_8_APPLE;
   42.66 +        break;
   42.67  #endif
   42.68      default:
   42.69          return SDL_FALSE;
   42.70 @@ -672,6 +682,11 @@
   42.71              /* Need to add size for the U and V planes */
   42.72              size += (2 * (texture->h * data->pitch) / 4);
   42.73          }
   42.74 +        if (texture->format == SDL_PIXELFORMAT_NV12 ||
   42.75 +            texture->format == SDL_PIXELFORMAT_NV21) {
   42.76 +            /* Need to add size for the U/V plane */
   42.77 +            size += ((texture->h * data->pitch) / 2);
   42.78 +        }
   42.79          data->pixels = SDL_calloc(1, size);
   42.80          if (!data->pixels) {
   42.81              SDL_free(data);
   42.82 @@ -687,7 +702,7 @@
   42.83  
   42.84      GL_CheckError("", renderer);
   42.85      renderdata->glGenTextures(1, &data->texture);
   42.86 -    if (GL_CheckError("glGenTexures()", renderer) < 0) {
   42.87 +    if (GL_CheckError("glGenTextures()", renderer) < 0) {
   42.88          if (data->pixels) {
   42.89              SDL_free(data->pixels);
   42.90          }
   42.91 @@ -696,8 +711,13 @@
   42.92      }
   42.93      texture->driverdata = data;
   42.94  
   42.95 -    if ((renderdata->GL_ARB_texture_rectangle_supported)
   42.96 -        /* && texture->access != SDL_TEXTUREACCESS_TARGET */){
   42.97 +    if (renderdata->GL_ARB_texture_non_power_of_two_supported) {
   42.98 +        data->type = GL_TEXTURE_2D;
   42.99 +        texture_w = texture->w;
  42.100 +        texture_h = texture->h;
  42.101 +        data->texw = 1.0f;
  42.102 +        data->texh = 1.0f;
  42.103 +    } else if (renderdata->GL_ARB_texture_rectangle_supported) {
  42.104          data->type = GL_TEXTURE_RECTANGLE_ARB;
  42.105          texture_w = texture->w;
  42.106          texture_h = texture->h;
  42.107 @@ -801,6 +821,27 @@
  42.108          renderdata->glDisable(data->type);
  42.109      }
  42.110  
  42.111 +    if (texture->format == SDL_PIXELFORMAT_NV12 ||
  42.112 +        texture->format == SDL_PIXELFORMAT_NV21) {
  42.113 +        data->nv12 = SDL_TRUE;
  42.114 +
  42.115 +        renderdata->glGenTextures(1, &data->utexture);
  42.116 +        renderdata->glEnable(data->type);
  42.117 +
  42.118 +        renderdata->glBindTexture(data->type, data->utexture);
  42.119 +        renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
  42.120 +                                    scaleMode);
  42.121 +        renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
  42.122 +                                    scaleMode);
  42.123 +        renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
  42.124 +                                    GL_CLAMP_TO_EDGE);
  42.125 +        renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
  42.126 +                                    GL_CLAMP_TO_EDGE);
  42.127 +        renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, texture_w/2,
  42.128 +                                 texture_h/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
  42.129 +        renderdata->glDisable(data->type);
  42.130 +    }
  42.131 +
  42.132      return GL_CheckError("", renderer);
  42.133  }
  42.134  
  42.135 @@ -848,6 +889,17 @@
  42.136                                      rect->w/2, rect->h/2,
  42.137                                      data->format, data->formattype, pixels);
  42.138      }
  42.139 +
  42.140 +    if (data->nv12) {
  42.141 +        renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2));
  42.142 +
  42.143 +        /* Skip to the correct offset into the next texture */
  42.144 +        pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
  42.145 +        renderdata->glBindTexture(data->type, data->utexture);
  42.146 +        renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
  42.147 +                                    rect->w/2, rect->h/2,
  42.148 +                                    GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, pixels);
  42.149 +    }
  42.150      renderdata->glDisable(data->type);
  42.151  
  42.152      return GL_CheckError("glTexSubImage2D()", renderer);
  42.153 @@ -1184,15 +1236,10 @@
  42.154  }
  42.155  
  42.156  static int
  42.157 -GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
  42.158 -              const SDL_Rect * srcrect, const SDL_FRect * dstrect)
  42.159 +GL_SetupCopy(SDL_Renderer * renderer, SDL_Texture * texture)
  42.160  {
  42.161      GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
  42.162      GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
  42.163 -    GLfloat minx, miny, maxx, maxy;
  42.164 -    GLfloat minu, maxu, minv, maxv;
  42.165 -
  42.166 -    GL_ActivateRenderer(renderer);
  42.167  
  42.168      data->glEnable(texturedata->type);
  42.169      if (texturedata->yuv) {
  42.170 @@ -1204,6 +1251,12 @@
  42.171  
  42.172          data->glActiveTextureARB(GL_TEXTURE0_ARB);
  42.173      }
  42.174 +    if (texturedata->nv12) {
  42.175 +        data->glActiveTextureARB(GL_TEXTURE1_ARB);
  42.176 +        data->glBindTexture(texturedata->type, texturedata->utexture);
  42.177 +
  42.178 +        data->glActiveTextureARB(GL_TEXTURE0_ARB);
  42.179 +    }
  42.180      data->glBindTexture(texturedata->type, texturedata->texture);
  42.181  
  42.182      if (texture->modMode) {
  42.183 @@ -1215,10 +1268,33 @@
  42.184      GL_SetBlendMode(data, texture->blendMode);
  42.185  
  42.186      if (texturedata->yuv) {
  42.187 -        GL_SetShader(data, SHADER_YV12);
  42.188 +        GL_SetShader(data, SHADER_YUV);
  42.189 +    } else if (texturedata->nv12) {
  42.190 +        if (texture->format == SDL_PIXELFORMAT_NV12) {
  42.191 +            GL_SetShader(data, SHADER_NV12);
  42.192 +        } else {
  42.193 +            GL_SetShader(data, SHADER_NV21);
  42.194 +        }
  42.195      } else {
  42.196          GL_SetShader(data, SHADER_RGB);
  42.197      }
  42.198 +    return 0;
  42.199 +}
  42.200 +
  42.201 +static int
  42.202 +GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
  42.203 +              const SDL_Rect * srcrect, const SDL_FRect * dstrect)
  42.204 +{
  42.205 +    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
  42.206 +    GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
  42.207 +    GLfloat minx, miny, maxx, maxy;
  42.208 +    GLfloat minu, maxu, minv, maxv;
  42.209 +
  42.210 +    GL_ActivateRenderer(renderer);
  42.211 +
  42.212 +    if (GL_SetupCopy(renderer, texture) < 0) {
  42.213 +        return -1;
  42.214 +    }
  42.215  
  42.216      minx = dstrect->x;
  42.217      miny = dstrect->y;
  42.218 @@ -1263,30 +1339,8 @@
  42.219  
  42.220      GL_ActivateRenderer(renderer);
  42.221  
  42.222 -    data->glEnable(texturedata->type);
  42.223 -    if (texturedata->yuv) {
  42.224 -        data->glActiveTextureARB(GL_TEXTURE2_ARB);
  42.225 -        data->glBindTexture(texturedata->type, texturedata->vtexture);
  42.226 -
  42.227 -        data->glActiveTextureARB(GL_TEXTURE1_ARB);
  42.228 -        data->glBindTexture(texturedata->type, texturedata->utexture);
  42.229 -
  42.230 -        data->glActiveTextureARB(GL_TEXTURE0_ARB);
  42.231 -    }
  42.232 -    data->glBindTexture(texturedata->type, texturedata->texture);
  42.233 -
  42.234 -    if (texture->modMode) {
  42.235 -        GL_SetColor(data, texture->r, texture->g, texture->b, texture->a);
  42.236 -    } else {
  42.237 -        GL_SetColor(data, 255, 255, 255, 255);
  42.238 -    }
  42.239 -
  42.240 -    GL_SetBlendMode(data, texture->blendMode);
  42.241 -
  42.242 -    if (texturedata->yuv) {
  42.243 -        GL_SetShader(data, SHADER_YV12);
  42.244 -    } else {
  42.245 -        GL_SetShader(data, SHADER_RGB);
  42.246 +    if (GL_SetupCopy(renderer, texture) < 0) {
  42.247 +        return -1;
  42.248      }
  42.249  
  42.250      centerx = center->x;
    43.1 --- a/src/render/opengl/SDL_shaders_gl.c	Fri Aug 08 15:14:09 2014 -0300
    43.2 +++ b/src/render/opengl/SDL_shaders_gl.c	Wed Aug 20 17:20:22 2014 -0300
    43.3 @@ -113,7 +113,7 @@
    43.4  "}"
    43.5      },
    43.6  
    43.7 -    /* SHADER_YV12 */
    43.8 +    /* SHADER_YUV */
    43.9      {
   43.10          /* vertex shader */
   43.11  "varying vec4 v_color;\n"
   43.12 @@ -150,7 +150,7 @@
   43.13  "    yuv.x = texture2D(tex0, tcoord).r;\n"
   43.14  "\n"
   43.15  "    // Get the U and V values \n"
   43.16 -"    tcoord *= 0.5;\n"
   43.17 +"    tcoord *= UVCoordScale;\n"
   43.18  "    yuv.y = texture2D(tex1, tcoord).r;\n"
   43.19  "    yuv.z = texture2D(tex2, tcoord).r;\n"
   43.20  "\n"
   43.21 @@ -164,6 +164,106 @@
   43.22  "    gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
   43.23  "}"
   43.24      },
   43.25 +
   43.26 +    /* SHADER_NV12 */
   43.27 +    {
   43.28 +        /* vertex shader */
   43.29 +"varying vec4 v_color;\n"
   43.30 +"varying vec2 v_texCoord;\n"
   43.31 +"\n"
   43.32 +"void main()\n"
   43.33 +"{\n"
   43.34 +"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
   43.35 +"    v_color = gl_Color;\n"
   43.36 +"    v_texCoord = vec2(gl_MultiTexCoord0);\n"
   43.37 +"}",
   43.38 +        /* fragment shader */
   43.39 +"varying vec4 v_color;\n"
   43.40 +"varying vec2 v_texCoord;\n"
   43.41 +"uniform sampler2D tex0; // Y \n"
   43.42 +"uniform sampler2D tex1; // U/V \n"
   43.43 +"\n"
   43.44 +"// YUV offset \n"
   43.45 +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n"
   43.46 +"\n"
   43.47 +"// RGB coefficients \n"
   43.48 +"const vec3 Rcoeff = vec3(1.164,  0.000,  1.596);\n"
   43.49 +"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n"
   43.50 +"const vec3 Bcoeff = vec3(1.164,  2.018,  0.000);\n"
   43.51 +"\n"
   43.52 +"void main()\n"
   43.53 +"{\n"
   43.54 +"    vec2 tcoord;\n"
   43.55 +"    vec3 yuv, rgb;\n"
   43.56 +"\n"
   43.57 +"    // Get the Y value \n"
   43.58 +"    tcoord = v_texCoord;\n"
   43.59 +"    yuv.x = texture2D(tex0, tcoord).r;\n"
   43.60 +"\n"
   43.61 +"    // Get the U and V values \n"
   43.62 +"    tcoord *= UVCoordScale;\n"
   43.63 +"    yuv.yz = texture2D(tex1, tcoord).ra;\n"
   43.64 +"\n"
   43.65 +"    // Do the color transform \n"
   43.66 +"    yuv += offset;\n"
   43.67 +"    rgb.r = dot(yuv, Rcoeff);\n"
   43.68 +"    rgb.g = dot(yuv, Gcoeff);\n"
   43.69 +"    rgb.b = dot(yuv, Bcoeff);\n"
   43.70 +"\n"
   43.71 +"    // That was easy. :) \n"
   43.72 +"    gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
   43.73 +"}"
   43.74 +    },
   43.75 +
   43.76 +    /* SHADER_NV21 */
   43.77 +    {
   43.78 +        /* vertex shader */
   43.79 +"varying vec4 v_color;\n"
   43.80 +"varying vec2 v_texCoord;\n"
   43.81 +"\n"
   43.82 +"void main()\n"
   43.83 +"{\n"
   43.84 +"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
   43.85 +"    v_color = gl_Color;\n"
   43.86 +"    v_texCoord = vec2(gl_MultiTexCoord0);\n"
   43.87 +"}",
   43.88 +        /* fragment shader */
   43.89 +"varying vec4 v_color;\n"
   43.90 +"varying vec2 v_texCoord;\n"
   43.91 +"uniform sampler2D tex0; // Y \n"
   43.92 +"uniform sampler2D tex1; // U/V \n"
   43.93 +"\n"
   43.94 +"// YUV offset \n"
   43.95 +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n"
   43.96 +"\n"
   43.97 +"// RGB coefficients \n"
   43.98 +"const vec3 Rcoeff = vec3(1.164,  0.000,  1.596);\n"
   43.99 +"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n"
  43.100 +"const vec3 Bcoeff = vec3(1.164,  2.018,  0.000);\n"
  43.101 +"\n"
  43.102 +"void main()\n"
  43.103 +"{\n"
  43.104 +"    vec2 tcoord;\n"
  43.105 +"    vec3 yuv, rgb;\n"
  43.106 +"\n"
  43.107 +"    // Get the Y value \n"
  43.108 +"    tcoord = v_texCoord;\n"
  43.109 +"    yuv.x = texture2D(tex0, tcoord).r;\n"
  43.110 +"\n"
  43.111 +"    // Get the U and V values \n"
  43.112 +"    tcoord *= UVCoordScale;\n"
  43.113 +"    yuv.yz = texture2D(tex1, tcoord).ar;\n"
  43.114 +"\n"
  43.115 +"    // Do the color transform \n"
  43.116 +"    yuv += offset;\n"
  43.117 +"    rgb.r = dot(yuv, Rcoeff);\n"
  43.118 +"    rgb.g = dot(yuv, Gcoeff);\n"
  43.119 +"    rgb.b = dot(yuv, Bcoeff);\n"
  43.120 +"\n"
  43.121 +"    // That was easy. :) \n"
  43.122 +"    gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
  43.123 +"}"
  43.124 +    },
  43.125  };
  43.126  
  43.127  static SDL_bool
  43.128 @@ -218,7 +318,11 @@
  43.129      if (ctx->GL_ARB_texture_rectangle_supported) {
  43.130          frag_defines =
  43.131  "#define sampler2D sampler2DRect\n"
  43.132 -"#define texture2D texture2DRect\n";
  43.133 +"#define texture2D texture2DRect\n"
  43.134 +"#define UVCoordScale 0.5\n";
  43.135 +    } else {
  43.136 +        frag_defines = 
  43.137 +"#define UVCoordScale 1.0\n";
  43.138      }
  43.139  
  43.140      /* Create one program object to rule them all */
  43.141 @@ -276,8 +380,9 @@
  43.142          return NULL;
  43.143      }
  43.144  
  43.145 -    if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle")
  43.146 -        || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
  43.147 +    if (!SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two") &&
  43.148 +        (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") ||
  43.149 +         SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle"))) {
  43.150          ctx->GL_ARB_texture_rectangle_supported = SDL_TRUE;
  43.151      }
  43.152  
    44.1 --- a/src/render/opengl/SDL_shaders_gl.h	Fri Aug 08 15:14:09 2014 -0300
    44.2 +++ b/src/render/opengl/SDL_shaders_gl.h	Wed Aug 20 17:20:22 2014 -0300
    44.3 @@ -26,7 +26,9 @@
    44.4      SHADER_NONE,
    44.5      SHADER_SOLID,
    44.6      SHADER_RGB,
    44.7 -    SHADER_YV12,
    44.8 +    SHADER_YUV,
    44.9 +    SHADER_NV12,
   44.10 +    SHADER_NV21,
   44.11      NUM_SHADERS
   44.12  } GL_Shader;
   44.13  
    45.1 --- a/src/render/opengles2/SDL_render_gles2.c	Fri Aug 08 15:14:09 2014 -0300
    45.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Wed Aug 20 17:20:22 2014 -0300
    45.3 @@ -81,8 +81,9 @@
    45.4      GLenum pixel_type;
    45.5      void *pixel_data;
    45.6      int pitch;
    45.7 -    /* YV12 texture support */
    45.8 +    /* YUV texture support */
    45.9      SDL_bool yuv;
   45.10 +    SDL_bool nv12;
   45.11      GLenum texture_v;
   45.12      GLenum texture_u;
   45.13      GLES2_FBOList *fbo;
   45.14 @@ -151,7 +152,9 @@
   45.15      GLES2_IMAGESOURCE_TEXTURE_ARGB,
   45.16      GLES2_IMAGESOURCE_TEXTURE_RGB,
   45.17      GLES2_IMAGESOURCE_TEXTURE_BGR,
   45.18 -    GLES2_IMAGESOURCE_TEXTURE_YUV
   45.19 +    GLES2_IMAGESOURCE_TEXTURE_YUV,
   45.20 +    GLES2_IMAGESOURCE_TEXTURE_NV12,
   45.21 +    GLES2_IMAGESOURCE_TEXTURE_NV21
   45.22  } GLES2_ImageSource;
   45.23  
   45.24  typedef struct GLES2_DriverContext
   45.25 @@ -488,6 +491,8 @@
   45.26          break;
   45.27      case SDL_PIXELFORMAT_IYUV:
   45.28      case SDL_PIXELFORMAT_YV12:
   45.29 +    case SDL_PIXELFORMAT_NV12:
   45.30 +    case SDL_PIXELFORMAT_NV21:
   45.31          format = GL_LUMINANCE;
   45.32          type = GL_UNSIGNED_BYTE;
   45.33          break;
   45.34 @@ -505,6 +510,7 @@
   45.35      data->pixel_format = format;
   45.36      data->pixel_type = type;
   45.37      data->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12));
   45.38 +    data->nv12 = ((texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21));
   45.39      data->texture_u = 0;
   45.40      data->texture_v = 0;
   45.41      scaleMode = GetScaleQuality();
   45.42 @@ -518,6 +524,10 @@
   45.43              /* Need to add size for the U and V planes */
   45.44              size += (2 * (texture->h * data->pitch) / 4);
   45.45          }
   45.46 +        if (data->nv12) {
   45.47 +            /* Need to add size for the U/V plane */
   45.48 +            size += ((texture->h * data->pitch) / 2);
   45.49 +        }
   45.50          data->pixel_data = SDL_calloc(1, size);
   45.51          if (!data->pixel_data) {
   45.52              SDL_free(data);
   45.53 @@ -557,6 +567,23 @@
   45.54          }
   45.55      }
   45.56  
   45.57 +    if (data->nv12) {
   45.58 +        renderdata->glGenTextures(1, &data->texture_u);
   45.59 +        if (GL_CheckError("glGenTexures()", renderer) < 0) {
   45.60 +            return -1;
   45.61 +        }
   45.62 +        renderdata->glActiveTexture(GL_TEXTURE1);
   45.63 +        renderdata->glBindTexture(data->texture_type, data->texture_u);
   45.64 +        renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
   45.65 +        renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode);
   45.66 +        renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   45.67 +        renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
   45.68 +        renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, texture->w / 2, texture->h / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
   45.69 +        if (GL_CheckError("glTexImage2D()", renderer) < 0) {
   45.70 +            return -1;
   45.71 +        }
   45.72 +    }
   45.73 +
   45.74      renderdata->glGenTextures(1, &data->texture);
   45.75      if (GL_CheckError("glGenTexures()", renderer) < 0) {
   45.76          return -1;
   45.77 @@ -673,6 +700,20 @@
   45.78                  pixels, pitch / 2, 1);
   45.79      }
   45.80  
   45.81 +    if (tdata->nv12) {
   45.82 +        /* Skip to the correct offset into the next texture */
   45.83 +        pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
   45.84 +        data->glBindTexture(tdata->texture_type, tdata->texture_u);
   45.85 +        GLES2_TexSubImage2D(data, tdata->texture_type,
   45.86 +                rect->x / 2,
   45.87 +                rect->y / 2,
   45.88 +                rect->w / 2,
   45.89 +                rect->h / 2,
   45.90 +                GL_LUMINANCE_ALPHA,
   45.91 +                GL_UNSIGNED_BYTE,
   45.92 +                pixels, pitch, 2);
   45.93 +    }
   45.94 +
   45.95      return GL_CheckError("glTexSubImage2D()", renderer);
   45.96  }
   45.97  
   45.98 @@ -1093,6 +1134,12 @@
   45.99      case GLES2_IMAGESOURCE_TEXTURE_YUV:
  45.100          ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC;
  45.101          break;
  45.102 +    case GLES2_IMAGESOURCE_TEXTURE_NV12:
  45.103 +        ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC;
  45.104 +        break;
  45.105 +    case GLES2_IMAGESOURCE_TEXTURE_NV21:
  45.106 +        ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC;
  45.107 +        break;
  45.108      default:
  45.109          goto fault;
  45.110      }
  45.111 @@ -1432,20 +1479,15 @@
  45.112  }
  45.113  
  45.114  static int
  45.115 -GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
  45.116 -                 const SDL_FRect *dstrect)
  45.117 +GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture)
  45.118  {
  45.119      GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
  45.120      GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
  45.121      GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
  45.122      SDL_BlendMode blendMode;
  45.123 -    GLfloat vertices[8];
  45.124 -    GLfloat texCoords[8];
  45.125      GLES2_ProgramCacheEntry *program;
  45.126      Uint8 r, g, b, a;
  45.127  
  45.128 -    GLES2_ActivateRenderer(renderer);
  45.129 -
  45.130      /* Activate an appropriate shader and set the projection matrix */
  45.131      blendMode = texture->blendMode;
  45.132      if (renderer->target) {
  45.133 @@ -1505,11 +1547,22 @@
  45.134                          break;
  45.135                  }
  45.136                  break;
  45.137 +            case SDL_PIXELFORMAT_IYUV:
  45.138 +            case SDL_PIXELFORMAT_YV12:
  45.139 +                sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV;
  45.140 +                break;
  45.141 +            case SDL_PIXELFORMAT_NV12:
  45.142 +                sourceType = GLES2_IMAGESOURCE_TEXTURE_NV12;
  45.143 +                break;
  45.144 +            case SDL_PIXELFORMAT_NV21:
  45.145 +                sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21;
  45.146 +                break;
  45.147 +            default:
  45.148 +                return SDL_SetError("Unsupported texture format");
  45.149              }
  45.150          }
  45.151          else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;   /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
  45.152 -    }
  45.153 -    else {
  45.154 +    } else {
  45.155          switch (texture->format)
  45.156          {
  45.157              case SDL_PIXELFORMAT_ARGB8888:
  45.158 @@ -1524,13 +1577,18 @@
  45.159              case SDL_PIXELFORMAT_BGR888:
  45.160                  sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
  45.161                  break;
  45.162 -            // TODO: new shader to change yv planes YV12 format
  45.163              case SDL_PIXELFORMAT_IYUV:
  45.164              case SDL_PIXELFORMAT_YV12:
  45.165                  sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV;
  45.166                  break;
  45.167 +            case SDL_PIXELFORMAT_NV12:
  45.168 +                sourceType = GLES2_IMAGESOURCE_TEXTURE_NV12;
  45.169 +                break;
  45.170 +            case SDL_PIXELFORMAT_NV21:
  45.171 +                sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21;
  45.172 +                break;
  45.173              default:
  45.174 -                return -1;
  45.175 +                return SDL_SetError("Unsupported texture format");
  45.176          }
  45.177      }
  45.178  
  45.179 @@ -1548,6 +1606,12 @@
  45.180  
  45.181          data->glActiveTexture(GL_TEXTURE0);
  45.182      }
  45.183 +    if (tdata->nv12) {
  45.184 +        data->glActiveTexture(GL_TEXTURE1);
  45.185 +        data->glBindTexture(tdata->texture_type, tdata->texture_u);
  45.186 +
  45.187 +        data->glActiveTexture(GL_TEXTURE0);
  45.188 +    }
  45.189      data->glBindTexture(tdata->texture_type, tdata->texture);
  45.190  
  45.191      /* Configure color modulation */
  45.192 @@ -1578,6 +1642,22 @@
  45.193      GLES2_SetBlendMode(data, blendMode);
  45.194  
  45.195      GLES2_SetTexCoords(data, SDL_TRUE);
  45.196 +    return 0;
  45.197 +}
  45.198 +
  45.199 +static int
  45.200 +GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
  45.201 +                 const SDL_FRect *dstrect)
  45.202 +{
  45.203 +    GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
  45.204 +    GLfloat vertices[8];
  45.205 +    GLfloat texCoords[8];
  45.206 +
  45.207 +    GLES2_ActivateRenderer(renderer);
  45.208 +
  45.209 +    if (GLES2_SetupCopy(renderer, texture) < 0) {
  45.210 +        return -1;
  45.211 +    }
  45.212  
  45.213      /* Emit the textured quad */
  45.214      vertices[0] = dstrect->x;
  45.215 @@ -1608,11 +1688,6 @@
  45.216                   const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
  45.217  {
  45.218      GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
  45.219 -    GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
  45.220 -    GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
  45.221 -    GLES2_ProgramCacheEntry *program;
  45.222 -    Uint8 r, g, b, a;
  45.223 -    SDL_BlendMode blendMode;
  45.224      GLfloat vertices[8];
  45.225      GLfloat texCoords[8];
  45.226      GLfloat translate[8];
  45.227 @@ -1621,6 +1696,10 @@
  45.228  
  45.229      GLES2_ActivateRenderer(renderer);
  45.230  
  45.231 +    if (GLES2_SetupCopy(renderer, texture) < 0) {
  45.232 +        return -1;
  45.233 +    }
  45.234 +
  45.235      data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
  45.236      data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
  45.237      fAngle[0] = fAngle[1] = fAngle[2] = fAngle[3] = (GLfloat)(360.0f - angle);
  45.238 @@ -1628,124 +1707,6 @@
  45.239      translate[0] = translate[2] = translate[4] = translate[6] = (center->x + dstrect->x);
  45.240      translate[1] = translate[3] = translate[5] = translate[7] = (center->y + dstrect->y);
  45.241  
  45.242 -    /* Activate an appropriate shader and set the projection matrix */
  45.243 -    blendMode = texture->blendMode;
  45.244 -    if (renderer->target) {
  45.245 -        /* Check if we need to do color mapping between the source and render target textures */
  45.246 -        if (renderer->target->format != texture->format) {
  45.247 -            switch (texture->format)
  45.248 -            {
  45.249 -            case SDL_PIXELFORMAT_ARGB8888:
  45.250 -                switch (renderer->target->format)
  45.251 -                {
  45.252 -                    case SDL_PIXELFORMAT_ABGR8888:
  45.253 -                    case SDL_PIXELFORMAT_BGR888:
  45.254 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
  45.255 -                        break;
  45.256 -                    case SDL_PIXELFORMAT_RGB888:
  45.257 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
  45.258 -                        break;
  45.259 -                }
  45.260 -                break;
  45.261 -            case SDL_PIXELFORMAT_ABGR8888:
  45.262 -                switch (renderer->target->format)
  45.263 -                {
  45.264 -                    case SDL_PIXELFORMAT_ARGB8888:
  45.265 -                    case SDL_PIXELFORMAT_RGB888:
  45.266 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
  45.267 -                        break;
  45.268 -                    case SDL_PIXELFORMAT_BGR888:
  45.269 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
  45.270 -                        break;
  45.271 -                }
  45.272 -                break;
  45.273 -            case SDL_PIXELFORMAT_RGB888:
  45.274 -                switch (renderer->target->format)
  45.275 -                {
  45.276 -                    case SDL_PIXELFORMAT_ABGR8888:
  45.277 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
  45.278 -                        break;
  45.279 -                    case SDL_PIXELFORMAT_ARGB8888:
  45.280 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
  45.281 -                        break;
  45.282 -                    case SDL_PIXELFORMAT_BGR888:
  45.283 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
  45.284 -                        break;
  45.285 -                }
  45.286 -                break;
  45.287 -            case SDL_PIXELFORMAT_BGR888:
  45.288 -                switch (renderer->target->format)
  45.289 -                {
  45.290 -                    case SDL_PIXELFORMAT_ABGR8888:
  45.291 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
  45.292 -                        break;
  45.293 -                    case SDL_PIXELFORMAT_ARGB8888:
  45.294 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB;
  45.295 -                        break;
  45.296 -                    case SDL_PIXELFORMAT_RGB888:
  45.297 -                        sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
  45.298 -                        break;
  45.299 -                }
  45.300 -                break;
  45.301 -            }
  45.302 -        }
  45.303 -        else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;   /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
  45.304 -    }
  45.305 -    else {
  45.306 -        switch (texture->format)
  45.307 -        {
  45.308 -            case SDL_PIXELFORMAT_ARGB8888:
  45.309 -                sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
  45.310 -                break;
  45.311 -            case SDL_PIXELFORMAT_ABGR8888:
  45.312 -                sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
  45.313 -                break;
  45.314 -            case SDL_PIXELFORMAT_RGB888:
  45.315 -                sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB;
  45.316 -                break;
  45.317 -            case SDL_PIXELFORMAT_BGR888:
  45.318 -                sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
  45.319 -                break;
  45.320 -            default:
  45.321 -                return -1;
  45.322 -        }
  45.323 -    }
  45.324 -    if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0)
  45.325 -        return -1;
  45.326 -
  45.327 -    /* Select the target texture */
  45.328 -    data->glBindTexture(tdata->texture_type, tdata->texture);
  45.329 -
  45.330 -    /* Configure color modulation */
  45.331 -    /* !!! FIXME: grep for glUniform4f(), move that stuff to a subroutine, it's a lot of copy/paste. */
  45.332 -    g = texture->g;
  45.333 -    a = texture->a;
  45.334 -
  45.335 -    if (renderer->target &&
  45.336 -        (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 ||
  45.337 -         renderer->target->format == SDL_PIXELFORMAT_RGB888)) {
  45.338 -        r = texture->b;
  45.339 -        b = texture->r;
  45.340 -    } else {
  45.341 -        r = texture->r;
  45.342 -        b = texture->b;
  45.343 -    }
  45.344 -
  45.345 -    program = data->current_program;
  45.346 -
  45.347 -    if (!CompareColors(program->modulation_r, program->modulation_g, program->modulation_b, program->modulation_a, r, g, b, a)) {
  45.348 -        data->glUniform4f(program->uniform_locations[GLES2_UNIFORM_MODULATION], r * inv255f, g * inv255f, b * inv255f, a * inv255f);
  45.349 -        program->modulation_r = r;
  45.350 -        program->modulation_g = g;
  45.351 -        program->modulation_b = b;
  45.352 -        program->modulation_a = a;
  45.353 -    }
  45.354 -
  45.355 -    /* Configure texture blending */
  45.356 -    GLES2_SetBlendMode(data, blendMode);
  45.357 -
  45.358 -    GLES2_SetTexCoords(data, SDL_TRUE);
  45.359 -
  45.360      /* Emit the textured quad */
  45.361      vertices[0] = dstrect->x;
  45.362      vertices[1] = dstrect->y;
  45.363 @@ -2066,6 +2027,8 @@
  45.364  
  45.365      renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
  45.366      renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
  45.367 +    renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12;
  45.368 +    renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
  45.369  
  45.370      GLES2_ResetState(renderer);
  45.371  
    46.1 --- a/src/render/opengles2/SDL_shaders_gles2.c	Fri Aug 08 15:14:09 2014 -0300
    46.2 +++ b/src/render/opengles2/SDL_shaders_gles2.c	Wed Aug 20 17:20:22 2014 -0300
    46.3 @@ -150,6 +150,50 @@
    46.4      } \
    46.5  ";
    46.6  
    46.7 +/* NV12 to ABGR conversion */
    46.8 +static const Uint8 GLES2_FragmentSrc_TextureNV12Src_[] = " \
    46.9 +    precision mediump float; \
   46.10 +    uniform sampler2D u_texture; \
   46.11 +    uniform sampler2D u_texture_u; \
   46.12 +    uniform vec4 u_modulation; \
   46.13 +    varying vec2 v_texCoord; \
   46.14 +    \
   46.15 +    void main() \
   46.16 +    { \
   46.17 +        mediump vec3 yuv; \
   46.18 +        lowp vec3 rgb; \
   46.19 +        yuv.x = texture2D(u_texture,   v_texCoord).r; \
   46.20 +        yuv.yz = texture2D(u_texture_u, v_texCoord).ra - 0.5; \
   46.21 +        rgb = mat3( 1,        1,       1, \
   46.22 +                    0,       -0.39465, 2.03211, \
   46.23 +                    1.13983, -0.58060, 0) * yuv; \
   46.24 +        gl_FragColor = vec4(rgb, 1); \
   46.25 +        gl_FragColor *= u_modulation; \
   46.26 +    } \
   46.27 +";
   46.28 +
   46.29 +/* NV21 to ABGR conversion */
   46.30 +static const Uint8 GLES2_FragmentSrc_TextureNV21Src_[] = " \
   46.31 +    precision mediump float; \
   46.32 +    uniform sampler2D u_texture; \
   46.33 +    uniform sampler2D u_texture_u; \
   46.34 +    uniform vec4 u_modulation; \
   46.35 +    varying vec2 v_texCoord; \
   46.36 +    \
   46.37 +    void main() \
   46.38 +    { \
   46.39 +        mediump vec3 yuv; \
   46.40 +        lowp vec3 rgb; \
   46.41 +        yuv.x = texture2D(u_texture,   v_texCoord).r; \
   46.42 +        yuv.yz = texture2D(u_texture_u, v_texCoord).ar - 0.5; \
   46.43 +        rgb = mat3( 1,        1,       1, \
   46.44 +                    0,       -0.39465, 2.03211, \
   46.45 +                    1.13983, -0.58060, 0) * yuv; \
   46.46 +        gl_FragColor = vec4(rgb, 1); \
   46.47 +        gl_FragColor *= u_modulation; \
   46.48 +    } \
   46.49 +";
   46.50 +
   46.51  static const GLES2_ShaderInstance GLES2_VertexSrc_Default = {
   46.52      GL_VERTEX_SHADER,
   46.53      GLES2_SOURCE_SHADER,
   46.54 @@ -199,6 +243,20 @@
   46.55      GLES2_FragmentSrc_TextureYUVSrc_
   46.56  };
   46.57  
   46.58 +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12Src = {
   46.59 +    GL_FRAGMENT_SHADER,
   46.60 +    GLES2_SOURCE_SHADER,
   46.61 +    sizeof(GLES2_FragmentSrc_TextureNV12Src_),
   46.62 +    GLES2_FragmentSrc_TextureNV12Src_
   46.63 +};
   46.64 +
   46.65 +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21Src = {
   46.66 +    GL_FRAGMENT_SHADER,
   46.67 +    GLES2_SOURCE_SHADER,
   46.68 +    sizeof(GLES2_FragmentSrc_TextureNV21Src_),
   46.69 +    GLES2_FragmentSrc_TextureNV21Src_
   46.70 +};
   46.71 +
   46.72  
   46.73  /*************************************************************************************************
   46.74   * Vertex/fragment shader binaries (NVIDIA Tegra 1/2)                                            *
   46.75 @@ -731,6 +789,20 @@
   46.76      }
   46.77  };
   46.78  
   46.79 +static GLES2_Shader GLES2_FragmentShader_TextureNV12Src = {
   46.80 +    1,
   46.81 +    {
   46.82 +        &GLES2_FragmentSrc_TextureNV12Src
   46.83 +    }
   46.84 +};
   46.85 +
   46.86 +static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = {
   46.87 +    1,
   46.88 +    {
   46.89 +        &GLES2_FragmentSrc_TextureNV21Src
   46.90 +    }
   46.91 +};
   46.92 +
   46.93  
   46.94  /*************************************************************************************************
   46.95   * Shader selector                                                                               *
   46.96 @@ -820,6 +892,16 @@
   46.97          return &GLES2_FragmentShader_TextureYUVSrc;
   46.98      }
   46.99  
  46.100 +    case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC:
  46.101 +    {
  46.102 +        return &GLES2_FragmentShader_TextureNV12Src;
  46.103 +    }
  46.104 +
  46.105 +    case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC:
  46.106 +    {
  46.107 +        return &GLES2_FragmentShader_TextureNV21Src;
  46.108 +    }
  46.109 +
  46.110      default:
  46.111          return NULL;
  46.112      }
    47.1 --- a/src/render/opengles2/SDL_shaders_gles2.h	Fri Aug 08 15:14:09 2014 -0300
    47.2 +++ b/src/render/opengles2/SDL_shaders_gles2.h	Wed Aug 20 17:20:22 2014 -0300
    47.3 @@ -47,7 +47,9 @@
    47.4      GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC,
    47.5      GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC,
    47.6      GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC,
    47.7 -    GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC
    47.8 +    GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC,
    47.9 +    GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC,
   47.10 +    GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC
   47.11  } GLES2_ShaderType;
   47.12  
   47.13  #define GLES2_SOURCE_SHADER (GLenum)-1
    48.1 --- a/src/test/SDL_test_common.c	Fri Aug 08 15:14:09 2014 -0300
    48.2 +++ b/src/test/SDL_test_common.c	Wed Aug 20 17:20:22 2014 -0300
    48.3 @@ -572,6 +572,12 @@
    48.4      case SDL_PIXELFORMAT_YVYU:
    48.5          fprintf(stderr, "YVYU");
    48.6          break;
    48.7 +    case SDL_PIXELFORMAT_NV12:
    48.8 +        fprintf(stderr, "NV12");
    48.9 +        break;
   48.10 +    case SDL_PIXELFORMAT_NV21:
   48.11 +        fprintf(stderr, "NV21");
   48.12 +        break;
   48.13      default:
   48.14          fprintf(stderr, "0x%8.8x", format);
   48.15          break;
    49.1 --- a/src/video/SDL_pixels.c	Fri Aug 08 15:14:09 2014 -0300
    49.2 +++ b/src/video/SDL_pixels.c	Wed Aug 20 17:20:22 2014 -0300
    49.3 @@ -122,6 +122,8 @@
    49.4      CASE(SDL_PIXELFORMAT_YUY2)
    49.5      CASE(SDL_PIXELFORMAT_UYVY)
    49.6      CASE(SDL_PIXELFORMAT_YVYU)
    49.7 +    CASE(SDL_PIXELFORMAT_NV12)
    49.8 +    CASE(SDL_PIXELFORMAT_NV21)
    49.9  #undef CASE
   49.10      default:
   49.11          return "SDL_PIXELFORMAT_UNKNOWN";
    50.1 --- a/src/video/SDL_surface.c	Fri Aug 08 15:14:09 2014 -0300
    50.2 +++ b/src/video/SDL_surface.c	Wed Aug 20 17:20:22 2014 -0300
    50.3 @@ -26,7 +26,6 @@
    50.4  #include "SDL_RLEaccel_c.h"
    50.5  #include "SDL_pixels_c.h"
    50.6  
    50.7 -
    50.8  /* Public routines */
    50.9  /*
   50.10   * Create an empty RGB surface of the appropriate depth
   50.11 @@ -623,7 +622,12 @@
   50.12  SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
   50.13                SDL_Surface * dst, SDL_Rect * dstrect)
   50.14  {
   50.15 -    SDL_Rect final_src, final_dst, fulldst;
   50.16 +    double src_x0, src_y0, src_x1, src_y1;
   50.17 +    double dst_x0, dst_y0, dst_x1, dst_y1;
   50.18 +    SDL_Rect final_src, final_dst;
   50.19 +    double scaling_w, scaling_h;
   50.20 +    int src_w, src_h;
   50.21 +    int dst_w, dst_h;
   50.22  
   50.23      /* Make sure the surfaces aren't locked */
   50.24      if (!src || !dst) {
   50.25 @@ -633,78 +637,135 @@
   50.26          return SDL_SetError("Surfaces must not be locked during blit");
   50.27      }
   50.28  
   50.29 -    /* If the destination rectangle is NULL, use the entire dest surface */
   50.30 -    if (dstrect == NULL) {
   50.31 -        fulldst.x = fulldst.y = 0;
   50.32 -        fulldst.w = dst->w;
   50.33 -        fulldst.h = dst->h;
   50.34 -        dstrect = &fulldst;
   50.35 +    if (NULL == srcrect) {
   50.36 +        src_w = src->w;
   50.37 +        src_h = src->h;
   50.38 +    } else {
   50.39 +        src_w = srcrect->w;
   50.40 +        src_h = srcrect->h;
   50.41      }
   50.42  
   50.43 -    /* clip the source rectangle to the source surface */
   50.44 -    if (srcrect) {
   50.45 -        int maxw, maxh;
   50.46 -
   50.47 -        final_src.x = srcrect->x;
   50.48 -        final_src.w = srcrect->w;
   50.49 -        if (final_src.x < 0) {
   50.50 -            final_src.w += final_src.x;
   50.51 -            final_src.x = 0;
   50.52 -        }
   50.53 -        maxw = src->w - final_src.x;
   50.54 -        if (maxw < final_src.w)
   50.55 -            final_src.w = maxw;
   50.56 -
   50.57 -        final_src.y = srcrect->y;
   50.58 -        final_src.h = srcrect->h;
   50.59 -        if (final_src.y < 0) {
   50.60 -            final_src.h += final_src.y;
   50.61 -            final_src.y = 0;
   50.62 -        }
   50.63 -        maxh = src->h - final_src.y;
   50.64 -        if (maxh < final_src.h)
   50.65 -            final_src.h = maxh;
   50.66 -
   50.67 +    if (NULL == dstrect) {
   50.68 +        dst_w = dst->w;
   50.69 +        dst_h = dst->h;
   50.70      } else {
   50.71 -        final_src.x = final_src.y = 0;
   50.72 -        final_src.w = src->w;
   50.73 -        final_src.h = src->h;
   50.74 +        dst_w = dstrect->w;
   50.75 +        dst_h = dstrect->h;
   50.76      }
   50.77  
   50.78 -    /* clip the destination rectangle against the clip rectangle */
   50.79 -    if (dstrect) {
   50.80 -        int maxw, maxh;
   50.81 -
   50.82 -        final_dst.x = dstrect->x;
   50.83 -        final_dst.w = dstrect->w;
   50.84 -        if (final_dst.x < 0) {
   50.85 -            final_dst.w += final_dst.x;
   50.86 -            final_dst.x = 0;
   50.87 -        }
   50.88 -        maxw = dst->w - final_dst.x;
   50.89 -        if (maxw < final_dst.w)
   50.90 -            final_dst.w = maxw;
   50.91 -
   50.92 -        final_dst.y = dstrect->y;
   50.93 -        final_dst.h = dstrect->h;
   50.94 -        if (final_dst.y < 0) {
   50.95 -            final_dst.h += final_dst.y;
   50.96 -            final_dst.y = 0;
   50.97 -        }
   50.98 -        maxh = dst->h - final_dst.y;
   50.99 -        if (maxh < final_dst.h)
  50.100 -            final_dst.h = maxh;
  50.101 -    } else {
  50.102 -        final_dst.x = final_dst.y = 0;
  50.103 -        final_dst.w = dst->w;
  50.104 -        final_dst.h = dst->h;
  50.105 +    if (dst_w == src_w && dst_h == src_h) {
  50.106 +        /* No scaling, defer to regular blit */
  50.107 +        return SDL_BlitSurface(src, srcrect, dst, dstrect);
  50.108      }
  50.109  
  50.110 -    if (final_dst.w > 0 && final_dst.h > 0) {
  50.111 -        return SDL_LowerBlitScaled(src, &final_src, dst, &final_dst);
  50.112 +    scaling_w = (double)dst_w / src_w;
  50.113 +    scaling_h = (double)dst_h / src_h;
  50.114 +
  50.115 +    if (NULL == dstrect) {
  50.116 +        dst_x0 = 0;
  50.117 +        dst_y0 = 0;
  50.118 +        dst_x1 = dst_w - 1;
  50.119 +        dst_y1 = dst_h - 1;
  50.120 +    } else {
  50.121 +        dst_x0 = dstrect->x;
  50.122 +        dst_y0 = dstrect->y;
  50.123 +        dst_x1 = dst_x0 + dst_w - 1;
  50.124 +        dst_y1 = dst_y0 + dst_h - 1;
  50.125      }
  50.126  
  50.127 -    return 0;
  50.128 +    if (NULL == srcrect) {
  50.129 +        src_x0 = 0;
  50.130 +        src_y0 = 0;
  50.131 +        src_x1 = src_w - 1;
  50.132 +        src_y1 = src_h - 1;
  50.133 +    } else {
  50.134 +        src_x0 = srcrect->x;
  50.135 +        src_y0 = srcrect->y;
  50.136 +        src_x1 = src_x0 + src_w - 1;
  50.137 +        src_y1 = src_y0 + src_h - 1;
  50.138 +
  50.139 +        /* Clip source rectangle to the source surface */
  50.140 +
  50.141 +        if (src_x0 < 0) {
  50.142 +            dst_x0 -= src_x0 * scaling_w;
  50.143 +            src_x0 = 0;
  50.144 +        }
  50.145 +
  50.146 +        if (src_x1 >= src->w) {
  50.147 +            dst_x1 -= (src_x1 - src->w + 1) * scaling_w;
  50.148 +            src_x1 = src->w - 1;
  50.149 +        }
  50.150 +
  50.151 +        if (src_y0 < 0) {
  50.152 +            dst_y0 -= src_y0 * scaling_h;
  50.153 +            src_y0 = 0;
  50.154 +        }
  50.155 +
  50.156 +        if (src_y1 >= src->h) {
  50.157 +            dst_y1 -= (src_y1 - src->h + 1) * scaling_h;
  50.158 +            src_y1 = src->h - 1;
  50.159 +        }
  50.160 +    }
  50.161 +
  50.162 +    /* Clip destination rectangle to the clip rectangle */
  50.163 +
  50.164 +    /* Translate to clip space for easier calculations */
  50.165 +    dst_x0 -= dst->clip_rect.x;
  50.166 +    dst_x1 -= dst->clip_rect.x;
  50.167 +    dst_y0 -= dst->clip_rect.y;
  50.168 +    dst_y1 -= dst->clip_rect.y;
  50.169 +
  50.170 +    if (dst_x0 < 0) {
  50.171 +        src_x0 -= dst_x0 / scaling_w;
  50.172 +        dst_x0 = 0;
  50.173 +    }
  50.174 +
  50.175 +    if (dst_x1 >= dst->clip_rect.w) {
  50.176 +        src_x1 -= (dst_x1 - dst->clip_rect.w + 1) / scaling_w;
  50.177 +        dst_x1 = dst->clip_rect.w - 1;
  50.178 +    }
  50.179 +
  50.180 +    if (dst_y0 < 0) {
  50.181 +        src_y0 -= dst_y0 / scaling_h;
  50.182 +        dst_y0 = 0;
  50.183 +    }
  50.184 +
  50.185 +    if (dst_y1 >= dst->clip_rect.h) {
  50.186 +        src_y1 -= (dst_y1 - dst->clip_rect.h + 1) / scaling_h;
  50.187 +        dst_y1 = dst->clip_rect.h - 1;
  50.188 +    }
  50.189 +
  50.190 +    /* Translate back to surface coordinates */
  50.191 +    dst_x0 += dst->clip_rect.x;
  50.192 +    dst_x1 += dst->clip_rect.x;
  50.193 +    dst_y0 += dst->clip_rect.y;
  50.194 +    dst_y1 += dst->clip_rect.y;
  50.195 +
  50.196 +    final_src.x = SDL_floor(src_x0 + 0.5);
  50.197 +    final_src.y = SDL_floor(src_y0 + 0.5);
  50.198 +    final_src.w = SDL_floor(src_x1 - src_x0 + 1.5);
  50.199 +    final_src.h = SDL_floor(src_y1 - src_y0 + 1.5);
  50.200 +
  50.201 +    final_dst.x = SDL_floor(dst_x0 + 0.5);
  50.202 +    final_dst.y = SDL_floor(dst_y0 + 0.5);
  50.203 +    final_dst.w = SDL_floor(dst_x1 - dst_x0 + 1.5);
  50.204 +    final_dst.h = SDL_floor(dst_y1 - dst_y0 + 1.5);
  50.205 +
  50.206 +    if (final_dst.w < 0)
  50.207 +        final_dst.w = 0;
  50.208 +    if (final_dst.h < 0)
  50.209 +        final_dst.h = 0;
  50.210 +
  50.211 +    if (dstrect)
  50.212 +        *dstrect = final_dst;
  50.213 +
  50.214 +    if (final_dst.w == 0 || final_dst.h == 0 ||
  50.215 +        final_src.w <= 0 || final_src.h <= 0) {
  50.216 +        /* No-op. */
  50.217 +        return 0;
  50.218 +    }
  50.219 +
  50.220 +    return SDL_LowerBlitScaled(src, &final_src, dst, &final_dst);
  50.221  }
  50.222  
  50.223  /**
  50.224 @@ -721,43 +782,6 @@
  50.225          SDL_COPY_COLORKEY
  50.226      );
  50.227  
  50.228 -    /* Save off the original dst width, height */
  50.229 -    int dstW = dstrect->w;
  50.230 -    int dstH = dstrect->h;
  50.231 -    SDL_Rect full_rect;
  50.232 -    SDL_Rect final_dst = *dstrect;
  50.233 -    SDL_Rect final_src = *srcrect;
  50.234 -
  50.235 -    /* Clip the dst surface to the dstrect */
  50.236 -    full_rect.x = 0;
  50.237 -    full_rect.y = 0;
  50.238 -    full_rect.w = dst->w;
  50.239 -    full_rect.h = dst->h;
  50.240 -    if (!SDL_IntersectRect(&final_dst, &full_rect, &final_dst)) {
  50.241 -        return 0;
  50.242 -    }
  50.243 -
  50.244 -    /* Did the dst width change? */
  50.245 -    if ( dstW != final_dst.w ) {
  50.246 -        /* scale the src width appropriately */
  50.247 -        final_src.w = final_src.w * dst->clip_rect.w / dstW;
  50.248 -    }
  50.249 -
  50.250 -    /* Did the dst height change? */
  50.251 -    if ( dstH != final_dst.h ) {
  50.252 -        /* scale the src width appropriately */
  50.253 -        final_src.h = final_src.h * dst->clip_rect.h / dstH;
  50.254 -    }
  50.255 -
  50.256 -    /* Clip the src surface to the srcrect */
  50.257 -    full_rect.x = 0;
  50.258 -    full_rect.y = 0;
  50.259 -    full_rect.w = src->w;
  50.260 -    full_rect.h = src->h;
  50.261 -    if (!SDL_IntersectRect(&final_src, &full_rect, &final_src)) {
  50.262 -        return 0;
  50.263 -    }
  50.264 -
  50.265      if (!(src->map->info.flags & SDL_COPY_NEAREST)) {
  50.266          src->map->info.flags |= SDL_COPY_NEAREST;
  50.267          SDL_InvalidateMap(src->map);
  50.268 @@ -766,9 +790,9 @@
  50.269      if ( !(src->map->info.flags & complex_copy_flags) &&
  50.270           src->format->format == dst->format->format &&
  50.271           !SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
  50.272 -        return SDL_SoftStretch( src, &final_src, dst, &final_dst );
  50.273 +        return SDL_SoftStretch( src, srcrect, dst, dstrect );
  50.274      } else {
  50.275 -        return SDL_LowerBlit( src, &final_src, dst, &final_dst );
  50.276 +        return SDL_LowerBlit( src, srcrect, dst, dstrect );
  50.277      }
  50.278  }
  50.279  
  50.280 @@ -1005,7 +1029,7 @@
  50.281      SDL_Rect rect;
  50.282      void *nonconst_src = (void *) src;
  50.283  
  50.284 -    /* Check to make sure we are bliting somewhere, so we don't crash */
  50.285 +    /* Check to make sure we are blitting somewhere, so we don't crash */
  50.286      if (!dst) {
  50.287          return SDL_InvalidParamError("dst");
  50.288      }
  50.289 @@ -1015,17 +1039,21 @@
  50.290  
  50.291      /* Fast path for same format copy */
  50.292      if (src_format == dst_format) {
  50.293 -        int bpp;
  50.294 +        int bpp, i;
  50.295  
  50.296          if (SDL_ISPIXELFORMAT_FOURCC(src_format)) {
  50.297              switch (src_format) {
  50.298 -            case SDL_PIXELFORMAT_YV12:
  50.299 -            case SDL_PIXELFORMAT_IYUV:
  50.300              case SDL_PIXELFORMAT_YUY2:
  50.301              case SDL_PIXELFORMAT_UYVY:
  50.302              case SDL_PIXELFORMAT_YVYU:
  50.303                  bpp = 2;
  50.304                  break;
  50.305 +            case SDL_PIXELFORMAT_YV12:
  50.306 +            case SDL_PIXELFORMAT_IYUV:
  50.307 +            case SDL_PIXELFORMAT_NV12:
  50.308 +            case SDL_PIXELFORMAT_NV21:
  50.309 +                bpp = 1;
  50.310 +                break;
  50.311              default:
  50.312                  return SDL_SetError("Unknown FOURCC pixel format");
  50.313              }
  50.314 @@ -1034,11 +1062,32 @@
  50.315          }
  50.316          width *= bpp;
  50.317  
  50.318 -        while (height-- > 0) {
  50.319 +        for (i = height; i--;) {
  50.320              SDL_memcpy(dst, src, width);
  50.321              src = (Uint8*)src + src_pitch;
  50.322              dst = (Uint8*)dst + dst_pitch;
  50.323          }
  50.324 +
  50.325 +        if (src_format == SDL_PIXELFORMAT_YV12 || src_format == SDL_PIXELFORMAT_IYUV) {
  50.326 +            /* U and V planes are a quarter the size of the Y plane */
  50.327 +            width /= 2;
  50.328 +            height /= 2;
  50.329 +            src_pitch /= 2;
  50.330 +            dst_pitch /= 2;
  50.331 +            for (i = height * 2; i--;) {
  50.332 +                SDL_memcpy(dst, src, width);
  50.333 +                src = (Uint8*)src + src_pitch;
  50.334 +                dst = (Uint8*)dst + dst_pitch;
  50.335 +            }
  50.336 +        } else if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) {
  50.337 +            /* U/V plane is half the height of the Y plane */
  50.338 +            height /= 2;
  50.339 +            for (i = height; i--;) {
  50.340 +                SDL_memcpy(dst, src, width);
  50.341 +                src = (Uint8*)src + src_pitch;
  50.342 +                dst = (Uint8*)dst + dst_pitch;
  50.343 +            }
  50.344 +        }
  50.345          return 0;
  50.346      }
  50.347  
    51.1 --- a/src/video/cocoa/SDL_cocoaclipboard.m	Fri Aug 08 15:14:09 2014 -0300
    51.2 +++ b/src/video/cocoa/SDL_cocoaclipboard.m	Wed Aug 20 17:20:22 2014 -0300
    51.3 @@ -37,34 +37,28 @@
    51.4  
    51.5  int
    51.6  Cocoa_SetClipboardText(_THIS, const char *text)
    51.7 +{ @autoreleasepool
    51.8  {
    51.9      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   51.10 -    NSAutoreleasePool *pool;
   51.11      NSPasteboard *pasteboard;
   51.12      NSString *format = GetTextFormat(_this);
   51.13  
   51.14 -    pool = [[NSAutoreleasePool alloc] init];
   51.15 -
   51.16      pasteboard = [NSPasteboard generalPasteboard];
   51.17      data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
   51.18      [pasteboard setString:[NSString stringWithUTF8String:text] forType:format];
   51.19  
   51.20 -    [pool release];
   51.21 -
   51.22      return 0;
   51.23 -}
   51.24 +}}
   51.25  
   51.26  char *
   51.27  Cocoa_GetClipboardText(_THIS)
   51.28 +{ @autoreleasepool
   51.29  {
   51.30 -    NSAutoreleasePool *pool;
   51.31      NSPasteboard *pasteboard;
   51.32      NSString *format = GetTextFormat(_this);
   51.33      NSString *available;
   51.34      char *text;
   51.35  
   51.36 -    pool = [[NSAutoreleasePool alloc] init];
   51.37 -
   51.38      pasteboard = [NSPasteboard generalPasteboard];
   51.39      available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]];
   51.40      if ([available isEqualToString:format]) {
   51.41 @@ -82,10 +76,8 @@
   51.42          text = SDL_strdup("");
   51.43      }
   51.44  
   51.45 -    [pool release];
   51.46 -
   51.47      return text;
   51.48 -}
   51.49 +}}
   51.50  
   51.51  SDL_bool
   51.52  Cocoa_HasClipboardText(_THIS)
   51.53 @@ -101,13 +93,11 @@
   51.54  
   51.55  void
   51.56  Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
   51.57 +{ @autoreleasepool
   51.58  {
   51.59 -    NSAutoreleasePool *pool;
   51.60      NSPasteboard *pasteboard;
   51.61      NSInteger count;
   51.62  
   51.63 -    pool = [[NSAutoreleasePool alloc] init];
   51.64 -
   51.65      pasteboard = [NSPasteboard generalPasteboard];
   51.66      count = [pasteboard changeCount];
   51.67      if (count != data->clipboard_count) {
   51.68 @@ -116,9 +106,7 @@
   51.69          }
   51.70          data->clipboard_count = count;
   51.71      }
   51.72 -
   51.73 -    [pool release];
   51.74 -}
   51.75 +}}
   51.76  
   51.77  #endif /* SDL_VIDEO_DRIVER_COCOA */
   51.78  
    52.1 --- a/src/video/cocoa/SDL_cocoaevents.m	Fri Aug 08 15:14:09 2014 -0300
    52.2 +++ b/src/video/cocoa/SDL_cocoaevents.m	Wed Aug 20 17:20:22 2014 -0300
    52.3 @@ -248,17 +248,16 @@
    52.4  
    52.5  void
    52.6  Cocoa_RegisterApp(void)
    52.7 +{ @autoreleasepool
    52.8  {
    52.9      /* This can get called more than once! Be careful what you initialize! */
   52.10      ProcessSerialNumber psn;
   52.11 -    NSAutoreleasePool *pool;
   52.12  
   52.13      if (!GetCurrentProcess(&psn)) {
   52.14          TransformProcessType(&psn, kProcessTransformToForegroundApplication);
   52.15          SetFrontProcess(&psn);
   52.16      }
   52.17  
   52.18 -    pool = [[NSAutoreleasePool alloc] init];
   52.19      if (NSApp == nil) {
   52.20          [SDLApplication sharedApplication];
   52.21          SDL_assert(NSApp != nil);
   52.22 @@ -287,14 +286,12 @@
   52.23              appDelegate->seenFirstActivate = YES;
   52.24          }
   52.25      }
   52.26 -    [pool release];
   52.27 -}
   52.28 +}}
   52.29  
   52.30  void
   52.31  Cocoa_PumpEvents(_THIS)
   52.32 +{ @autoreleasepool
   52.33  {
   52.34 -    NSAutoreleasePool *pool;
   52.35 -
   52.36      /* Update activity every 30 seconds to prevent screensaver */
   52.37      if (_this->suspend_screensaver) {
   52.38          SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
   52.39 @@ -306,7 +303,6 @@
   52.40          }
   52.41      }
   52.42  
   52.43 -    pool = [[NSAutoreleasePool alloc] init];
   52.44      for ( ; ; ) {
   52.45          NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
   52.46          if ( event == nil ) {
   52.47 @@ -338,8 +334,7 @@
   52.48          /* Pass through to NSApp to make sure everything stays in sync */
   52.49          [NSApp sendEvent:event];
   52.50      }
   52.51 -    [pool release];
   52.52 -}
   52.53 +}}
   52.54  
   52.55  #endif /* SDL_VIDEO_DRIVER_COCOA */
   52.56  
    53.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Fri Aug 08 15:14:09 2014 -0300
    53.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Wed Aug 20 17:20:22 2014 -0300
    53.3 @@ -479,9 +479,9 @@
    53.4  
    53.5  void
    53.6  Cocoa_StartTextInput(_THIS)
    53.7 +{ @autoreleasepool
    53.8  {
    53.9      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   53.10 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   53.11      SDL_Window *window = SDL_GetKeyboardFocus();
   53.12      NSWindow *nswindow = nil;
   53.13      if (window) {
   53.14 @@ -506,23 +506,20 @@
   53.15          [parentView addSubview: data->fieldEdit];
   53.16          [nswindow makeFirstResponder: data->fieldEdit];
   53.17      }
   53.18 -
   53.19 -    [pool release];
   53.20 -}
   53.21 +}}
   53.22  
   53.23  void
   53.24  Cocoa_StopTextInput(_THIS)
   53.25 +{ @autoreleasepool
   53.26  {
   53.27      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   53.28  
   53.29      if (data && data->fieldEdit) {
   53.30 -        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   53.31          [data->fieldEdit removeFromSuperview];
   53.32          [data->fieldEdit release];
   53.33          data->fieldEdit = nil;
   53.34 -        [pool release];
   53.35      }
   53.36 -}
   53.37 +}}
   53.38  
   53.39  void
   53.40  Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
    54.1 --- a/src/video/cocoa/SDL_cocoamessagebox.m	Fri Aug 08 15:14:09 2014 -0300
    54.2 +++ b/src/video/cocoa/SDL_cocoamessagebox.m	Wed Aug 20 17:20:22 2014 -0300
    54.3 @@ -79,11 +79,10 @@
    54.4  /* Display a Cocoa message box */
    54.5  int
    54.6  Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
    54.7 +{ @autoreleasepool
    54.8  {
    54.9      Cocoa_RegisterApp();
   54.10  
   54.11 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   54.12 -
   54.13      NSAlert* alert = [[[NSAlert alloc] init] autorelease];
   54.14  
   54.15      if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) {
   54.16 @@ -125,10 +124,8 @@
   54.17          returnValue = SDL_SetError("Did not get a valid `clicked button' id: %ld", (long)clicked);
   54.18      }
   54.19  
   54.20 -    [pool release];
   54.21 -
   54.22      return returnValue;
   54.23 -}
   54.24 +}}
   54.25  
   54.26  #endif /* SDL_VIDEO_DRIVER_COCOA */
   54.27  
    55.1 --- a/src/video/cocoa/SDL_cocoamodes.m	Fri Aug 08 15:14:09 2014 -0300
    55.2 +++ b/src/video/cocoa/SDL_cocoamodes.m	Wed Aug 20 17:20:22 2014 -0300
    55.3 @@ -214,8 +214,8 @@
    55.4  
    55.5  void
    55.6  Cocoa_InitModes(_THIS)
    55.7 +{ @autoreleasepool
    55.8  {
    55.9 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   55.10      CGDisplayErr result;
   55.11      CGDirectDisplayID *displays;
   55.12      CGDisplayCount numDisplays;
   55.13 @@ -224,7 +224,6 @@
   55.14      result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
   55.15      if (result != kCGErrorSuccess) {
   55.16          CG_SetError("CGGetOnlineDisplayList()", result);
   55.17 -        [pool release];
   55.18          return;
   55.19      }
   55.20      displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays);
   55.21 @@ -232,7 +231,6 @@
   55.22      if (result != kCGErrorSuccess) {
   55.23          CG_SetError("CGGetOnlineDisplayList()", result);
   55.24          SDL_stack_free(displays);
   55.25 -        [pool release];
   55.26          return;
   55.27      }
   55.28  
   55.29 @@ -297,8 +295,7 @@
   55.30          }
   55.31      }
   55.32      SDL_stack_free(displays);
   55.33 -    [pool release];
   55.34 -}
   55.35 +}}
   55.36  
   55.37  int
   55.38  Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
    56.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Fri Aug 08 15:14:09 2014 -0300
    56.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Wed Aug 20 17:20:22 2014 -0300
    56.3 @@ -66,8 +66,8 @@
    56.4  
    56.5  static SDL_Cursor *
    56.6  Cocoa_CreateDefaultCursor()
    56.7 +{ @autoreleasepool
    56.8  {
    56.9 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   56.10      NSCursor *nscursor;
   56.11      SDL_Cursor *cursor = NULL;
   56.12  
   56.13 @@ -81,15 +81,13 @@
   56.14          }
   56.15      }
   56.16  
   56.17 -    [pool release];
   56.18 -
   56.19      return cursor;
   56.20 -}
   56.21 +}}
   56.22  
   56.23  static SDL_Cursor *
   56.24  Cocoa_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
   56.25 +{ @autoreleasepool
   56.26  {
   56.27 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   56.28      NSImage *nsimage;
   56.29      NSCursor *nscursor = NULL;
   56.30      SDL_Cursor *cursor = NULL;
   56.31 @@ -108,15 +106,13 @@
   56.32          }
   56.33      }
   56.34  
   56.35 -    [pool release];
   56.36 -
   56.37      return cursor;
   56.38 -}
   56.39 +}}
   56.40  
   56.41  static SDL_Cursor *
   56.42  Cocoa_CreateSystemCursor(SDL_SystemCursor id)
   56.43 +{ @autoreleasepool
   56.44  {
   56.45 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   56.46      NSCursor *nscursor = NULL;
   56.47      SDL_Cursor *cursor = NULL;
   56.48  
   56.49 @@ -169,28 +165,23 @@
   56.50          }
   56.51      }
   56.52  
   56.53 -    [pool release];
   56.54 -
   56.55      return cursor;
   56.56 -}
   56.57 +}}
   56.58  
   56.59  static void
   56.60  Cocoa_FreeCursor(SDL_Cursor * cursor)
   56.61 +{ @autoreleasepool
   56.62  {
   56.63 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   56.64      NSCursor *nscursor = (NSCursor *)cursor->driverdata;
   56.65  
   56.66      [nscursor release];
   56.67      SDL_free(cursor);
   56.68 -
   56.69 -    [pool release];
   56.70 -}
   56.71 +}}
   56.72  
   56.73  static int
   56.74  Cocoa_ShowCursor(SDL_Cursor * cursor)
   56.75 +{ @autoreleasepool
   56.76  {
   56.77 -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   56.78 -
   56.79      SDL_VideoDevice *device = SDL_GetVideoDevice();
   56.80      SDL_Window *window = (device ? device->windows : NULL);
   56.81      for (; window != NULL; window = window->next) {
   56.82 @@ -201,48 +192,21 @@
   56.83                                                  waitUntilDone:NO];
   56.84          }
   56.85      }
   56.86 -
   56.87 -    [pool release];
   56.88 -
   56.89      return 0;
   56.90 -}
   56.91 -
   56.92 -static void
   56.93 -Cocoa_WarpMouse(SDL_Window * window, int x, int y)
   56.94 -{
   56.95 -    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   56.96 -    if ([data->listener isMoving]) {
   56.97 -        DLog("Postponing warp, window being moved.");
   56.98 -        [data->listener setPendingMoveX:x
   56.99 -                                      Y:y];
  56.100 -        return;
  56.101 -    }
  56.102 -
  56.103 -    SDL_Mouse *mouse = SDL_GetMouse();
  56.104 -    CGPoint point = CGPointMake(x + (float)window->x, y + (float)window->y);
  56.105 -
  56.106 -    Cocoa_HandleMouseWarp(point.x, point.y);
  56.107 -
  56.108 -    /* According to the docs, this was deprecated in 10.6, but it's still
  56.109 -     * around. The substitute requires a CGEventSource, but I'm not entirely
  56.110 -     * sure how we'd procure the right one for this event.
  56.111 -     */
  56.112 -    CGSetLocalEventsSuppressionInterval(0.0);
  56.113 -    CGWarpMouseCursorPosition(point);
  56.114 -    CGSetLocalEventsSuppressionInterval(0.25);
  56.115 -
  56.116 -    if (!mouse->relative_mode) {
  56.117 -        /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
  56.118 -         * other implementations' APIs.
  56.119 -         */
  56.120 -        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
  56.121 -    }
  56.122 -}
  56.123 +}}
  56.124  
  56.125  static void
  56.126  Cocoa_WarpMouseGlobal(int x, int y)
  56.127  {
  56.128      SDL_Mouse *mouse = SDL_GetMouse();
  56.129 +    if (mouse->focus) {
  56.130 +        SDL_WindowData *data = (SDL_WindowData *) mouse->focus->driverdata;
  56.131 +        if ([data->listener isMoving]) {
  56.132 +            DLog("Postponing warp, window being moved.");
  56.133 +            [data->listener setPendingMoveX:x Y:y];
  56.134 +            return;
  56.135 +        }
  56.136 +    }
  56.137      CGPoint point = CGPointMake((float)x, (float)y);
  56.138  
  56.139      Cocoa_HandleMouseWarp(point.x, point.y);
  56.140 @@ -263,6 +227,12 @@
  56.141      }
  56.142  }
  56.143  
  56.144 +static void
  56.145 +Cocoa_WarpMouse(SDL_Window * window, int x, int y)
  56.146 +{
  56.147 +    Cocoa_WarpMouseGlobal(x + window->x, y + window->y);
  56.148 +}
  56.149 +
  56.150  static int
  56.151  Cocoa_SetRelativeMouseMode(SDL_bool enabled)
  56.152  {
    57.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Fri Aug 08 15:14:09 2014 -0300
    57.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Wed Aug 20 17:20:22 2014 -0300
    57.3 @@ -103,8 +103,7 @@
    57.4  
    57.5  static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
    57.6  {
    57.7 -    NSRect visibleScreen = fullscreen ? [screen frame] : [screen visibleFrame];
    57.8 -    r->origin.y = (visibleScreen.origin.y + visibleScreen.size.height) - r->origin.y - r->size.height;
    57.9 +    r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
   57.10  }
   57.11  
   57.12  static void
   57.13 @@ -389,11 +388,11 @@
   57.14          isMoving = NO;
   57.15  
   57.16          SDL_Mouse *mouse = SDL_GetMouse();
   57.17 -        if (pendingWindowWarpX >= 0 && pendingWindowWarpY >= 0) {
   57.18 -            mouse->WarpMouse(_data->window, pendingWindowWarpX, pendingWindowWarpY);
   57.19 -            pendingWindowWarpX = pendingWindowWarpY = -1;
   57.20 +        if (pendingWindowWarpX != INT_MAX && pendingWindowWarpY != INT_MAX) {
   57.21 +            mouse->WarpMouseGlobal(pendingWindowWarpX, pendingWindowWarpY);
   57.22 +            pendingWindowWarpX = pendingWindowWarpY = INT_MAX;
   57.23          }
   57.24 -        if (mouse->relative_mode && SDL_GetMouseFocus() == _data->window) {
   57.25 +        if (mouse->relative_mode && !mouse->relative_mode_warp && mouse->focus == _data->window) {
   57.26              mouse->SetRelativeMouseMode(SDL_TRUE);
   57.27          }
   57.28      }
   57.29 @@ -413,7 +412,7 @@
   57.30  - (void)windowWillMove:(NSNotification *)aNotification
   57.31  {
   57.32      if ([_data->nswindow isKindOfClass:[SDLWindow class]]) {
   57.33 -        pendingWindowWarpX = pendingWindowWarpY = -1;
   57.34 +        pendingWindowWarpX = pendingWindowWarpY = INT_MAX;
   57.35          isMoving = YES;
   57.36      }
   57.37  }
   57.38 @@ -500,7 +499,7 @@
   57.39  {
   57.40      SDL_Window *window = _data->window;
   57.41      SDL_Mouse *mouse = SDL_GetMouse();
   57.42 -    if (mouse->relative_mode && ![self isMoving]) {
   57.43 +    if (mouse->relative_mode && !mouse->relative_mode_warp && ![self isMoving]) {
   57.44          mouse->SetRelativeMouseMode(SDL_TRUE);
   57.45      }
   57.46  
   57.47 @@ -532,7 +531,7 @@
   57.48  - (void)windowDidResignKey:(NSNotification *)aNotification
   57.49  {
   57.50      SDL_Mouse *mouse = SDL_GetMouse();
   57.51 -    if (mouse->relative_mode) {
   57.52 +    if (mouse->relative_mode && !mouse->relative_mode_warp) {
   57.53          mouse->SetRelativeMouseMode(SDL_FALSE);
   57.54      }
   57.55  
    58.1 --- a/src/video/x11/SDL_x11events.c	Fri Aug 08 15:14:09 2014 -0300
    58.2 +++ b/src/video/x11/SDL_x11events.c	Wed Aug 20 17:20:22 2014 -0300
    58.3 @@ -347,6 +347,9 @@
    58.4          X11_XSetICFocus(data->ic);
    58.5      }
    58.6  #endif
    58.7 +#ifdef SDL_USE_IBUS
    58.8 +    SDL_IBus_SetFocus(SDL_TRUE);
    58.9 +#endif
   58.10  }
   58.11  
   58.12  static void
   58.13 @@ -367,6 +370,9 @@
   58.14          X11_XUnsetICFocus(data->ic);
   58.15      }
   58.16  #endif
   58.17 +#ifdef SDL_USE_IBUS
   58.18 +    SDL_IBus_SetFocus(SDL_FALSE);
   58.19 +#endif
   58.20  }
   58.21  
   58.22  static void
   58.23 @@ -647,11 +653,6 @@
   58.24  #ifdef DEBUG_XEVENTS
   58.25              printf("window %p: FocusIn!\n", data);
   58.26  #endif
   58.27 -#ifdef SDL_USE_IBUS
   58.28 -            if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
   58.29 -                SDL_IBus_SetFocus(SDL_TRUE);
   58.30 -            }
   58.31 -#endif
   58.32              if (data->pending_focus == PENDING_FOCUS_OUT &&
   58.33                  data->window == SDL_GetKeyboardFocus()) {
   58.34                  /* We want to reset the keyboard here, because we may have
   58.35 @@ -689,11 +690,6 @@
   58.36  #ifdef DEBUG_XEVENTS
   58.37              printf("window %p: FocusOut!\n", data);
   58.38  #endif
   58.39 -#ifdef SDL_USE_IBUS
   58.40 -            if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
   58.41 -                SDL_IBus_SetFocus(SDL_FALSE);
   58.42 -            }
   58.43 -#endif
   58.44              data->pending_focus = PENDING_FOCUS_OUT;
   58.45              data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_OUT_TIME;
   58.46          }
   58.47 @@ -725,16 +721,11 @@
   58.48              KeySym keysym = NoSymbol;
   58.49              char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
   58.50              Status status = 0;
   58.51 -#ifdef SDL_USE_IBUS
   58.52 -            Bool handled = False;
   58.53 -#endif
   58.54 +            SDL_bool handled_by_ime = SDL_FALSE;
   58.55  
   58.56  #ifdef DEBUG_XEVENTS
   58.57              printf("window %p: KeyPress (X11 keycode = 0x%X)\n", data, xevent.xkey.keycode);
   58.58  #endif
   58.59 -#ifndef SDL_USE_IBUS
   58.60 -            SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
   58.61 -#endif
   58.62  #if 1
   58.63              if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) {
   58.64                  int min_keycode, max_keycode;
   58.65 @@ -762,7 +753,7 @@
   58.66  #endif
   58.67  #ifdef SDL_USE_IBUS
   58.68              if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
   58.69 -                if(!(handled = SDL_IBus_ProcessKeyEvent(keysym, keycode))){
   58.70 +                if(!(handled_by_ime = SDL_IBus_ProcessKeyEvent(keysym, keycode))){
   58.71  #endif
   58.72                      if(*text){
   58.73                          SDL_SendKeyboardText(text);
   58.74 @@ -770,11 +761,11 @@
   58.75  #ifdef SDL_USE_IBUS
   58.76                  }
   58.77              }
   58.78 -
   58.79 -            if (!handled) {
   58.80 +#endif
   58.81 +            if (!handled_by_ime) {
   58.82                  SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
   58.83              }
   58.84 -#endif
   58.85 +
   58.86          }
   58.87          break;
   58.88  
   58.89 @@ -1073,7 +1064,8 @@
   58.90                     because they use the NETWM protocol to notify us of changes.
   58.91                   */
   58.92                  Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
   58.93 -                if ((flags^data->window->flags) & SDL_WINDOW_HIDDEN) {
   58.94 +				if ((flags^data->window->flags) & SDL_WINDOW_HIDDEN ||
   58.95 +					(flags^data->window->flags) & SDL_WINDOW_FULLSCREEN ) {
   58.96                      if (flags & SDL_WINDOW_HIDDEN) {
   58.97                          X11_DispatchUnmapNotify(data);
   58.98                      } else {
    59.1 --- a/src/video/x11/SDL_x11keyboard.c	Fri Aug 08 15:14:09 2014 -0300
    59.2 +++ b/src/video/x11/SDL_x11keyboard.c	Wed Aug 20 17:20:22 2014 -0300
    59.3 @@ -332,9 +332,7 @@
    59.4  void
    59.5  X11_StartTextInput(_THIS)
    59.6  {
    59.7 -#ifdef SDL_USE_IBUS
    59.8 -    SDL_IBus_SetFocus(SDL_GetFocusWindow() != NULL);
    59.9 -#endif
   59.10 +
   59.11  }
   59.12  
   59.13  void
    60.1 --- a/test/loopwavequeue.c	Fri Aug 08 15:14:09 2014 -0300
    60.2 +++ b/test/loopwavequeue.c	Wed Aug 20 17:20:22 2014 -0300
    60.3 @@ -15,12 +15,12 @@
    60.4  #include <stdio.h>
    60.5  #include <stdlib.h>
    60.6  
    60.7 +#include "SDL.h"
    60.8 +
    60.9  #if HAVE_SIGNAL_H
   60.10  #include <signal.h>
   60.11  #endif
   60.12  
   60.13 -#include "SDL.h"
   60.14 -
   60.15  struct
   60.16  {
   60.17      SDL_AudioSpec spec;
    61.1 --- a/test/testautomation_pixels.c	Fri Aug 08 15:14:09 2014 -0300
    61.2 +++ b/test/testautomation_pixels.c	Wed Aug 20 17:20:22 2014 -0300
    61.3 @@ -79,14 +79,16 @@
    61.4    };
    61.5  
    61.6  /* Definition of all Non-RGB formats used to test pixel conversions */
    61.7 -const int _numNonRGBPixelFormats = 5;
    61.8 +const int _numNonRGBPixelFormats = 7;
    61.9  Uint32 _nonRGBPixelFormats[] =
   61.10    {
   61.11      SDL_PIXELFORMAT_YV12,
   61.12      SDL_PIXELFORMAT_IYUV,
   61.13      SDL_PIXELFORMAT_YUY2,
   61.14      SDL_PIXELFORMAT_UYVY,
   61.15 -    SDL_PIXELFORMAT_YVYU
   61.16 +    SDL_PIXELFORMAT_YVYU,
   61.17 +    SDL_PIXELFORMAT_NV12,
   61.18 +    SDL_PIXELFORMAT_NV21
   61.19    };
   61.20  char* _nonRGBPixelFormatsVerbose[] =
   61.21    {
   61.22 @@ -94,7 +96,9 @@
   61.23      "SDL_PIXELFORMAT_IYUV",
   61.24      "SDL_PIXELFORMAT_YUY2",
   61.25      "SDL_PIXELFORMAT_UYVY",
   61.26 -    "SDL_PIXELFORMAT_YVYU"
   61.27 +    "SDL_PIXELFORMAT_YVYU",
   61.28 +    "SDL_PIXELFORMAT_NV12",
   61.29 +    "SDL_PIXELFORMAT_NV21"
   61.30    };
   61.31  
   61.32  /* Definition of some invalid formats for negative tests */
    62.1 --- a/test/testhaptic.c	Fri Aug 08 15:14:09 2014 -0300
    62.2 +++ b/test/testhaptic.c	Wed Aug 20 17:20:22 2014 -0300
    62.3 @@ -45,8 +45,8 @@
    62.4      int i;
    62.5      char *name;
    62.6      int index;
    62.7 -    SDL_HapticEffect efx[5];
    62.8 -    int id[5];
    62.9 +    SDL_HapticEffect efx[9];
   62.10 +    int id[9];
   62.11      int nefx;
   62.12      unsigned int supported;
   62.13  
   62.14 @@ -149,6 +149,7 @@
   62.15          }
   62.16          nefx++;
   62.17      }
   62.18 +    
   62.19      /* Now the classical constant effect. */
   62.20      if (supported & SDL_HAPTIC_CONSTANT) {
   62.21          SDL_Log("   effect %d: Constant Force\n", nefx);
   62.22 @@ -166,14 +167,15 @@
   62.23          }
   62.24          nefx++;
   62.25      }
   62.26 +    
   62.27      /* The cute spring effect. */
   62.28      if (supported & SDL_HAPTIC_SPRING) {
   62.29          SDL_Log("   effect %d: Condition Spring\n", nefx);
   62.30          efx[nefx].type = SDL_HAPTIC_SPRING;
   62.31          efx[nefx].condition.length = 5000;
   62.32          for (i = 0; i < SDL_HapticNumAxes(haptic); i++) {
   62.33 -            efx[nefx].condition.right_sat[i] = 0x7FFF;
   62.34 -            efx[nefx].condition.left_sat[i] = 0x7FFF;
   62.35 +            efx[nefx].condition.right_sat[i] = 0xFFFF;
   62.36 +            efx[nefx].condition.left_sat[i] = 0xFFFF;
   62.37              efx[nefx].condition.right_coeff[i] = 0x2000;
   62.38              efx[nefx].condition.left_coeff[i] = 0x2000;
   62.39              efx[nefx].condition.center[i] = 0x1000;     /* Displace the center for it to move. */
   62.40 @@ -185,14 +187,51 @@
   62.41          }
   62.42          nefx++;
   62.43      }
   62.44 +    /* The interesting damper effect. */
   62.45 +    if (supported & SDL_HAPTIC_DAMPER) {
   62.46 +        SDL_Log("   effect %d: Condition Damper\n", nefx);
   62.47 +        efx[nefx].type = SDL_HAPTIC_DAMPER;
   62.48 +        efx[nefx].condition.length = 5000;
   62.49 +        for (i = 0; i < SDL_HapticNumAxes(haptic); i++) {
   62.50 +            efx[nefx].condition.right_sat[i] = 0xFFFF;
   62.51 +            efx[nefx].condition.left_sat[i] = 0xFFFF;
   62.52 +            efx[nefx].condition.right_coeff[i] = 0x2000;
   62.53 +            efx[nefx].condition.left_coeff[i] = 0x2000;
   62.54 +        }
   62.55 +        id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]);
   62.56 +        if (id[nefx] < 0) {
   62.57 +            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError());
   62.58 +            abort_execution();
   62.59 +        }
   62.60 +        nefx++;
   62.61 +    }
   62.62      /* The pretty awesome inertia effect. */
   62.63      if (supported & SDL_HAPTIC_INERTIA) {
   62.64          SDL_Log("   effect %d: Condition Inertia\n", nefx);
   62.65          efx[nefx].type = SDL_HAPTIC_INERTIA;
   62.66          efx[nefx].condition.length = 5000;
   62.67          for (i = 0; i < SDL_HapticNumAxes(haptic); i++) {
   62.68 -            efx[nefx].condition.right_sat[i] = 0x7FFF;
   62.69 -            efx[nefx].condition.left_sat[i] = 0x7FFF;
   62.70 +            efx[nefx].condition.right_sat[i] = 0xFFFF;
   62.71 +            efx[nefx].condition.left_sat[i] = 0xFFFF;
   62.72 +            efx[nefx].condition.right_coeff[i] = 0x2000;
   62.73 +            efx[nefx].condition.left_coeff[i] = 0x2000;
   62.74 +            efx[nefx].condition.deadband[i] = 0x1000;    /* 1/16th of axis-range around the center is 'dead'. */
   62.75 +        }
   62.76 +        id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]);
   62.77 +        if (id[nefx] < 0) {
   62.78 +            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError());
   62.79 +            abort_execution();
   62.80 +        }
   62.81 +        nefx++;
   62.82 +    }
   62.83 +    /* The hot friction effect. */
   62.84 +    if (supported & SDL_HAPTIC_FRICTION) {
   62.85 +        SDL_Log("   effect %d: Condition Friction\n", nefx);
   62.86 +        efx[nefx].type = SDL_HAPTIC_FRICTION;
   62.87 +        efx[nefx].condition.length = 5000;
   62.88 +        for (i = 0; i < SDL_HapticNumAxes(haptic); i++) {
   62.89 +            efx[nefx].condition.right_sat[i] = 0xFFFF;
   62.90 +            efx[nefx].condition.left_sat[i] = 0xFFFF;
   62.91              efx[nefx].condition.right_coeff[i] = 0x2000;
   62.92              efx[nefx].condition.left_coeff[i] = 0x2000;
   62.93          }
   62.94 @@ -203,6 +242,26 @@
   62.95          }
   62.96          nefx++;
   62.97      }
   62.98 +    
   62.99 +    /* Now we'll try a ramp effect */
  62.100 +    if (supported & SDL_HAPTIC_RAMP) {
  62.101 +        SDL_Log("   effect %d: Ramp\n", nefx);
  62.102 +        efx[nefx].type = SDL_HAPTIC_RAMP;
  62.103 +        efx[nefx].ramp.direction.type = SDL_HAPTIC_CARTESIAN;
  62.104 +        efx[nefx].ramp.direction.dir[0] = 1;     /* Force comes from                 */
  62.105 +        efx[nefx].ramp.direction.dir[1] = -1;    /*                  the north-east. */
  62.106 +        efx[nefx].ramp.length = 5000;
  62.107 +        efx[nefx].ramp.start = 0x4000;
  62.108 +        efx[nefx].ramp.end = -0x4000;
  62.109 +        efx[nefx].ramp.attack_length = 1000;
  62.110 +        efx[nefx].ramp.fade_length = 1000;
  62.111 +        id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]);
  62.112 +        if (id[nefx] < 0) {
  62.113 +            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError());
  62.114 +            abort_execution();
  62.115 +        }
  62.116 +        nefx++;
  62.117 +    }
  62.118  
  62.119      /* Finally we'll try a left/right effect. */
  62.120      if (supported & SDL_HAPTIC_LEFTRIGHT) {
    63.1 --- a/test/testoverlay2.c	Fri Aug 08 15:14:09 2014 -0300
    63.2 +++ b/test/testoverlay2.c	Wed Aug 20 17:20:22 2014 -0300
    63.3 @@ -206,6 +206,29 @@
    63.4      }
    63.5  }
    63.6  
    63.7 +void
    63.8 +ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h,
    63.9 +                 int monochrome, int luminance)
   63.10 +{
   63.11 +    int x, y;
   63.12 +    int yuv[3];
   63.13 +    Uint8 *op[2];
   63.14 +
   63.15 +    op[0] = out;
   63.16 +    op[1] = op[0] + w*h;
   63.17 +    for (y = 0; y < h; ++y) {
   63.18 +        for (x = 0; x < w; ++x) {
   63.19 +            RGBtoYUV(rgb, yuv, monochrome, luminance);
   63.20 +            *(op[0]++) = yuv[0];
   63.21 +            if (x % 2 == 0 && y % 2 == 0) {
   63.22 +                *(op[1]++) = yuv[1];
   63.23 +                *(op[1]++) = yuv[2];
   63.24 +            }
   63.25 +            rgb += 3;
   63.26 +        }
   63.27 +    }
   63.28 +}
   63.29 +
   63.30  static void
   63.31  PrintUsage(char *argv0)
   63.32  {
   63.33 @@ -241,7 +264,11 @@
   63.34      int fps = 12;
   63.35      int fpsdelay;
   63.36      int nodelay = 0;
   63.37 +#ifdef TEST_NV12
   63.38 +    Uint32 pixel_format = SDL_PIXELFORMAT_NV12;
   63.39 +#else
   63.40      Uint32 pixel_format = SDL_PIXELFORMAT_YV12;
   63.41 +#endif
   63.42      int scale = 5;
   63.43      SDL_bool done = SDL_FALSE;
   63.44  
   63.45 @@ -371,7 +398,17 @@
   63.46              rgb[2] = MooseColors[frame[j]].b;
   63.47              rgb += 3;
   63.48          }
   63.49 -        ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
   63.50 +        switch (pixel_format) {
   63.51 +        case SDL_PIXELFORMAT_YV12:
   63.52 +            ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
   63.53 +            break;
   63.54 +        case SDL_PIXELFORMAT_NV12:
   63.55 +            ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
   63.56 +            break;
   63.57 +        default:
   63.58 +            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n");
   63.59 +            break;
   63.60 +        }
   63.61      }
   63.62  
   63.63      free(RawMooseData);