├── .gitignore ├── LICENSE.txt ├── README.md ├── RtMidi.cpp ├── RtMidi.h ├── glew.c ├── glew.h ├── glfw3.h ├── glfw3.lib ├── midismoke.cpp ├── midismoke.sln ├── midismoke.vcxproj ├── midismoke.vcxproj.filters ├── shaders ├── add.frag ├── add.geom ├── add.vert ├── advect.frag ├── blur.frag ├── buoyancy.frag ├── composite.frag ├── divergence.frag ├── fullscreen.vert ├── jacobi.frag ├── maccormack.frag ├── rendering.frag ├── rendering.vert ├── subtract.frag ├── transparency.frag ├── volume.geom ├── volume.vert ├── vorticity.frag └── vorticityforce.frag ├── utilities.cpp ├── utilities.h └── wglew.h /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # Build results 11 | [Dd]ebug/ 12 | [Dd]ebugPublic/ 13 | [Rr]elease/ 14 | [Rr]eleases/ 15 | x64/ 16 | x86/ 17 | build/ 18 | bld/ 19 | [Bb]in/ 20 | [Oo]bj/ 21 | 22 | # Roslyn cache directories 23 | *.ide/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | #NUNIT 30 | *.VisualState.xml 31 | TestResult.xml 32 | 33 | # Build Results of an ATL Project 34 | [Dd]ebugPS/ 35 | [Rr]eleasePS/ 36 | dlldata.c 37 | 38 | *_i.c 39 | *_p.c 40 | *_i.h 41 | *.ilk 42 | *.meta 43 | *.obj 44 | *.pch 45 | *.pdb 46 | *.pgc 47 | *.pgd 48 | *.rsp 49 | *.sbr 50 | *.tlb 51 | *.tli 52 | *.tlh 53 | *.tmp 54 | *.tmp_proj 55 | *.log 56 | *.vspscc 57 | *.vssscc 58 | .builds 59 | *.pidb 60 | *.svclog 61 | *.scc 62 | 63 | # Chutzpah Test files 64 | _Chutzpah* 65 | 66 | # Visual C++ cache files 67 | ipch/ 68 | *.aps 69 | *.ncb 70 | *.opensdf 71 | *.sdf 72 | *.cachefile 73 | 74 | # Visual Studio profiler 75 | *.psess 76 | *.vsp 77 | *.vspx 78 | 79 | # TFS 2012 Local Workspace 80 | $tf/ 81 | 82 | # Guidance Automation Toolkit 83 | *.gpState 84 | 85 | # ReSharper is a .NET coding add-in 86 | _ReSharper*/ 87 | *.[Rr]e[Ss]harper 88 | *.DotSettings.user 89 | 90 | # JustCode is a .NET coding addin-in 91 | .JustCode 92 | 93 | # TeamCity is a build add-in 94 | _TeamCity* 95 | 96 | # DotCover is a Code Coverage Tool 97 | *.dotCover 98 | 99 | # NCrunch 100 | _NCrunch_* 101 | .*crunch*.local.xml 102 | 103 | # MightyMoose 104 | *.mm.* 105 | AutoTest.Net/ 106 | 107 | # Web workbench (sass) 108 | .sass-cache/ 109 | 110 | # Installshield output folder 111 | [Ee]xpress/ 112 | 113 | # DocProject is a documentation generator add-in 114 | DocProject/buildhelp/ 115 | DocProject/Help/*.HxT 116 | DocProject/Help/*.HxC 117 | DocProject/Help/*.hhc 118 | DocProject/Help/*.hhk 119 | DocProject/Help/*.hhp 120 | DocProject/Help/Html2 121 | DocProject/Help/html 122 | 123 | # Click-Once directory 124 | publish/ 125 | 126 | # Publish Web Output 127 | *.[Pp]ublish.xml 128 | *.azurePubxml 129 | # TODO: Comment the next line if you want to checkin your web deploy settings 130 | # but database connection strings (with potential passwords) will be unencrypted 131 | *.pubxml 132 | *.publishproj 133 | 134 | # NuGet Packages 135 | *.nupkg 136 | # The packages folder can be ignored because of Package Restore 137 | **/packages/* 138 | # except build/, which is used as an MSBuild target. 139 | !**/packages/build/ 140 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 141 | #!**/packages/repositories.config 142 | 143 | # Windows Azure Build Output 144 | csx/ 145 | *.build.csdef 146 | 147 | # Windows Store app package directory 148 | AppPackages/ 149 | 150 | # Others 151 | sql/ 152 | *.Cache 153 | ClientBin/ 154 | [Ss]tyle[Cc]op.* 155 | ~$* 156 | *~ 157 | *.dbmdl 158 | *.dbproj.schemaview 159 | *.pfx 160 | *.publishsettings 161 | node_modules/ 162 | 163 | # RIA/Silverlight projects 164 | Generated_Code/ 165 | 166 | # Backup & report files from converting an old project file 167 | # to a newer Visual Studio version. Backup files are not needed, 168 | # because we have git ;-) 169 | _UpgradeReport_Files/ 170 | Backup*/ 171 | UpgradeLog*.XML 172 | UpgradeLog*.htm 173 | 174 | # SQL Server files 175 | *.mdf 176 | *.ldf 177 | 178 | # Business Intelligence projects 179 | *.rdl.data 180 | *.bim.layout 181 | *.bim_*.settings 182 | 183 | # Microsoft Fakes 184 | FakesAssemblies/ -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 David Li (http://david.li) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #MIDI Smoke Simulator 2 | 3 | ![Alt text](http://david.li/images/midismokegithub.png) 4 | 5 | [http://david.li/midismoke](http://david.li/midismoke) ([video](https://www.youtube.com/watch?v=uAxj3dczPmg)) 6 | 7 | A MIDI keyboard driven smoke simulator -------------------------------------------------------------------------------- /RtMidi.h: -------------------------------------------------------------------------------- 1 | /**********************************************************************/ 2 | /*! \class RtMidi 3 | \brief An abstract base class for realtime MIDI input/output. 4 | 5 | This class implements some common functionality for the realtime 6 | MIDI input/output subclasses RtMidiIn and RtMidiOut. 7 | 8 | RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/ 9 | 10 | RtMidi: realtime MIDI i/o C++ classes 11 | Copyright (c) 2003-2014 Gary P. Scavone 12 | 13 | Permission is hereby granted, free of charge, to any person 14 | obtaining a copy of this software and associated documentation files 15 | (the "Software"), to deal in the Software without restriction, 16 | including without limitation the rights to use, copy, modify, merge, 17 | publish, distribute, sublicense, and/or sell copies of the Software, 18 | and to permit persons to whom the Software is furnished to do so, 19 | subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be 22 | included in all copies or substantial portions of the Software. 23 | 24 | Any person wishing to distribute modifications to the Software is 25 | asked to send the modifications to the original developer so that 26 | they can be incorporated into the canonical version. This is, 27 | however, not a binding provision of this license. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 30 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 31 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 32 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 33 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 34 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 35 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 36 | */ 37 | /**********************************************************************/ 38 | 39 | /*! 40 | \file RtMidi.h 41 | */ 42 | 43 | #ifndef RTMIDI_H 44 | #define RTMIDI_H 45 | 46 | #define RTMIDI_VERSION "2.1.0" 47 | 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #define __WINDOWS_MM__ 54 | 55 | /************************************************************************/ 56 | /*! \class RtMidiError 57 | \brief Exception handling class for RtMidi. 58 | 59 | The RtMidiError class is quite simple but it does allow errors to be 60 | "caught" by RtMidiError::Type. See the RtMidi documentation to know 61 | which methods can throw an RtMidiError. 62 | */ 63 | /************************************************************************/ 64 | 65 | class RtMidiError : public std::exception 66 | { 67 | public: 68 | //! Defined RtMidiError types. 69 | enum Type { 70 | WARNING, /*!< A non-critical error. */ 71 | DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */ 72 | UNSPECIFIED, /*!< The default, unspecified error type. */ 73 | NO_DEVICES_FOUND, /*!< No devices found on system. */ 74 | INVALID_DEVICE, /*!< An invalid device ID was specified. */ 75 | MEMORY_ERROR, /*!< An error occured during memory allocation. */ 76 | INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */ 77 | INVALID_USE, /*!< The function was called incorrectly. */ 78 | DRIVER_ERROR, /*!< A system driver error occured. */ 79 | SYSTEM_ERROR, /*!< A system error occured. */ 80 | THREAD_ERROR /*!< A thread error occured. */ 81 | }; 82 | 83 | //! The constructor. 84 | RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED ) throw() : message_(message), type_(type) {} 85 | 86 | //! The destructor. 87 | virtual ~RtMidiError( void ) throw() {} 88 | 89 | //! Prints thrown error message to stderr. 90 | virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; } 91 | 92 | //! Returns the thrown error message type. 93 | virtual const Type& getType(void) const throw() { return type_; } 94 | 95 | //! Returns the thrown error message string. 96 | virtual const std::string& getMessage(void) const throw() { return message_; } 97 | 98 | //! Returns the thrown error message as a c-style string. 99 | virtual const char* what( void ) const throw() { return message_.c_str(); } 100 | 101 | protected: 102 | std::string message_; 103 | Type type_; 104 | }; 105 | 106 | //! RtMidi error callback function prototype. 107 | /*! 108 | \param type Type of error. 109 | \param errorText Error description. 110 | 111 | Note that class behaviour is undefined after a critical error (not 112 | a warning) is reported. 113 | */ 114 | typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText ); 115 | 116 | class MidiApi; 117 | 118 | class RtMidi 119 | { 120 | public: 121 | 122 | //! MIDI API specifier arguments. 123 | enum Api { 124 | UNSPECIFIED, /*!< Search for a working compiled API. */ 125 | MACOSX_CORE, /*!< Macintosh OS-X Core Midi API. */ 126 | LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */ 127 | UNIX_JACK, /*!< The JACK Low-Latency MIDI Server API. */ 128 | WINDOWS_MM, /*!< The Microsoft Multimedia MIDI API. */ 129 | RTMIDI_DUMMY /*!< A compilable but non-functional API. */ 130 | }; 131 | 132 | //! A static function to determine the current RtMidi version. 133 | static std::string getVersion( void ) throw(); 134 | 135 | //! A static function to determine the available compiled MIDI APIs. 136 | /*! 137 | The values returned in the std::vector can be compared against 138 | the enumerated list values. Note that there can be more than one 139 | API compiled for certain operating systems. 140 | */ 141 | static void getCompiledApi( std::vector &apis ) throw(); 142 | 143 | //! Pure virtual openPort() function. 144 | virtual void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi" ) ) = 0; 145 | 146 | //! Pure virtual openVirtualPort() function. 147 | virtual void openVirtualPort( const std::string portName = std::string( "RtMidi" ) ) = 0; 148 | 149 | //! Pure virtual getPortCount() function. 150 | virtual unsigned int getPortCount() = 0; 151 | 152 | //! Pure virtual getPortName() function. 153 | virtual std::string getPortName( unsigned int portNumber = 0 ) = 0; 154 | 155 | //! Pure virtual closePort() function. 156 | virtual void closePort( void ) = 0; 157 | 158 | //! Returns true if a port is open and false if not. 159 | virtual bool isPortOpen( void ) const = 0; 160 | 161 | //! Set an error callback function to be invoked when an error has occured. 162 | /*! 163 | The callback function will be called whenever an error has occured. It is best 164 | to set the error callback function before opening a port. 165 | */ 166 | virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ) = 0; 167 | 168 | protected: 169 | 170 | RtMidi(); 171 | virtual ~RtMidi(); 172 | 173 | MidiApi *rtapi_; 174 | }; 175 | 176 | /**********************************************************************/ 177 | /*! \class RtMidiIn 178 | \brief A realtime MIDI input class. 179 | 180 | This class provides a common, platform-independent API for 181 | realtime MIDI input. It allows access to a single MIDI input 182 | port. Incoming MIDI messages are either saved to a queue for 183 | retrieval using the getMessage() function or immediately passed to 184 | a user-specified callback function. Create multiple instances of 185 | this class to connect to more than one MIDI device at the same 186 | time. With the OS-X, Linux ALSA, and JACK MIDI APIs, it is also 187 | possible to open a virtual input port to which other MIDI software 188 | clients can connect. 189 | 190 | by Gary P. Scavone, 2003-2014. 191 | */ 192 | /**********************************************************************/ 193 | 194 | // **************************************************************** // 195 | // 196 | // RtMidiIn and RtMidiOut class declarations. 197 | // 198 | // RtMidiIn / RtMidiOut are "controllers" used to select an available 199 | // MIDI input or output interface. They present common APIs for the 200 | // user to call but all functionality is implemented by the classes 201 | // MidiInApi, MidiOutApi and their subclasses. RtMidiIn and RtMidiOut 202 | // each create an instance of a MidiInApi or MidiOutApi subclass based 203 | // on the user's API choice. If no choice is made, they attempt to 204 | // make a "logical" API selection. 205 | // 206 | // **************************************************************** // 207 | 208 | class RtMidiIn : public RtMidi 209 | { 210 | public: 211 | 212 | //! User callback function type definition. 213 | typedef void (*RtMidiCallback)( double timeStamp, std::vector *message, void *userData); 214 | 215 | //! Default constructor that allows an optional api, client name and queue size. 216 | /*! 217 | An exception will be thrown if a MIDI system initialization 218 | error occurs. The queue size defines the maximum number of 219 | messages that can be held in the MIDI queue (when not using a 220 | callback function). If the queue size limit is reached, 221 | incoming messages will be ignored. 222 | 223 | If no API argument is specified and multiple API support has been 224 | compiled, the default order of use is ALSA, JACK (Linux) and CORE, 225 | JACK (OS-X). 226 | 227 | \param api An optional API id can be specified. 228 | \param clientName An optional client name can be specified. This 229 | will be used to group the ports that are created 230 | by the application. 231 | \param queueSizeLimit An optional size of the MIDI input queue can be specified. 232 | */ 233 | RtMidiIn( RtMidi::Api api=UNSPECIFIED, 234 | const std::string clientName = std::string( "RtMidi Input Client"), 235 | unsigned int queueSizeLimit = 100 ); 236 | 237 | //! If a MIDI connection is still open, it will be closed by the destructor. 238 | ~RtMidiIn ( void ) throw(); 239 | 240 | //! Returns the MIDI API specifier for the current instance of RtMidiIn. 241 | RtMidi::Api getCurrentApi( void ) throw(); 242 | 243 | //! Open a MIDI input connection given by enumeration number. 244 | /*! 245 | \param portNumber An optional port number greater than 0 can be specified. 246 | Otherwise, the default or first port found is opened. 247 | \param portName An optional name for the application port that is used to connect to portId can be specified. 248 | */ 249 | void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Input" ) ); 250 | 251 | //! Create a virtual input port, with optional name, to allow software connections (OS X, JACK and ALSA only). 252 | /*! 253 | This function creates a virtual MIDI input port to which other 254 | software applications can connect. This type of functionality 255 | is currently only supported by the Macintosh OS-X, any JACK, 256 | and Linux ALSA APIs (the function returns an error for the other APIs). 257 | 258 | \param portName An optional name for the application port that is 259 | used to connect to portId can be specified. 260 | */ 261 | void openVirtualPort( const std::string portName = std::string( "RtMidi Input" ) ); 262 | 263 | //! Set a callback function to be invoked for incoming MIDI messages. 264 | /*! 265 | The callback function will be called whenever an incoming MIDI 266 | message is received. While not absolutely necessary, it is best 267 | to set the callback function before opening a MIDI port to avoid 268 | leaving some messages in the queue. 269 | 270 | \param callback A callback function must be given. 271 | \param userData Optionally, a pointer to additional data can be 272 | passed to the callback function whenever it is called. 273 | */ 274 | void setCallback( RtMidiCallback callback, void *userData = 0 ); 275 | 276 | //! Cancel use of the current callback function (if one exists). 277 | /*! 278 | Subsequent incoming MIDI messages will be written to the queue 279 | and can be retrieved with the \e getMessage function. 280 | */ 281 | void cancelCallback(); 282 | 283 | //! Close an open MIDI connection (if one exists). 284 | void closePort( void ); 285 | 286 | //! Returns true if a port is open and false if not. 287 | virtual bool isPortOpen() const; 288 | 289 | //! Return the number of available MIDI input ports. 290 | /*! 291 | \return This function returns the number of MIDI ports of the selected API. 292 | */ 293 | unsigned int getPortCount(); 294 | 295 | //! Return a string identifier for the specified MIDI input port number. 296 | /*! 297 | \return The name of the port with the given Id is returned. 298 | \retval An empty string is returned if an invalid port specifier is provided. 299 | */ 300 | std::string getPortName( unsigned int portNumber = 0 ); 301 | 302 | //! Specify whether certain MIDI message types should be queued or ignored during input. 303 | /*! 304 | By default, MIDI timing and active sensing messages are ignored 305 | during message input because of their relative high data rates. 306 | MIDI sysex messages are ignored by default as well. Variable 307 | values of "true" imply that the respective message type will be 308 | ignored. 309 | */ 310 | void ignoreTypes( bool midiSysex = true, bool midiTime = true, bool midiSense = true ); 311 | 312 | //! Fill the user-provided vector with the data bytes for the next available MIDI message in the input queue and return the event delta-time in seconds. 313 | /*! 314 | This function returns immediately whether a new message is 315 | available or not. A valid message is indicated by a non-zero 316 | vector size. An exception is thrown if an error occurs during 317 | message retrieval or an input connection was not previously 318 | established. 319 | */ 320 | double getMessage( std::vector *message ); 321 | 322 | //! Set an error callback function to be invoked when an error has occured. 323 | /*! 324 | The callback function will be called whenever an error has occured. It is best 325 | to set the error callback function before opening a port. 326 | */ 327 | virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ); 328 | 329 | protected: 330 | void openMidiApi( RtMidi::Api api, const std::string clientName, unsigned int queueSizeLimit ); 331 | 332 | }; 333 | 334 | /**********************************************************************/ 335 | /*! \class RtMidiOut 336 | \brief A realtime MIDI output class. 337 | 338 | This class provides a common, platform-independent API for MIDI 339 | output. It allows one to probe available MIDI output ports, to 340 | connect to one such port, and to send MIDI bytes immediately over 341 | the connection. Create multiple instances of this class to 342 | connect to more than one MIDI device at the same time. With the 343 | OS-X, Linux ALSA and JACK MIDI APIs, it is also possible to open a 344 | virtual port to which other MIDI software clients can connect. 345 | 346 | by Gary P. Scavone, 2003-2014. 347 | */ 348 | /**********************************************************************/ 349 | 350 | class RtMidiOut : public RtMidi 351 | { 352 | public: 353 | 354 | //! Default constructor that allows an optional client name. 355 | /*! 356 | An exception will be thrown if a MIDI system initialization error occurs. 357 | 358 | If no API argument is specified and multiple API support has been 359 | compiled, the default order of use is ALSA, JACK (Linux) and CORE, 360 | JACK (OS-X). 361 | */ 362 | RtMidiOut( RtMidi::Api api=UNSPECIFIED, 363 | const std::string clientName = std::string( "RtMidi Output Client") ); 364 | 365 | //! The destructor closes any open MIDI connections. 366 | ~RtMidiOut( void ) throw(); 367 | 368 | //! Returns the MIDI API specifier for the current instance of RtMidiOut. 369 | RtMidi::Api getCurrentApi( void ) throw(); 370 | 371 | //! Open a MIDI output connection. 372 | /*! 373 | An optional port number greater than 0 can be specified. 374 | Otherwise, the default or first port found is opened. An 375 | exception is thrown if an error occurs while attempting to make 376 | the port connection. 377 | */ 378 | void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Output" ) ); 379 | 380 | //! Close an open MIDI connection (if one exists). 381 | void closePort( void ); 382 | 383 | //! Returns true if a port is open and false if not. 384 | virtual bool isPortOpen() const; 385 | 386 | //! Create a virtual output port, with optional name, to allow software connections (OS X, JACK and ALSA only). 387 | /*! 388 | This function creates a virtual MIDI output port to which other 389 | software applications can connect. This type of functionality 390 | is currently only supported by the Macintosh OS-X, Linux ALSA 391 | and JACK APIs (the function does nothing with the other APIs). 392 | An exception is thrown if an error occurs while attempting to 393 | create the virtual port. 394 | */ 395 | void openVirtualPort( const std::string portName = std::string( "RtMidi Output" ) ); 396 | 397 | //! Return the number of available MIDI output ports. 398 | unsigned int getPortCount( void ); 399 | 400 | //! Return a string identifier for the specified MIDI port type and number. 401 | /*! 402 | An empty string is returned if an invalid port specifier is provided. 403 | */ 404 | std::string getPortName( unsigned int portNumber = 0 ); 405 | 406 | //! Immediately send a single message out an open MIDI output port. 407 | /*! 408 | An exception is thrown if an error occurs during output or an 409 | output connection was not previously established. 410 | */ 411 | void sendMessage( std::vector *message ); 412 | 413 | //! Set an error callback function to be invoked when an error has occured. 414 | /*! 415 | The callback function will be called whenever an error has occured. It is best 416 | to set the error callback function before opening a port. 417 | */ 418 | virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ); 419 | 420 | protected: 421 | void openMidiApi( RtMidi::Api api, const std::string clientName ); 422 | }; 423 | 424 | 425 | // **************************************************************** // 426 | // 427 | // MidiInApi / MidiOutApi class declarations. 428 | // 429 | // Subclasses of MidiInApi and MidiOutApi contain all API- and 430 | // OS-specific code necessary to fully implement the RtMidi API. 431 | // 432 | // Note that MidiInApi and MidiOutApi are abstract base classes and 433 | // cannot be explicitly instantiated. RtMidiIn and RtMidiOut will 434 | // create instances of a MidiInApi or MidiOutApi subclass. 435 | // 436 | // **************************************************************** // 437 | 438 | class MidiApi 439 | { 440 | public: 441 | 442 | MidiApi(); 443 | virtual ~MidiApi(); 444 | virtual RtMidi::Api getCurrentApi( void ) = 0; 445 | virtual void openPort( unsigned int portNumber, const std::string portName ) = 0; 446 | virtual void openVirtualPort( const std::string portName ) = 0; 447 | virtual void closePort( void ) = 0; 448 | 449 | virtual unsigned int getPortCount( void ) = 0; 450 | virtual std::string getPortName( unsigned int portNumber ) = 0; 451 | 452 | inline bool isPortOpen() const { return connected_; } 453 | void setErrorCallback( RtMidiErrorCallback errorCallback ); 454 | 455 | //! A basic error reporting function for RtMidi classes. 456 | void error( RtMidiError::Type type, std::string errorString ); 457 | 458 | protected: 459 | virtual void initialize( const std::string& clientName ) = 0; 460 | 461 | void *apiData_; 462 | bool connected_; 463 | std::string errorString_; 464 | RtMidiErrorCallback errorCallback_; 465 | }; 466 | 467 | class MidiInApi : public MidiApi 468 | { 469 | public: 470 | 471 | MidiInApi( unsigned int queueSizeLimit ); 472 | virtual ~MidiInApi( void ); 473 | void setCallback( RtMidiIn::RtMidiCallback callback, void *userData ); 474 | void cancelCallback( void ); 475 | virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ); 476 | double getMessage( std::vector *message ); 477 | 478 | // A MIDI structure used internally by the class to store incoming 479 | // messages. Each message represents one and only one MIDI message. 480 | struct MidiMessage { 481 | std::vector bytes; 482 | double timeStamp; 483 | 484 | // Default constructor. 485 | MidiMessage() 486 | :bytes(0), timeStamp(0.0) {} 487 | }; 488 | 489 | struct MidiQueue { 490 | unsigned int front; 491 | unsigned int back; 492 | unsigned int size; 493 | unsigned int ringSize; 494 | MidiMessage *ring; 495 | 496 | // Default constructor. 497 | MidiQueue() 498 | :front(0), back(0), size(0), ringSize(0) {} 499 | }; 500 | 501 | // The RtMidiInData structure is used to pass private class data to 502 | // the MIDI input handling function or thread. 503 | struct RtMidiInData { 504 | MidiQueue queue; 505 | MidiMessage message; 506 | unsigned char ignoreFlags; 507 | bool doInput; 508 | bool firstMessage; 509 | void *apiData; 510 | bool usingCallback; 511 | RtMidiIn::RtMidiCallback userCallback; 512 | void *userData; 513 | bool continueSysex; 514 | 515 | // Default constructor. 516 | RtMidiInData() 517 | : ignoreFlags(7), doInput(false), firstMessage(true), 518 | apiData(0), usingCallback(false), userCallback(0), userData(0), 519 | continueSysex(false) {} 520 | }; 521 | 522 | protected: 523 | RtMidiInData inputData_; 524 | }; 525 | 526 | class MidiOutApi : public MidiApi 527 | { 528 | public: 529 | 530 | MidiOutApi( void ); 531 | virtual ~MidiOutApi( void ); 532 | virtual void sendMessage( std::vector *message ) = 0; 533 | }; 534 | 535 | // **************************************************************** // 536 | // 537 | // Inline RtMidiIn and RtMidiOut definitions. 538 | // 539 | // **************************************************************** // 540 | 541 | inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } 542 | inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); } 543 | inline void RtMidiIn :: openVirtualPort( const std::string portName ) { rtapi_->openVirtualPort( portName ); } 544 | inline void RtMidiIn :: closePort( void ) { rtapi_->closePort(); } 545 | inline bool RtMidiIn :: isPortOpen() const { return rtapi_->isPortOpen(); } 546 | inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { ((MidiInApi *)rtapi_)->setCallback( callback, userData ); } 547 | inline void RtMidiIn :: cancelCallback( void ) { ((MidiInApi *)rtapi_)->cancelCallback(); } 548 | inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); } 549 | inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); } 550 | inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { ((MidiInApi *)rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); } 551 | inline double RtMidiIn :: getMessage( std::vector *message ) { return ((MidiInApi *)rtapi_)->getMessage( message ); } 552 | inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback ) { rtapi_->setErrorCallback(errorCallback); } 553 | 554 | inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } 555 | inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); } 556 | inline void RtMidiOut :: openVirtualPort( const std::string portName ) { rtapi_->openVirtualPort( portName ); } 557 | inline void RtMidiOut :: closePort( void ) { rtapi_->closePort(); } 558 | inline bool RtMidiOut :: isPortOpen() const { return rtapi_->isPortOpen(); } 559 | inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); } 560 | inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); } 561 | inline void RtMidiOut :: sendMessage( std::vector *message ) { ((MidiOutApi *)rtapi_)->sendMessage( message ); } 562 | inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback ) { rtapi_->setErrorCallback(errorCallback); } 563 | 564 | // **************************************************************** // 565 | // 566 | // MidiInApi and MidiOutApi subclass prototypes. 567 | // 568 | // **************************************************************** // 569 | 570 | #if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__) 571 | #define __RTMIDI_DUMMY__ 572 | #endif 573 | 574 | #if defined(__MACOSX_CORE__) 575 | 576 | class MidiInCore: public MidiInApi 577 | { 578 | public: 579 | MidiInCore( const std::string clientName, unsigned int queueSizeLimit ); 580 | ~MidiInCore( void ); 581 | RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; }; 582 | void openPort( unsigned int portNumber, const std::string portName ); 583 | void openVirtualPort( const std::string portName ); 584 | void closePort( void ); 585 | unsigned int getPortCount( void ); 586 | std::string getPortName( unsigned int portNumber ); 587 | 588 | protected: 589 | void initialize( const std::string& clientName ); 590 | }; 591 | 592 | class MidiOutCore: public MidiOutApi 593 | { 594 | public: 595 | MidiOutCore( const std::string clientName ); 596 | ~MidiOutCore( void ); 597 | RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; }; 598 | void openPort( unsigned int portNumber, const std::string portName ); 599 | void openVirtualPort( const std::string portName ); 600 | void closePort( void ); 601 | unsigned int getPortCount( void ); 602 | std::string getPortName( unsigned int portNumber ); 603 | void sendMessage( std::vector *message ); 604 | 605 | protected: 606 | void initialize( const std::string& clientName ); 607 | }; 608 | 609 | #endif 610 | 611 | #if defined(__UNIX_JACK__) 612 | 613 | class MidiInJack: public MidiInApi 614 | { 615 | public: 616 | MidiInJack( const std::string clientName, unsigned int queueSizeLimit ); 617 | ~MidiInJack( void ); 618 | RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; }; 619 | void openPort( unsigned int portNumber, const std::string portName ); 620 | void openVirtualPort( const std::string portName ); 621 | void closePort( void ); 622 | unsigned int getPortCount( void ); 623 | std::string getPortName( unsigned int portNumber ); 624 | 625 | protected: 626 | std::string clientName; 627 | 628 | void connect( void ); 629 | void initialize( const std::string& clientName ); 630 | }; 631 | 632 | class MidiOutJack: public MidiOutApi 633 | { 634 | public: 635 | MidiOutJack( const std::string clientName ); 636 | ~MidiOutJack( void ); 637 | RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; }; 638 | void openPort( unsigned int portNumber, const std::string portName ); 639 | void openVirtualPort( const std::string portName ); 640 | void closePort( void ); 641 | unsigned int getPortCount( void ); 642 | std::string getPortName( unsigned int portNumber ); 643 | void sendMessage( std::vector *message ); 644 | 645 | protected: 646 | std::string clientName; 647 | 648 | void connect( void ); 649 | void initialize( const std::string& clientName ); 650 | }; 651 | 652 | #endif 653 | 654 | #if defined(__LINUX_ALSA__) 655 | 656 | class MidiInAlsa: public MidiInApi 657 | { 658 | public: 659 | MidiInAlsa( const std::string clientName, unsigned int queueSizeLimit ); 660 | ~MidiInAlsa( void ); 661 | RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; }; 662 | void openPort( unsigned int portNumber, const std::string portName ); 663 | void openVirtualPort( const std::string portName ); 664 | void closePort( void ); 665 | unsigned int getPortCount( void ); 666 | std::string getPortName( unsigned int portNumber ); 667 | 668 | protected: 669 | void initialize( const std::string& clientName ); 670 | }; 671 | 672 | class MidiOutAlsa: public MidiOutApi 673 | { 674 | public: 675 | MidiOutAlsa( const std::string clientName ); 676 | ~MidiOutAlsa( void ); 677 | RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; }; 678 | void openPort( unsigned int portNumber, const std::string portName ); 679 | void openVirtualPort( const std::string portName ); 680 | void closePort( void ); 681 | unsigned int getPortCount( void ); 682 | std::string getPortName( unsigned int portNumber ); 683 | void sendMessage( std::vector *message ); 684 | 685 | protected: 686 | void initialize( const std::string& clientName ); 687 | }; 688 | 689 | #endif 690 | 691 | #if defined(__WINDOWS_MM__) 692 | 693 | class MidiInWinMM: public MidiInApi 694 | { 695 | public: 696 | MidiInWinMM( const std::string clientName, unsigned int queueSizeLimit ); 697 | ~MidiInWinMM( void ); 698 | RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; }; 699 | void openPort( unsigned int portNumber, const std::string portName ); 700 | void openVirtualPort( const std::string portName ); 701 | void closePort( void ); 702 | unsigned int getPortCount( void ); 703 | std::string getPortName( unsigned int portNumber ); 704 | 705 | protected: 706 | void initialize( const std::string& clientName ); 707 | }; 708 | 709 | class MidiOutWinMM: public MidiOutApi 710 | { 711 | public: 712 | MidiOutWinMM( const std::string clientName ); 713 | ~MidiOutWinMM( void ); 714 | RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; }; 715 | void openPort( unsigned int portNumber, const std::string portName ); 716 | void openVirtualPort( const std::string portName ); 717 | void closePort( void ); 718 | unsigned int getPortCount( void ); 719 | std::string getPortName( unsigned int portNumber ); 720 | void sendMessage( std::vector *message ); 721 | 722 | protected: 723 | void initialize( const std::string& clientName ); 724 | }; 725 | 726 | #endif 727 | 728 | #if defined(__RTMIDI_DUMMY__) 729 | 730 | class MidiInDummy: public MidiInApi 731 | { 732 | public: 733 | MidiInDummy( const std::string /*clientName*/, unsigned int queueSizeLimit ) : MidiInApi( queueSizeLimit ) { errorString_ = "MidiInDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); } 734 | RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; } 735 | void openPort( unsigned int /*portNumber*/, const std::string /*portName*/ ) {} 736 | void openVirtualPort( const std::string /*portName*/ ) {} 737 | void closePort( void ) {} 738 | unsigned int getPortCount( void ) { return 0; } 739 | std::string getPortName( unsigned int portNumber ) { return ""; } 740 | 741 | protected: 742 | void initialize( const std::string& /*clientName*/ ) {} 743 | }; 744 | 745 | class MidiOutDummy: public MidiOutApi 746 | { 747 | public: 748 | MidiOutDummy( const std::string /*clientName*/ ) { errorString_ = "MidiOutDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); } 749 | RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; } 750 | void openPort( unsigned int /*portNumber*/, const std::string /*portName*/ ) {} 751 | void openVirtualPort( const std::string /*portName*/ ) {} 752 | void closePort( void ) {} 753 | unsigned int getPortCount( void ) { return 0; } 754 | std::string getPortName( unsigned int /*portNumber*/ ) { return ""; } 755 | void sendMessage( std::vector * /*message*/ ) {} 756 | 757 | protected: 758 | void initialize( const std::string& /*clientName*/ ) {} 759 | }; 760 | 761 | #endif 762 | 763 | #endif 764 | -------------------------------------------------------------------------------- /glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dli/midismoke/1a5e2c3cbbe87b4b087cdcd40691e1a66d8bec08/glfw3.lib -------------------------------------------------------------------------------- /midismoke.cpp: -------------------------------------------------------------------------------- 1 | #include "glew.h" 2 | #include "glfw3.h" 3 | 4 | #include "RtMidi.h" 5 | 6 | #include 7 | #include 8 | 9 | #include "utilities.h" 10 | 11 | #include 12 | 13 | const double PI = 3.14159265358979323846264338327950; 14 | 15 | const int WINDOW_WIDTH = 1920; 16 | const int WINDOW_HEIGHT = 1080; 17 | 18 | const int SIMULATION_WIDTH = 300; 19 | const int SIMULATION_HEIGHT = 150; 20 | const int SIMULATION_DEPTH = 75; 21 | 22 | const float UNBLURRED_WEIGHT = 1.0f; 23 | const float BLURRED_WEIGHT = 3.0f; 24 | 25 | const float VELOCITY_DISSIPATION = 0.4f; 26 | const float DYE_DISSIPATION = 0.2f; 27 | const float TEMPERATURE_DISSIPATION = 0.2f; 28 | const float VORTICITY = 0.4f; 29 | 30 | const float LIGHT_DIRECTION[3] = { 0.0f, 1.0f, 1.0f }; 31 | const float CAMERA_DISTANCE = 220.0f; 32 | 33 | const float JUST_PRESSED_TEMPERATURE_SCALE = 6000.0f; 34 | const float NORMAL_TEMPERATURE_SCALE = 3600.0f; 35 | const float JUST_PRESSED_DYE_SCALE = 1.0f; 36 | const float NORMAL_DYE_SCALE = 3.0f; 37 | 38 | const float NOTE_X_SCALE = 5.0f; 39 | const float NOTE_X_OFFSET = -150.0f; 40 | const float SPLAT_Y = 7.5f; 41 | const float SPLAT_RADIUS = 7.0f; 42 | 43 | const float DENSITY_SCALE = 2.0f; 44 | const float COLOR_SCALE = 30.0f; 45 | 46 | const int BLUR_WIDTH = 500; 47 | const int BLUR_STEP = 10; 48 | const float BLUR_SIGMA = 100000.0f; 49 | 50 | const double INTENSITY_DECAY = 0.4; 51 | const int JACOBI_ITERATIONS = 30; 52 | 53 | const int RENDERING_STEPS = 150; 54 | const int TRANSPARENCY_STEPS = 100; 55 | const float RENDERING_STEP_SIZE = 1.0f; 56 | const float TRANSPARENCY_STEP_SIZE = 3.0f; 57 | 58 | const float AMBIENT = 0.2f; 59 | const float ABSORPTION = 5.0f; 60 | 61 | const float FOV_IN_DEGREES = 90.0f; 62 | 63 | const float NOTE_HUE_SCALE = 1.0f / 120.0f; 64 | const float NOTE_HUE_OFFSET = 0.2f; 65 | const float DYE_SATURATION = 0.7f; 66 | const float DYE_VALUE = 0.75f; 67 | 68 | struct Note { 69 | bool pressed = false; 70 | bool on = false; 71 | bool justPressed = false; 72 | double velocity = 0.0; 73 | double time = 0.0; 74 | }; 75 | 76 | const float QUAD_VERTICES[12] = { -1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0 }; 77 | 78 | GLFWwindow* window; 79 | 80 | GLuint velocityTextureA; 81 | GLuint velocityTextureB; 82 | GLuint dyeTextureA; 83 | GLuint dyeTextureB; 84 | GLuint temperatureTextureA; 85 | GLuint temperatureTextureB; 86 | GLuint divergenceTexture; 87 | GLuint pressureTextureA; 88 | GLuint pressureTextureB; 89 | GLuint phin1hatTexture; 90 | GLuint phinhatTexture; 91 | GLuint vorticityTexture; 92 | GLuint transparencyTexture; 93 | 94 | GLuint renderingTexture; 95 | GLuint blurredTextureA; 96 | GLuint blurredTextureB; 97 | 98 | GLuint renderingProgram; 99 | GLuint jacobiProgram; 100 | GLuint advectProgram; 101 | GLuint maccormackProgram; 102 | GLuint buoyancyProgram; 103 | GLuint divergenceProgram; 104 | GLuint subtractProgram; 105 | GLuint vorticityProgram; 106 | GLuint vorticityForceProgram; 107 | GLuint transparencyProgram; 108 | GLuint compositeProgram; 109 | GLuint blurProgram; 110 | GLuint addProgram; 111 | 112 | GLuint simulationFramebuffer; 113 | GLuint renderingFramebuffer; 114 | 115 | RtMidiIn *midiIn; 116 | 117 | float projectionMatrix[16]; 118 | 119 | Note notes[256]; 120 | bool pedalPressed = false; //if the pedal is held down 121 | 122 | void advect(GLuint velocityTexture, GLuint dataTexture, GLuint targetTexture, double deltaTime, double dissipation) { 123 | glBindFramebuffer(GL_FRAMEBUFFER, simulationFramebuffer); 124 | 125 | glViewport(0, 0, SIMULATION_WIDTH, SIMULATION_HEIGHT); 126 | 127 | glUseProgram(advectProgram); 128 | 129 | glUniform3f(glGetUniformLocation(advectProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 130 | 131 | glUniform1i(glGetUniformLocation(advectProgram, "u_velocityTexture"), 0); 132 | glActiveTexture(GL_TEXTURE0); 133 | glBindTexture(GL_TEXTURE_3D, velocityTexture); 134 | 135 | 136 | //compute phi hat n + 1 137 | 138 | glUniform1i(glGetUniformLocation(advectProgram, "u_dataTexture"), 1); 139 | glActiveTexture(GL_TEXTURE1); 140 | glBindTexture(GL_TEXTURE_3D, dataTexture); 141 | 142 | glUniform1f(glGetUniformLocation(advectProgram, "u_deltaTime"), deltaTime); 143 | 144 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, phin1hatTexture, 0); 145 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 146 | 147 | 148 | //compute phi hat n 149 | 150 | glUniform1i(glGetUniformLocation(advectProgram, "u_dataTexture"), 1); 151 | glActiveTexture(GL_TEXTURE1); 152 | glBindTexture(GL_TEXTURE_3D, phin1hatTexture); 153 | 154 | glUniform1f(glGetUniformLocation(advectProgram, "u_deltaTime"), -deltaTime); 155 | 156 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, phinhatTexture, 0); 157 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 158 | 159 | 160 | glUseProgram(maccormackProgram); 161 | 162 | glUniform3f(glGetUniformLocation(maccormackProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 163 | 164 | glUniform1f(glGetUniformLocation(maccormackProgram, "u_deltaTime"), deltaTime); 165 | 166 | glUniform1i(glGetUniformLocation(maccormackProgram, "u_velocityTexture"), 0); 167 | glActiveTexture(GL_TEXTURE0); 168 | glBindTexture(GL_TEXTURE_3D, velocityTexture); 169 | 170 | glUniform1i(glGetUniformLocation(maccormackProgram, "u_dataTexture"), 1); 171 | glActiveTexture(GL_TEXTURE1); 172 | glBindTexture(GL_TEXTURE_3D, dataTexture); 173 | 174 | glUniform1i(glGetUniformLocation(maccormackProgram, "u_phin1hatTexture"), 2); 175 | glActiveTexture(GL_TEXTURE2); 176 | glBindTexture(GL_TEXTURE_3D, phin1hatTexture); 177 | 178 | glUniform1i(glGetUniformLocation(maccormackProgram, "u_phinhatTexture"), 3); 179 | glActiveTexture(GL_TEXTURE3); 180 | glBindTexture(GL_TEXTURE_3D, phinhatTexture); 181 | 182 | glUniform1f(glGetUniformLocation(maccormackProgram, "u_dissipation"), dissipation); 183 | 184 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, targetTexture, 0); 185 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 186 | } 187 | 188 | void add(GLuint targetTexture, float positionX, float positionY, float positionZ, float radius, float valueR, float valueG, float valueB, float valueA) { 189 | glEnable(GL_BLEND); 190 | glBlendFunc(GL_ONE, GL_ONE); 191 | 192 | glBindFramebuffer(GL_FRAMEBUFFER, simulationFramebuffer); 193 | 194 | glViewport(0, 0, SIMULATION_WIDTH, SIMULATION_HEIGHT); 195 | 196 | glUseProgram(addProgram); 197 | 198 | glUniform3f(glGetUniformLocation(addProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 199 | glUniform3f(glGetUniformLocation(addProgram, "u_position"), positionX, positionY, positionZ); 200 | 201 | glUniform1f(glGetUniformLocation(addProgram, "u_radius"), radius); 202 | glUniform4f(glGetUniformLocation(addProgram, "u_value"), valueR, valueG, valueB, valueA); 203 | 204 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, targetTexture, 0); 205 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 206 | 207 | glDisable(GL_BLEND); 208 | } 209 | 210 | void setup() { 211 | float* emptyData = createEmptyArray(SIMULATION_WIDTH * SIMULATION_HEIGHT * SIMULATION_DEPTH * 4); 212 | 213 | velocityTextureA = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 214 | velocityTextureB = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 215 | dyeTextureA = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 216 | dyeTextureB = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 217 | temperatureTextureA = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 218 | temperatureTextureB = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 219 | divergenceTexture = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 220 | pressureTextureA = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 221 | pressureTextureB = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 222 | phin1hatTexture = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 223 | phinhatTexture = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 224 | vorticityTexture = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 225 | 226 | transparencyTexture = build3DTexture(GL_RGBA16F, GL_RGBA, SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH, GL_HALF_FLOAT, emptyData, GL_CLAMP_TO_EDGE, GL_LINEAR); 227 | 228 | delete[] emptyData; 229 | 230 | float* emptyData2D = createEmptyArray(WINDOW_WIDTH * WINDOW_HEIGHT * 4); 231 | 232 | renderingTexture = build2DTexture(GL_RGBA16F, GL_RGBA, WINDOW_WIDTH, WINDOW_HEIGHT, GL_HALF_FLOAT, emptyData2D, GL_CLAMP_TO_EDGE, GL_LINEAR); 233 | blurredTextureA = build2DTexture(GL_RGBA16F, GL_RGBA, WINDOW_WIDTH, WINDOW_HEIGHT, GL_HALF_FLOAT, emptyData2D, GL_CLAMP_TO_EDGE, GL_LINEAR); 234 | blurredTextureB = build2DTexture(GL_RGBA16F, GL_RGBA, WINDOW_WIDTH, WINDOW_HEIGHT, GL_HALF_FLOAT, emptyData2D, GL_CLAMP_TO_EDGE, GL_LINEAR); 235 | 236 | delete[] emptyData2D; 237 | 238 | makePerspectiveMatrix(projectionMatrix, static_cast(PI * FOV_IN_DEGREES / 180.0), static_cast(WINDOW_WIDTH) / static_cast(WINDOW_HEIGHT), 0.1f, 1000.0f); 239 | 240 | GLuint renderingVertexShader = buildShaderFromFile(GL_VERTEX_SHADER, "shaders/rendering.vert"); 241 | GLuint renderingFragmentShader = buildShader(GL_FRAGMENT_SHADER, ("#define RAY_STEPS " + std::to_string(RENDERING_STEPS) + " \n" + loadStringFromFile("shaders/rendering.frag")).c_str()); 242 | GLuint volumeVertexShader = buildShaderFromFile(GL_VERTEX_SHADER, "shaders/volume.vert"); 243 | GLuint volumeGeometryShader = buildShaderFromFile(GL_GEOMETRY_SHADER, "shaders/volume.geom"); 244 | GLuint jacobiFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/jacobi.frag"); 245 | GLuint advectFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/advect.frag"); 246 | GLuint maccormackFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/maccormack.frag"); 247 | GLuint buoyancyFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/buoyancy.frag"); 248 | GLuint divergenceFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/divergence.frag"); 249 | GLuint subtractFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/subtract.frag"); 250 | GLuint vorticityFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/vorticity.frag"); 251 | GLuint vorticityForceFragmentShader = buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/vorticityforce.frag"); 252 | GLuint transparencyFragmentShader = buildShader(GL_FRAGMENT_SHADER, ("#define RAY_STEPS " + std::to_string(TRANSPARENCY_STEPS) + " \n" + loadStringFromFile("shaders/transparency.frag")).c_str()); 253 | 254 | renderingProgram = buildProgram(renderingVertexShader, renderingFragmentShader); 255 | jacobiProgram = buildProgram(volumeVertexShader, volumeGeometryShader, jacobiFragmentShader); 256 | advectProgram = buildProgram(volumeVertexShader, volumeGeometryShader, advectFragmentShader); 257 | maccormackProgram = buildProgram(volumeVertexShader, volumeGeometryShader, maccormackFragmentShader); 258 | buoyancyProgram = buildProgram(volumeVertexShader, volumeGeometryShader, buoyancyFragmentShader); 259 | divergenceProgram = buildProgram(volumeVertexShader, volumeGeometryShader, divergenceFragmentShader); 260 | subtractProgram = buildProgram(volumeVertexShader, volumeGeometryShader, subtractFragmentShader); 261 | vorticityProgram = buildProgram(volumeVertexShader, volumeGeometryShader, vorticityFragmentShader); 262 | vorticityForceProgram = buildProgram(volumeVertexShader, volumeGeometryShader, vorticityForceFragmentShader); 263 | transparencyProgram = buildProgram(volumeVertexShader, volumeGeometryShader, transparencyFragmentShader); 264 | compositeProgram = buildProgram(buildShaderFromFile(GL_VERTEX_SHADER, "shaders/fullscreen.vert"), buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/composite.frag")); 265 | blurProgram = buildProgram(buildShaderFromFile(GL_VERTEX_SHADER, "shaders/fullscreen.vert"), 266 | buildShader(GL_FRAGMENT_SHADER, ( 267 | "#define BLUR_WIDTH " + std::to_string(BLUR_WIDTH) + " \n" + 268 | "#define BLUR_STEP " + std::to_string(BLUR_STEP) + " \n" + loadStringFromFile("shaders/blur.frag")).c_str())); 269 | addProgram = buildProgram(buildShaderFromFile(GL_VERTEX_SHADER, "shaders/add.vert"), buildShaderFromFile(GL_GEOMETRY_SHADER, "shaders/add.geom"), buildShaderFromFile(GL_FRAGMENT_SHADER, "shaders/add.frag")); 270 | 271 | glGenFramebuffers(1, &simulationFramebuffer); 272 | glGenFramebuffers(1, &renderingFramebuffer); 273 | } 274 | 275 | void update(double time, double deltaTime) { 276 | glBindFramebuffer(GL_FRAMEBUFFER, simulationFramebuffer); 277 | glViewport(0, 0, SIMULATION_WIDTH, SIMULATION_HEIGHT); 278 | 279 | 280 | // apply buoyancy ///// 281 | 282 | glUseProgram(buoyancyProgram); 283 | 284 | glUniform3f(glGetUniformLocation(buoyancyProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 285 | 286 | glUniform1f(glGetUniformLocation(buoyancyProgram, "u_deltaTime"), deltaTime); 287 | 288 | glUniform1i(glGetUniformLocation(buoyancyProgram, "u_velocityTexture"), 0); 289 | glActiveTexture(GL_TEXTURE0); 290 | glBindTexture(GL_TEXTURE_3D, velocityTextureA); 291 | glUniform1i(glGetUniformLocation(buoyancyProgram, "u_temperatureTexture"), 1); 292 | glActiveTexture(GL_TEXTURE1); 293 | glBindTexture(GL_TEXTURE_3D, temperatureTextureA); 294 | 295 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, velocityTextureB, 0); 296 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 297 | 298 | std::swap(velocityTextureA, velocityTextureB); 299 | 300 | advect(velocityTextureA, velocityTextureA, velocityTextureB, deltaTime, VELOCITY_DISSIPATION); 301 | std::swap(velocityTextureA, velocityTextureB); 302 | 303 | advect(velocityTextureA, dyeTextureA, dyeTextureB, deltaTime, DYE_DISSIPATION); 304 | std::swap(dyeTextureA, dyeTextureB); 305 | 306 | advect(velocityTextureA, temperatureTextureA, temperatureTextureB, deltaTime, TEMPERATURE_DISSIPATION); 307 | std::swap(temperatureTextureA, temperatureTextureB); 308 | 309 | 310 | // update MIDI ////// 311 | 312 | float stamp; 313 | std::vector message; 314 | while (stamp = midiIn->getMessage(&message)) { 315 | unsigned int nBytes = message.size(); 316 | 317 | unsigned char status = message.at(0); 318 | 319 | if (status == 144 || status == 176 || status == 128) { 320 | unsigned char noteIndex = message.at(1); 321 | 322 | unsigned char velocity = message.at(2); 323 | 324 | if (status == 176) { //pedal 325 | if (velocity >= 64) { 326 | pedalPressed = true; 327 | } 328 | else { 329 | pedalPressed = false; 330 | 331 | for (int i = 0; i < 256; ++i) { 332 | Note& note = notes[i]; 333 | if (!note.pressed) { //if this note is not being pressed we can stop it sounding 334 | note.on = false; 335 | } 336 | } 337 | } 338 | } 339 | 340 | if (status == 144 && velocity > 0) { //note pressed 341 | Note& note = notes[noteIndex]; 342 | note.pressed = true; 343 | note.on = true; 344 | note.justPressed = true; 345 | note.time = time; 346 | note.velocity = static_cast(velocity) / 256.0; //normalize velocity 347 | } 348 | else if (status == 144 && velocity == 0 || status == 128) { //note released 349 | Note& note = notes[noteIndex]; 350 | note.pressed = false; 351 | if (!pedalPressed) { 352 | note.on = false; 353 | } 354 | } 355 | } 356 | } 357 | 358 | 359 | // add dye and temperature /// 360 | 361 | for (int i = 0; i < 256; ++i) { 362 | Note& note = notes[i]; 363 | 364 | if (note.on) { 365 | double timeOn = time - note.time; //how long the note has been on for 366 | double noteIntensity = note.velocity * exp(-timeOn * INTENSITY_DECAY); 367 | 368 | int noteName = i % 12; 369 | 370 | float positionX = static_cast(i) * NOTE_X_SCALE + NOTE_X_OFFSET; 371 | float positionY = SPLAT_Y; 372 | float positionZ = static_cast(SIMULATION_DEPTH) / 2.0; 373 | 374 | add(temperatureTextureA, positionX, positionY, positionZ, SPLAT_RADIUS, note.justPressed ? JUST_PRESSED_TEMPERATURE_SCALE * noteIntensity : NORMAL_TEMPERATURE_SCALE * noteIntensity * deltaTime, 0.0, 0.0, 0.0); 375 | 376 | float r, g, b; 377 | hsvToRGB((static_cast(i) * NOTE_HUE_SCALE + NOTE_HUE_OFFSET), DYE_SATURATION, DYE_VALUE, r, g, b); 378 | 379 | //add dye 380 | float scale = note.justPressed ? JUST_PRESSED_DYE_SCALE * noteIntensity : NORMAL_DYE_SCALE * noteIntensity * deltaTime; 381 | 382 | add(dyeTextureA, positionX, positionY, positionZ, SPLAT_RADIUS, r * scale, g * scale, b * scale, 0.0); 383 | 384 | note.justPressed = false; 385 | } 386 | } 387 | 388 | 389 | // compute vorticity ////// 390 | 391 | glUseProgram(vorticityProgram); 392 | 393 | glUniform3f(glGetUniformLocation(vorticityProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 394 | 395 | glUniform1i(glGetUniformLocation(vorticityProgram, "u_velocityTexture"), 0); 396 | glActiveTexture(GL_TEXTURE0); 397 | glBindTexture(GL_TEXTURE_3D, velocityTextureA); 398 | 399 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, vorticityTexture, 0); 400 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 401 | 402 | 403 | // add vorticity force //////// 404 | 405 | glUseProgram(vorticityForceProgram); 406 | 407 | glUniform3f(glGetUniformLocation(vorticityForceProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 408 | 409 | glUniform1i(glGetUniformLocation(vorticityForceProgram, "u_velocityTexture"), 0); 410 | glActiveTexture(GL_TEXTURE0); 411 | glBindTexture(GL_TEXTURE_3D, velocityTextureA); 412 | 413 | glUniform1i(glGetUniformLocation(vorticityForceProgram, "u_vorticityTexture"), 1); 414 | glActiveTexture(GL_TEXTURE1); 415 | glBindTexture(GL_TEXTURE_3D, vorticityTexture); 416 | 417 | glUniform1f(glGetUniformLocation(vorticityForceProgram, "u_vorticity"), VORTICITY); 418 | 419 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, velocityTextureB, 0); 420 | 421 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 422 | 423 | std::swap(velocityTextureA, velocityTextureB); 424 | 425 | 426 | // compute divergence ////// 427 | 428 | glUseProgram(divergenceProgram); 429 | 430 | glUniform3f(glGetUniformLocation(divergenceProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 431 | 432 | glUniform1i(glGetUniformLocation(divergenceProgram, "u_velocityTexture"), 0); 433 | glActiveTexture(GL_TEXTURE0); 434 | glBindTexture(GL_TEXTURE_3D, velocityTextureA); 435 | 436 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, divergenceTexture, 0); 437 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 438 | 439 | 440 | // solve pressure via jacobi iterations //// 441 | 442 | glUseProgram(jacobiProgram); 443 | glUniform1i(glGetUniformLocation(jacobiProgram, "u_pressure"), 0); 444 | glUniform1i(glGetUniformLocation(jacobiProgram, "u_divergence"), 1); 445 | glUniform3f(glGetUniformLocation(jacobiProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 446 | 447 | for (int i = 0; i < JACOBI_ITERATIONS; ++i) { 448 | glActiveTexture(GL_TEXTURE0); 449 | glBindTexture(GL_TEXTURE_3D, pressureTextureA); 450 | 451 | glActiveTexture(GL_TEXTURE1); 452 | glBindTexture(GL_TEXTURE_3D, divergenceTexture); 453 | 454 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, pressureTextureB, 0); 455 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 456 | 457 | std::swap(pressureTextureA, pressureTextureB); 458 | } 459 | 460 | 461 | // subtract pressure ///// 462 | 463 | glUseProgram(subtractProgram); 464 | 465 | glUniform3f(glGetUniformLocation(subtractProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 466 | 467 | glUniform1i(glGetUniformLocation(subtractProgram, "u_pressure"), 0); 468 | glActiveTexture(GL_TEXTURE0); 469 | glBindTexture(GL_TEXTURE_3D, pressureTextureA); 470 | 471 | glUniform1i(glGetUniformLocation(subtractProgram, "u_velocityTexture"), 1); 472 | glActiveTexture(GL_TEXTURE1); 473 | glBindTexture(GL_TEXTURE_3D, velocityTextureA); 474 | 475 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, velocityTextureB, 0); 476 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 477 | 478 | std::swap(velocityTextureA, velocityTextureB); 479 | 480 | 481 | // compute transparency ////// 482 | 483 | glUseProgram(transparencyProgram); 484 | 485 | glUniform3f(glGetUniformLocation(transparencyProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 486 | glUniform3fv(glGetUniformLocation(transparencyProgram, "u_lightDirection"), 1, &LIGHT_DIRECTION[0]); 487 | 488 | glUniform1i(glGetUniformLocation(transparencyProgram, "u_dyeTexture"), 0); 489 | glActiveTexture(GL_TEXTURE0); 490 | glBindTexture(GL_TEXTURE_3D, dyeTextureA); 491 | 492 | glUniform1f(glGetUniformLocation(transparencyProgram, "u_absorption"), ABSORPTION); 493 | glUniform1f(glGetUniformLocation(transparencyProgram, "u_ambient"), AMBIENT); 494 | 495 | glUniform1f(glGetUniformLocation(transparencyProgram, "u_stepSize"), TRANSPARENCY_STEP_SIZE); 496 | 497 | glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, transparencyTexture, 0); 498 | glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, SIMULATION_DEPTH); 499 | 500 | 501 | // render scene to texture ///// 502 | 503 | glBindFramebuffer(GL_FRAMEBUFFER, renderingFramebuffer); 504 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, renderingTexture, 0); 505 | 506 | glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); 507 | 508 | glClearColor(0.0, 0.0, 0.0, 1.0); 509 | glClear(GL_COLOR_BUFFER_BIT); 510 | 511 | glUseProgram(renderingProgram); 512 | 513 | glUniform1i(glGetUniformLocation(renderingProgram, "u_input"), 0); 514 | glUniform3f(glGetUniformLocation(renderingProgram, "u_resolution"), SIMULATION_WIDTH, SIMULATION_HEIGHT, SIMULATION_DEPTH); 515 | 516 | glUniformMatrix4fv(glGetUniformLocation(renderingProgram, "u_projectionMatrix"), 1, GL_FALSE, projectionMatrix); 517 | 518 | glUniform1f(glGetUniformLocation(renderingProgram, "u_cameraDistance"), CAMERA_DISTANCE); 519 | 520 | glActiveTexture(GL_TEXTURE0); 521 | glBindTexture(GL_TEXTURE_3D, dyeTextureA); 522 | 523 | glUniform1i(glGetUniformLocation(renderingProgram, "u_transparencyTexture"), 1); 524 | glActiveTexture(GL_TEXTURE1); 525 | glBindTexture(GL_TEXTURE_3D, transparencyTexture); 526 | 527 | glEnable(GL_BLEND); 528 | glBlendEquation(GL_ADD); 529 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 530 | 531 | glUniform1f(glGetUniformLocation(renderingProgram, "u_densityScale"), DENSITY_SCALE); 532 | glUniform1f(glGetUniformLocation(renderingProgram, "u_colorScale"), COLOR_SCALE); 533 | 534 | glUniform1f(glGetUniformLocation(renderingProgram, "u_stepSize"), RENDERING_STEP_SIZE); 535 | 536 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 537 | 538 | glDisable(GL_BLEND); 539 | 540 | 541 | // gaussian blur the rendering texture //// 542 | 543 | glBindFramebuffer(GL_FRAMEBUFFER, renderingFramebuffer); 544 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, blurredTextureA, 0); 545 | 546 | glUseProgram(blurProgram); 547 | 548 | glUniform1f(glGetUniformLocation(blurProgram, "u_blurSigma"), BLUR_SIGMA); 549 | 550 | glUniform1i(glGetUniformLocation(blurProgram, "u_input"), 0); 551 | glActiveTexture(GL_TEXTURE0); 552 | glBindTexture(GL_TEXTURE_2D, renderingTexture); 553 | 554 | glUniform2f(glGetUniformLocation(blurProgram, "u_resolution"), WINDOW_WIDTH, WINDOW_HEIGHT); 555 | 556 | glUniform1i(glGetUniformLocation(blurProgram, "u_direction"), 0); //horizontal 557 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 558 | 559 | glActiveTexture(GL_TEXTURE0); 560 | glBindTexture(GL_TEXTURE_2D, blurredTextureA); 561 | 562 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, blurredTextureB, 0); 563 | 564 | glUniform1i(glGetUniformLocation(blurProgram, "u_direction"), 1); //vertical 565 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 566 | 567 | 568 | // composite unblurred and blurred textures to screen ///// 569 | 570 | glBindFramebuffer(GL_FRAMEBUFFER, NULL); 571 | glClearColor(0.0, 0.0, 0.0, 1.0); 572 | glClear(GL_COLOR_BUFFER_BIT); 573 | glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); 574 | 575 | glUseProgram(compositeProgram); 576 | 577 | glUniform1i(glGetUniformLocation(compositeProgram, "u_unblurredTexture"), 0); 578 | glActiveTexture(GL_TEXTURE0); 579 | glBindTexture(GL_TEXTURE_2D, renderingTexture); 580 | 581 | glUniform1i(glGetUniformLocation(compositeProgram, "u_blurredTexture"), 1); 582 | glActiveTexture(GL_TEXTURE1); 583 | glBindTexture(GL_TEXTURE_2D, blurredTextureB); 584 | 585 | glUniform2f(glGetUniformLocation(compositeProgram, "u_resolution"), WINDOW_WIDTH, WINDOW_HEIGHT); 586 | 587 | glUniform1f(glGetUniformLocation(compositeProgram, "u_unblurredWeight"), UNBLURRED_WEIGHT); 588 | glUniform1f(glGetUniformLocation(compositeProgram, "u_blurredWeight"), BLURRED_WEIGHT); 589 | 590 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 591 | } 592 | 593 | int main() { 594 | glfwInit(); 595 | glfwWindowHint(GLFW_RESIZABLE, false); 596 | window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "MIDI Smoke Simulator", NULL, NULL); 597 | glfwMakeContextCurrent(window); 598 | 599 | glewInit(); 600 | 601 | midiIn = new RtMidiIn(); 602 | 603 | unsigned int nPorts = midiIn->getPortCount(); 604 | if (nPorts == 0) { 605 | delete midiIn; 606 | return 0; 607 | } 608 | 609 | midiIn->openPort(); 610 | 611 | setup(); 612 | 613 | glEnableVertexAttribArray(0); 614 | glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, QUAD_VERTICES); 615 | 616 | double lastTime = glfwGetTime(); 617 | 618 | while (!glfwWindowShouldClose(window)) { 619 | double time = glfwGetTime(); 620 | double deltaTime = time - lastTime; 621 | lastTime = time; 622 | 623 | update(time, deltaTime); 624 | 625 | glfwSwapBuffers(window); 626 | glfwPollEvents(); 627 | } 628 | 629 | glfwTerminate(); 630 | 631 | delete midiIn; 632 | 633 | return 0; 634 | } -------------------------------------------------------------------------------- /midismoke.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "midismoke", "midismoke.vcxproj", "{FE260D12-1E2E-4947-AA29-5602881D20D8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FE260D12-1E2E-4947-AA29-5602881D20D8}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {FE260D12-1E2E-4947-AA29-5602881D20D8}.Debug|Win32.Build.0 = Debug|Win32 16 | {FE260D12-1E2E-4947-AA29-5602881D20D8}.Release|Win32.ActiveCfg = Release|Win32 17 | {FE260D12-1E2E-4947-AA29-5602881D20D8}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /midismoke.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {FE260D12-1E2E-4947-AA29-5602881D20D8} 15 | Win32Proj 16 | midismoke 17 | 18 | 19 | 20 | Application 21 | true 22 | v120 23 | Unicode 24 | 25 | 26 | Application 27 | false 28 | v120 29 | true 30 | Unicode 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | opengl32.lib;winmm.lib;glfw3.lib;%(AdditionalDependencies) 60 | 61 | 62 | 63 | 64 | Level3 65 | 66 | 67 | MaxSpeed 68 | true 69 | true 70 | WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 71 | 72 | 73 | Console 74 | true 75 | true 76 | true 77 | opengl32.lib;winmm.lib;glfw3.lib;%(AdditionalDependencies) 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /midismoke.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /shaders/add.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform vec3 u_position; 10 | uniform vec4 u_value; 11 | uniform float u_radius; 12 | 13 | void main () { 14 | vec3 coordinates = vec3(gl_FragCoord.xy, v_layer); 15 | float dist = distance(coordinates, u_position); 16 | vec4 scaledValue = max(1.0 - dist / u_radius, 0.0) * u_value; 17 | gl_FragColor = scaledValue; 18 | }; 19 | -------------------------------------------------------------------------------- /shaders/add.geom: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles) in; 4 | layout (triangle_strip, max_vertices = 3) out; 5 | 6 | in int v_instance[3]; 7 | out float v_layer; 8 | 9 | void main () { 10 | gl_Layer = v_instance[0]; 11 | v_layer = float(v_instance[0]) + 0.5; 12 | gl_Position = gl_in[0].gl_Position; 13 | EmitVertex(); 14 | gl_Position = gl_in[1].gl_Position; 15 | EmitVertex(); 16 | gl_Position = gl_in[2].gl_Position; 17 | EmitVertex(); 18 | EndPrimitive(); 19 | } -------------------------------------------------------------------------------- /shaders/add.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | in layout(location = 0) vec2 a_position; 4 | 5 | out int v_instance; 6 | 7 | uniform vec3 u_position; 8 | uniform vec3 u_resolution; 9 | uniform float u_radius; 10 | 11 | void main () { 12 | v_instance = gl_InstanceID; 13 | 14 | vec2 center = (u_position.xy / u_resolution.xy) * 2.0 - 1.0; 15 | 16 | gl_Position = vec4(center + a_position * 2.0 * u_radius / u_resolution.xy, 0.0, 1.0); 17 | 18 | } -------------------------------------------------------------------------------- /shaders/advect.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | uniform sampler3D u_velocityTexture; 9 | uniform sampler3D u_dataTexture; //data to be advected 10 | 11 | uniform float u_deltaTime; 12 | 13 | void main () { 14 | vec3 coordinates = vec3(gl_FragCoord.xy, v_layer); 15 | vec3 currentVelocity = texture(u_velocityTexture, coordinates / u_resolution).rgb; 16 | vec4 data = texture(u_dataTexture, (coordinates - currentVelocity * u_deltaTime) / u_resolution); 17 | gl_FragColor = data; 18 | }; -------------------------------------------------------------------------------- /shaders/blur.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | uniform sampler2D u_input; 4 | uniform vec2 u_resolution; 5 | 6 | uniform int u_direction; //0 = horizontal, 1 = vertical 7 | 8 | uniform float u_blurSigma; 9 | 10 | void main () { 11 | vec2 coordinates = gl_FragCoord.xy / u_resolution.xy; 12 | 13 | vec3 total = vec3(0.0); 14 | float weight = 0.0; 15 | 16 | float dx = 1.0 / u_resolution.x; 17 | float dy = 1.0 / u_resolution.y; 18 | 19 | for (int i = -BLUR_WIDTH; i <= BLUR_WIDTH; i += BLUR_STEP) { 20 | 21 | float offset = float(i); //ofset in pixels 22 | 23 | float gaussian = exp(-float(offset * offset) / u_blurSigma); 24 | weight += gaussian; 25 | 26 | if (u_direction == 0) { 27 | total += texture(u_input, coordinates + vec2(offset * dx, 0.0)).rgb * gaussian; 28 | } else { 29 | total += texture(u_input, coordinates + vec2(0.0, offset * dy)).rgb * gaussian; 30 | } 31 | 32 | } 33 | 34 | total /= weight; 35 | 36 | gl_FragColor = vec4(total, 1.0); 37 | } -------------------------------------------------------------------------------- /shaders/buoyancy.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | uniform sampler3D u_velocityTexture; 9 | uniform sampler3D u_temperatureTexture; 10 | 11 | uniform float u_deltaTime; 12 | 13 | uniform vec3 u_position; 14 | 15 | void main () { 16 | 17 | vec3 coordinates = vec3(gl_FragCoord.xy, v_layer); 18 | vec3 currentVelocity = texture(u_velocityTexture, coordinates / u_resolution).rgb; 19 | float temperature = texture(u_temperatureTexture, coordinates / u_resolution).r; 20 | 21 | vec3 up = vec3(0.0, 1.0, 0.0); 22 | vec3 force = temperature * up * u_deltaTime; 23 | 24 | gl_FragColor = vec4(currentVelocity + force, 0.0); 25 | 26 | } -------------------------------------------------------------------------------- /shaders/composite.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | uniform sampler2D u_unblurredTexture; 4 | uniform sampler2D u_blurredTexture; 5 | uniform vec2 u_resolution; 6 | 7 | uniform float u_time; 8 | 9 | uniform float u_unblurredWeight; 10 | uniform float u_blurredWeight; 11 | 12 | void main () { 13 | vec2 coordinates = gl_FragCoord.xy / u_resolution.xy; 14 | 15 | vec3 color = texture(u_unblurredTexture, coordinates).rgb * u_unblurredWeight + texture(u_blurredTexture, coordinates).rgb * u_blurredWeight; 16 | 17 | gl_FragColor = vec4(color, 1.0); 18 | } -------------------------------------------------------------------------------- /shaders/divergence.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | uniform sampler3D u_velocityTexture; 9 | 10 | void main () { 11 | vec3 coordinates = vec3(gl_FragCoord.xy / u_resolution.xy, v_layer / u_resolution.z); 12 | vec3 delta = 1.0 / u_resolution; 13 | 14 | vec3 left = texture(u_velocityTexture, coordinates + vec3(-delta.x, 0.0, 0.0)).rgb; 15 | vec3 right = texture(u_velocityTexture, coordinates + vec3(delta.x, 0.0, 0.0)).rgb; 16 | vec3 bottom = texture(u_velocityTexture, coordinates + vec3(0.0, -delta.y, 0.0)).rgb; 17 | vec3 top = texture(u_velocityTexture, coordinates + vec3(0.0, delta.y, 0.0)).rgb; 18 | vec3 back = texture(u_velocityTexture, coordinates + vec3(0.0, 0.0, -delta.z)).rgb; 19 | vec3 front = texture(u_velocityTexture, coordinates + vec3(0.0, 0.0, delta.z)).rgb; 20 | 21 | if (coordinates.x - delta.x < 0.0) left = vec3(0.0); 22 | if (coordinates.x + delta.x > 1.0) right = vec3(0.0); 23 | if (coordinates.y - delta.y < 0.0) bottom = vec3(0.0); 24 | if (coordinates.y + delta.y > 1.0) top = vec3(0.0); 25 | if (coordinates.z - delta.z < 0.0) back = vec3(0.0); 26 | if (coordinates.z + delta.z > 1.0) front = vec3(0.0); 27 | 28 | float divergence = ((right.x - left.x) + (top.y - bottom.y) + (front.z - back.z)) / 2.0; 29 | 30 | gl_FragColor = vec4(divergence, 0.0, 0.0, 0.0); 31 | } -------------------------------------------------------------------------------- /shaders/fullscreen.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | in layout(location = 0) vec2 a_position; 4 | 5 | void main () { 6 | gl_Position = vec4(a_position, 0.0, 1.0); 7 | } -------------------------------------------------------------------------------- /shaders/jacobi.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform sampler3D u_pressure; 10 | uniform sampler3D u_divergence; 11 | 12 | void main () { 13 | vec3 coordinates = vec3(gl_FragCoord.xy / u_resolution.xy, v_layer / u_resolution.z); 14 | vec3 delta = 1.0 / u_resolution; 15 | 16 | float divergenceCenter = texture(u_divergence, coordinates).r; 17 | 18 | float center = texture(u_pressure, coordinates).r; 19 | float left = texture(u_pressure, coordinates + vec3(-delta.x, 0.0, 0.0)).r; 20 | float right = texture(u_pressure, coordinates + vec3(delta.x, 0.0, 0.0)).r; 21 | float bottom = texture(u_pressure, coordinates + vec3(0.0, -delta.y, 0.0)).r; 22 | float top = texture(u_pressure, coordinates + vec3(0.0, delta.y, 0.0)).r; 23 | float back = texture(u_pressure, coordinates + vec3(0.0, 0.0, -delta.z)).r; 24 | float front = texture(u_pressure, coordinates + vec3(0.0, 0.0, delta.z)).r; 25 | 26 | if (coordinates.x - delta.x < 0.0) left = center; 27 | if (coordinates.x + delta.x > 1.0) right = center; 28 | if (coordinates.y - delta.y < 0.0) bottom = center; 29 | if (coordinates.y + delta.y > 1.0) top = center; 30 | if (coordinates.z - delta.z < 0.0) back = center; 31 | if (coordinates.z + delta.z > 1.0) front = center; 32 | 33 | gl_FragColor = vec4((left + right + bottom + top + back + front - divergenceCenter) / 6.0, 0.0, 0.0, 0.0); 34 | } -------------------------------------------------------------------------------- /shaders/maccormack.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | uniform sampler3D u_velocityTexture; 9 | uniform sampler3D u_dataTexture; //data to be advected 10 | 11 | uniform sampler3D u_phin1hatTexture; 12 | uniform sampler3D u_phinhatTexture; 13 | 14 | uniform float u_dissipation; 15 | 16 | uniform float u_deltaTime; 17 | 18 | void main () { 19 | vec3 coordinates = vec3(gl_FragCoord.xy, v_layer); 20 | vec3 currentVelocity = texture(u_velocityTexture, coordinates / u_resolution).rgb; 21 | vec3 npos = coordinates - currentVelocity * u_deltaTime; 22 | 23 | npos = floor(npos); //integer bottom-left-back corner (in the middle of the 8 texels we want) 24 | npos = (npos + 0.5) / u_resolution; 25 | 26 | vec3 offset = 0.5 / u_resolution; 27 | 28 | vec4 value0 = texture(u_dataTexture, npos + vec3(-offset.x, -offset.y, -offset.z)); 29 | vec4 value1 = texture(u_dataTexture, npos + vec3(-offset.x, -offset.y, offset.z)); 30 | vec4 value2 = texture(u_dataTexture, npos + vec3(-offset.x, offset.y, -offset.z)); 31 | vec4 value3 = texture(u_dataTexture, npos + vec3(-offset.x, offset.y, offset.z)); 32 | vec4 value4 = texture(u_dataTexture, npos + vec3(offset.x, -offset.y, -offset.z)); 33 | vec4 value5 = texture(u_dataTexture, npos + vec3(offset.x, -offset.y, offset.z)); 34 | vec4 value6 = texture(u_dataTexture, npos + vec3(offset.x, offset.y, -offset.z)); 35 | vec4 value7 = texture(u_dataTexture, npos + vec3(offset.x, offset.y, offset.z)); 36 | 37 | vec4 dataMin = min(min(min(min(min(min(min( 38 | value0, value1), value2), value3), 39 | value4), value5), value6), value7); 40 | 41 | vec4 dataMax = max(max(max(max(max(max(max( 42 | value0, value1), value2), value3), 43 | value4), value5), value6), value7); 44 | 45 | vec4 phin1hat = texture(u_phin1hatTexture, (coordinates - currentVelocity * u_deltaTime) / u_resolution); 46 | vec4 phinhat = texture(u_phinhatTexture, coordinates / u_resolution); 47 | vec4 phin = texture(u_dataTexture, coordinates / u_resolution); 48 | 49 | vec4 value = (phin1hat + 0.5 * (phin - phinhat)); 50 | 51 | gl_FragColor = clamp(value, dataMin, dataMax) * pow((1.0 - u_dissipation), u_deltaTime); 52 | } -------------------------------------------------------------------------------- /shaders/rendering.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | in vec3 v_position; 6 | 7 | uniform vec3 u_resolution; 8 | uniform sampler3D u_input; 9 | uniform sampler3D u_transparencyTexture; 10 | 11 | uniform float u_cameraDistance; 12 | 13 | uniform float u_densityScale; 14 | uniform float u_colorScale; 15 | 16 | uniform float u_stepSize; 17 | 18 | void main () { 19 | vec3 cameraPosition = vec3(0.0, 0.0, u_cameraDistance); 20 | 21 | vec3 rayDirection = normalize(v_position - cameraPosition); 22 | 23 | vec3 currentPosition = v_position; 24 | 25 | vec4 finalColor = vec4(0.0); 26 | 27 | for (int i = 0; i < RAY_STEPS; ++i) { 28 | 29 | currentPosition += rayDirection * u_stepSize; 30 | 31 | if (currentPosition.x > -u_resolution.x && currentPosition.x < u_resolution.x && currentPosition.y > -u_resolution.y && currentPosition.y < u_resolution.y && currentPosition.z > -u_resolution.z && currentPosition.z < u_resolution.z) { 32 | 33 | vec3 color = texture(u_input, (currentPosition / u_resolution) * 0.5 + 0.5).rgb; 34 | float density = color.r + color.g + color.b; 35 | 36 | density *= u_densityScale; 37 | 38 | color *= u_colorScale; 39 | 40 | float transparency = texture(u_transparencyTexture, (currentPosition / u_resolution) * 0.5 + 0.5).r; 41 | 42 | color *= transparency; 43 | 44 | finalColor.rgb += color * density * (1.0 - finalColor.a); 45 | finalColor.a += density * (1.0 - finalColor.a); 46 | 47 | } else { 48 | break; 49 | } 50 | 51 | } 52 | 53 | gl_FragColor = vec4(finalColor.rgb, 1.0); 54 | } -------------------------------------------------------------------------------- /shaders/rendering.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | in layout(location = 0) vec2 a_position; 4 | 5 | out vec3 v_position; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform float u_cameraDistance; 10 | 11 | uniform mat4 u_projectionMatrix; 12 | 13 | void main () { 14 | vec3 position = vec3(a_position.xy * u_resolution.xy, u_resolution.z); 15 | v_position = position; 16 | 17 | gl_Position = u_projectionMatrix * vec4(position + vec3(0.0, 0.0, -u_cameraDistance), 1.0); 18 | } -------------------------------------------------------------------------------- /shaders/subtract.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform sampler3D u_velocityTexture; 10 | uniform sampler3D u_pressure; 11 | 12 | void main () { 13 | vec3 coordinates = vec3(gl_FragCoord.xy / u_resolution.xy, v_layer / u_resolution.z); 14 | vec3 delta = 1.0 / u_resolution; 15 | 16 | float center = texture(u_pressure, coordinates).r; 17 | float left = texture(u_pressure, coordinates + vec3(-delta.x, 0.0, 0.0)).r; 18 | float right = texture(u_pressure, coordinates + vec3(delta.x, 0.0, 0.0)).r; 19 | float bottom = texture(u_pressure, coordinates + vec3(0.0, -delta.y, 0.0)).r; 20 | float top = texture(u_pressure, coordinates + vec3(0.0, delta.y, 0.0)).r; 21 | float back = texture(u_pressure, coordinates + vec3(0.0, 0.0, -delta.z)).r; 22 | float front = texture(u_pressure, coordinates + vec3(0.0, 0.0, delta.z)).r; 23 | 24 | if (coordinates.x - delta.x < 0.0) left = center; 25 | if (coordinates.x + delta.x > 1.0) right = center; 26 | if (coordinates.y - delta.y < 0.0) bottom = center; 27 | if (coordinates.y + delta.y > 1.0) top = center; 28 | if (coordinates.z - delta.z < 0.0) back = center; 29 | if (coordinates.z + delta.z > 1.0) front = center; 30 | 31 | 32 | //compute gradient of pressure 33 | vec3 gradient = vec3(right - left, top - bottom, front - back) / 2.0; 34 | 35 | vec3 currentVelocity = texture(u_velocityTexture, coordinates).rgb; 36 | 37 | gl_FragColor = vec4(currentVelocity - gradient, 0.0); 38 | } -------------------------------------------------------------------------------- /shaders/transparency.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform sampler3D u_dyeTexture; 10 | 11 | uniform vec3 u_lightDirection; 12 | 13 | uniform float u_absorption; 14 | uniform float u_ambient; 15 | 16 | uniform float u_stepSize; 17 | 18 | void main () { 19 | 20 | vec3 coordinates = vec3(gl_FragCoord.xy, v_layer); 21 | vec3 delta = 1.0 / u_resolution; 22 | 23 | vec3 rayPosition = vec3(gl_FragCoord.xy, v_layer); 24 | 25 | float totalDensity = 0.0; 26 | 27 | for (int i = 0; i < RAY_STEPS; ++i) { 28 | rayPosition += normalize(u_lightDirection) * u_stepSize; 29 | 30 | if (rayPosition.x > 0.0 && rayPosition.x < u_resolution.x && rayPosition.y > 0.0 && rayPosition.y < u_resolution.y && rayPosition.z > 0.0 && rayPosition.z < u_resolution.z) { 31 | 32 | float density = dot(texture(u_dyeTexture, rayPosition / u_resolution).rgb, vec3(1.0)); 33 | totalDensity += density; 34 | 35 | } else { 36 | break; 37 | } 38 | 39 | } 40 | 41 | float transparency = exp(-totalDensity * u_absorption); 42 | 43 | gl_FragColor = vec4(vec3(transparency) + u_ambient, 0.0); 44 | 45 | } -------------------------------------------------------------------------------- /shaders/volume.geom: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles) in; 4 | layout (triangle_strip, max_vertices = 3) out; 5 | 6 | in int v_instance[3]; 7 | out float v_layer; 8 | 9 | void main () { 10 | gl_Layer = v_instance[0]; 11 | v_layer = float(v_instance[0]) + 0.5; 12 | gl_Position = gl_in[0].gl_Position; 13 | EmitVertex(); 14 | gl_Position = gl_in[1].gl_Position; 15 | EmitVertex(); 16 | gl_Position = gl_in[2].gl_Position; 17 | EmitVertex(); 18 | EndPrimitive(); 19 | }; -------------------------------------------------------------------------------- /shaders/volume.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | in layout(location = 0) vec2 a_position; 4 | 5 | out int v_instance; 6 | 7 | void main () { 8 | v_instance = gl_InstanceID; 9 | gl_Position = vec4(a_position, 0.0, 1.0); 10 | }; -------------------------------------------------------------------------------- /shaders/vorticity.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform sampler3D u_velocityTexture; 10 | 11 | void main () { 12 | vec3 coordinates = vec3(gl_FragCoord.xy / u_resolution.xy, v_layer / u_resolution.z); 13 | vec3 delta = 1.0 / u_resolution; 14 | 15 | vec3 center = texture(u_velocityTexture, coordinates).rgb; 16 | vec3 left = texture(u_velocityTexture, coordinates + vec3(-delta.x, 0.0, 0.0)).rgb; 17 | vec3 right = texture(u_velocityTexture, coordinates + vec3(delta.x, 0.0, 0.0)).rgb; 18 | vec3 bottom = texture(u_velocityTexture, coordinates + vec3(0.0, -delta.y, 0.0)).rgb; 19 | vec3 top = texture(u_velocityTexture, coordinates + vec3(0.0, delta.y, 0.0)).rgb; 20 | vec3 back = texture(u_velocityTexture, coordinates + vec3(0.0, 0.0, -delta.z)).rgb; 21 | vec3 front = texture(u_velocityTexture, coordinates + vec3(0.0, 0.0, delta.z)).rgb; 22 | 23 | if (coordinates.x - delta.x < 0.0) left = vec3(0.0); 24 | if (coordinates.x + delta.x > 1.0) right = vec3(0.0); 25 | if (coordinates.y - delta.y < 0.0) bottom = vec3(0.0); 26 | if (coordinates.y + delta.y > 1.0) top = vec3(0.0); 27 | if (coordinates.z - delta.z < 0.0) back = vec3(0.0); 28 | if (coordinates.z + delta.z > 1.0) front = vec3(0.0); 29 | 30 | vec3 vorticity = vec3( 31 | (top.z - bottom.z) - (front.y - back.y), 32 | (front.x - back.x) - (right.z - left.z), 33 | (right.y - left.y) - (top.x - bottom.x) 34 | ); 35 | 36 | gl_FragColor = vec4(vorticity, 0.0); 37 | } -------------------------------------------------------------------------------- /shaders/vorticityforce.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | precision highp float; 4 | 5 | varying float v_layer; 6 | 7 | uniform vec3 u_resolution; 8 | 9 | uniform sampler3D u_velocityTexture; 10 | uniform sampler3D u_vorticityTexture; 11 | 12 | uniform float u_vorticity; 13 | 14 | void main () { 15 | vec3 coordinates = vec3(gl_FragCoord.xy / u_resolution.xy, v_layer / u_resolution.z); 16 | vec3 delta = 1.0 / u_resolution; 17 | 18 | vec3 center = texture(u_vorticityTexture, coordinates).rgb; 19 | vec3 left = texture(u_vorticityTexture, coordinates + vec3(-delta.x, 0.0, 0.0)).rgb; 20 | vec3 right = texture(u_vorticityTexture, coordinates + vec3(delta.x, 0.0, 0.0)).rgb; 21 | vec3 bottom = texture(u_vorticityTexture, coordinates + vec3(0.0, -delta.y, 0.0)).rgb; 22 | vec3 top = texture(u_vorticityTexture, coordinates + vec3(0.0, delta.y, 0.0)).rgb; 23 | vec3 back = texture(u_vorticityTexture, coordinates + vec3(0.0, 0.0, -delta.z)).rgb; 24 | vec3 front = texture(u_vorticityTexture, coordinates + vec3(0.0, 0.0, delta.z)).rgb; 25 | 26 | if (coordinates.x - delta.x < 0.0) left = center; 27 | if (coordinates.x + delta.x > 1.0) right = center; 28 | if (coordinates.y - delta.y < 0.0) bottom = center; 29 | if (coordinates.y + delta.y > 1.0) top = center; 30 | if (coordinates.z - delta.z < 0.0) back = center; 31 | if (coordinates.z + delta.z > 1.0) front = center; 32 | 33 | vec3 gradient = vec3(length(right) - length(left), length(top) - length(bottom), length(front) - length(back)) / 2.0; 34 | 35 | //safe normalize 36 | float epsilon = 0.0001; 37 | float magnitudeSquared = max(epsilon, dot(gradient, gradient)); 38 | gradient /= sqrt(magnitudeSquared); 39 | 40 | vec3 force = u_vorticity * cross(gradient, center); 41 | 42 | vec3 currentVelocity = texture(u_velocityTexture, coordinates).rgb; 43 | 44 | gl_FragColor = vec4(currentVelocity + force, 0.0); 45 | } -------------------------------------------------------------------------------- /utilities.cpp: -------------------------------------------------------------------------------- 1 | #include "utilities.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | std::string loadStringFromFile(const char* fileName) { 11 | std::string text = ""; 12 | 13 | std::ifstream file(fileName); 14 | text.assign((std::istreambuf_iterator(file)), std::istreambuf_iterator()); 15 | 16 | return text; 17 | } 18 | 19 | GLuint buildShaderFromFile(const GLenum type, const char* fileName) { 20 | std::string source = loadStringFromFile(fileName); 21 | 22 | GLuint shader = glCreateShader(type); 23 | const GLchar* shaderSource = source.c_str(); 24 | glShaderSource(shader, 1, (const GLchar**)&shaderSource, NULL); 25 | glCompileShader(shader); 26 | 27 | GLint isCompiled = 0; 28 | glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled); 29 | if (isCompiled == GL_FALSE) { 30 | GLint maxLength = 0; 31 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength); 32 | 33 | std::vector errorLog(maxLength); 34 | glGetShaderInfoLog(shader, maxLength, &maxLength, &errorLog[0]); 35 | 36 | for (auto c : errorLog) { 37 | std::cout << c; 38 | } 39 | std::cout << std::endl; 40 | 41 | glDeleteShader(shader); 42 | return 0; 43 | } 44 | 45 | return shader; 46 | } 47 | 48 | GLuint buildShader(const GLenum type, const char* source) { 49 | GLuint shader = glCreateShader(type); 50 | glShaderSource(shader, 1, &source, 0); 51 | glCompileShader(shader); 52 | 53 | GLint isCompiled = 0; 54 | glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled); 55 | if (isCompiled == GL_FALSE) { 56 | GLint maxLength = 0; 57 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength); 58 | 59 | std::vector errorLog(maxLength); 60 | glGetShaderInfoLog(shader, maxLength, &maxLength, &errorLog[0]); 61 | 62 | for (auto c : errorLog) { 63 | std::cout << c; 64 | } 65 | std::cout << std::endl; 66 | 67 | glDeleteShader(shader); 68 | return 0; 69 | } 70 | 71 | return shader; 72 | } 73 | 74 | GLuint buildProgram(const GLuint vertexShader, const GLuint fragmentShader) { 75 | GLuint program = glCreateProgram(); 76 | glAttachShader(program, vertexShader); 77 | glAttachShader(program, fragmentShader); 78 | glLinkProgram(program); 79 | 80 | return program; 81 | } 82 | 83 | GLuint buildProgram(const GLuint vertexShader, const GLuint geometryShader, const GLuint fragmentShader) { 84 | GLuint program = glCreateProgram(); 85 | glAttachShader(program, vertexShader); 86 | glAttachShader(program, geometryShader); 87 | glAttachShader(program, fragmentShader); 88 | glLinkProgram(program); 89 | 90 | int isLinked; 91 | glGetProgramiv(program, GL_LINK_STATUS, (int *)&isLinked); 92 | if (isLinked == GL_FALSE) std::cout << "Program link failed" << std::endl; 93 | 94 | return program; 95 | } 96 | 97 | GLuint build3DTexture(const GLenum iformat, const GLenum format, const int width, const int height, const int depth, GLenum type, GLvoid* data, GLenum wrap, GLenum filter) { 98 | GLuint texture = 0; 99 | glGenTextures(1, &texture); 100 | glActiveTexture(GL_TEXTURE0); 101 | glBindTexture(GL_TEXTURE_3D, texture); 102 | 103 | glTexImage3D(GL_TEXTURE_3D, 0, iformat, width, height, depth, 0, format, type, data); 104 | 105 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, wrap); 106 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, wrap); 107 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, wrap); 108 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, filter); 109 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, filter); 110 | 111 | return texture; 112 | } 113 | 114 | GLuint build2DTexture(const GLenum const iformat, const GLenum format, const GLsizei width, const GLsizei height, const GLenum type, const GLvoid* data, const GLenum wrap, const GLenum filter) { 115 | GLuint texture = 0; 116 | glGenTextures(1, &texture); 117 | glActiveTexture(GL_TEXTURE0); 118 | glBindTexture(GL_TEXTURE_2D, texture); 119 | 120 | glTexImage2D(GL_TEXTURE_2D, 0, iformat, width, height, 0, format, type, data); 121 | 122 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap); 123 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap); 124 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); 125 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); 126 | 127 | return texture; 128 | } 129 | 130 | void hsvToRGB(float h, float s, float v, float& r, float& g, float& b) { 131 | h = fmod(h, 1.0); 132 | 133 | float c = v * s; 134 | 135 | float hDash = h * 6; 136 | 137 | float x = c * (1 - abs(fmod(hDash, 2.0) - 1)); 138 | 139 | int mod = floor(hDash); 140 | 141 | float arrayR[6] = { c, x, 0, 0, x, c }; 142 | float arrayG[6] = { x, c, c, x, 0, 0 }; 143 | float arrayB[6] = { 0, 0, x, c, c, x }; 144 | 145 | r = arrayR[mod]; 146 | g = arrayG[mod]; 147 | b = arrayB[mod]; 148 | 149 | float m = v - c; 150 | 151 | r += m; 152 | g += m; 153 | b += m; 154 | }; 155 | 156 | void makePerspectiveMatrix (float* matrix, float fov, float aspect, float near, float far) { 157 | float f = tan(0.5 * (3.14159265 - fov)), 158 | range = near - far; 159 | 160 | matrix[0] = f / aspect; 161 | matrix[1] = 0; 162 | matrix[2] = 0; 163 | matrix[3] = 0; 164 | matrix[4] = 0; 165 | matrix[5] = f; 166 | matrix[6] = 0; 167 | matrix[7] = 0; 168 | matrix[8] = 0; 169 | matrix[9] = 0; 170 | matrix[10] = far / range; 171 | matrix[11] = -1; 172 | matrix[12] = 0; 173 | matrix[13] = 0; 174 | matrix[14] = (near * far) / range; 175 | matrix[15] = 0.0; 176 | }; 177 | 178 | float* createEmptyArray(int size) { 179 | float* emptyData = new float[size]; 180 | for (int i = 0; i < size; ++i) { 181 | emptyData[i] = 0.0; 182 | } 183 | return emptyData; 184 | } -------------------------------------------------------------------------------- /utilities.h: -------------------------------------------------------------------------------- 1 | #include "glew.h" 2 | #include "glfw3.h" 3 | 4 | #include 5 | 6 | std::string loadStringFromFile(const char* fileName); 7 | GLuint buildShaderFromFile(const GLenum type, const char* fileName); 8 | GLuint buildShader(const GLenum type, const char* source); 9 | GLuint buildProgram(GLuint vertexShader, GLuint fragmentShader); 10 | GLuint buildProgram(const GLuint vertexShader, const GLuint geometryShader, const GLuint fragmentShader); 11 | GLuint build3DTexture(const GLenum iformat, const GLenum format, const GLsizei width, const GLsizei height, const GLsizei depth, const GLenum type, GLvoid* data, GLenum wrap, GLenum filter); 12 | GLuint build2DTexture(const GLenum iformat, const GLenum format, const GLsizei width, const GLsizei height, const GLenum type, const GLvoid* data, const GLenum wrap, const GLenum filter); 13 | float* createEmptyArray(int size); 14 | void hsvToRGB(float h, float s, float v, float& r, float& g, float& b); 15 | void makePerspectiveMatrix(float* matrix, float fov, float aspect, float near, float far); -------------------------------------------------------------------------------- /wglew.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** The OpenGL Extension Wrangler Library 3 | ** Copyright (C) 2008-2014, Nigel Stewart 4 | ** Copyright (C) 2002-2008, Milan Ikits 5 | ** Copyright (C) 2002-2008, Marcelo E. Magallon 6 | ** Copyright (C) 2002, Lev Povalahev 7 | ** All rights reserved. 8 | ** 9 | ** Redistribution and use in source and binary forms, with or without 10 | ** modification, are permitted provided that the following conditions are met: 11 | ** 12 | ** * Redistributions of source code must retain the above copyright notice, 13 | ** this list of conditions and the following disclaimer. 14 | ** * Redistributions in binary form must reproduce the above copyright notice, 15 | ** this list of conditions and the following disclaimer in the documentation 16 | ** and/or other materials provided with the distribution. 17 | ** * The name of the author may be used to endorse or promote products 18 | ** derived from this software without specific prior written permission. 19 | ** 20 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 | ** THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | ** Copyright (c) 2007 The Khronos Group Inc. 35 | ** 36 | ** Permission is hereby granted, free of charge, to any person obtaining a 37 | ** copy of this software and/or associated documentation files (the 38 | ** "Materials"), to deal in the Materials without restriction, including 39 | ** without limitation the rights to use, copy, modify, merge, publish, 40 | ** distribute, sublicense, and/or sell copies of the Materials, and to 41 | ** permit persons to whom the Materials are furnished to do so, subject to 42 | ** the following conditions: 43 | ** 44 | ** The above copyright notice and this permission notice shall be included 45 | ** in all copies or substantial portions of the Materials. 46 | ** 47 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 48 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 49 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 50 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 51 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 52 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 53 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 54 | */ 55 | 56 | #ifndef __wglew_h__ 57 | #define __wglew_h__ 58 | #define __WGLEW_H__ 59 | 60 | #ifdef __wglext_h_ 61 | #error wglext.h included before wglew.h 62 | #endif 63 | 64 | #define __wglext_h_ 65 | 66 | #if !defined(WINAPI) 67 | # ifndef WIN32_LEAN_AND_MEAN 68 | # define WIN32_LEAN_AND_MEAN 1 69 | # endif 70 | #include 71 | # undef WIN32_LEAN_AND_MEAN 72 | #endif 73 | 74 | /* 75 | * GLEW_STATIC needs to be set when using the static version. 76 | * GLEW_BUILD is set when building the DLL version. 77 | */ 78 | #ifdef GLEW_STATIC 79 | # define GLEWAPI extern 80 | #else 81 | # ifdef GLEW_BUILD 82 | # define GLEWAPI extern __declspec(dllexport) 83 | # else 84 | # define GLEWAPI extern __declspec(dllimport) 85 | # endif 86 | #endif 87 | 88 | #ifdef __cplusplus 89 | extern "C" { 90 | #endif 91 | 92 | /* -------------------------- WGL_3DFX_multisample ------------------------- */ 93 | 94 | #ifndef WGL_3DFX_multisample 95 | #define WGL_3DFX_multisample 1 96 | 97 | #define WGL_SAMPLE_BUFFERS_3DFX 0x2060 98 | #define WGL_SAMPLES_3DFX 0x2061 99 | 100 | #define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample) 101 | 102 | #endif /* WGL_3DFX_multisample */ 103 | 104 | /* ------------------------- WGL_3DL_stereo_control ------------------------ */ 105 | 106 | #ifndef WGL_3DL_stereo_control 107 | #define WGL_3DL_stereo_control 1 108 | 109 | #define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 110 | #define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 111 | #define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 112 | #define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 113 | 114 | typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); 115 | 116 | #define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL) 117 | 118 | #define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control) 119 | 120 | #endif /* WGL_3DL_stereo_control */ 121 | 122 | /* ------------------------ WGL_AMD_gpu_association ------------------------ */ 123 | 124 | #ifndef WGL_AMD_gpu_association 125 | #define WGL_AMD_gpu_association 1 126 | 127 | #define WGL_GPU_VENDOR_AMD 0x1F00 128 | #define WGL_GPU_RENDERER_STRING_AMD 0x1F01 129 | #define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 130 | #define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 131 | #define WGL_GPU_RAM_AMD 0x21A3 132 | #define WGL_GPU_CLOCK_AMD 0x21A4 133 | #define WGL_GPU_NUM_PIPES_AMD 0x21A5 134 | #define WGL_GPU_NUM_SIMD_AMD 0x21A6 135 | #define WGL_GPU_NUM_RB_AMD 0x21A7 136 | #define WGL_GPU_NUM_SPI_AMD 0x21A8 137 | 138 | typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); 139 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); 140 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList); 141 | typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); 142 | typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); 143 | typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); 144 | typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids); 145 | typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); 146 | typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); 147 | 148 | #define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD) 149 | #define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD) 150 | #define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD) 151 | #define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD) 152 | #define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD) 153 | #define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD) 154 | #define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD) 155 | #define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD) 156 | #define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD) 157 | 158 | #define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association) 159 | 160 | #endif /* WGL_AMD_gpu_association */ 161 | 162 | /* ------------------------- WGL_ARB_buffer_region ------------------------- */ 163 | 164 | #ifndef WGL_ARB_buffer_region 165 | #define WGL_ARB_buffer_region 1 166 | 167 | #define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 168 | #define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 169 | #define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 170 | #define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 171 | 172 | typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); 173 | typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); 174 | typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); 175 | typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); 176 | 177 | #define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB) 178 | #define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB) 179 | #define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB) 180 | #define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB) 181 | 182 | #define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region) 183 | 184 | #endif /* WGL_ARB_buffer_region */ 185 | 186 | /* --------------------- WGL_ARB_context_flush_control --------------------- */ 187 | 188 | #ifndef WGL_ARB_context_flush_control 189 | #define WGL_ARB_context_flush_control 1 190 | 191 | #define WGLEW_ARB_context_flush_control WGLEW_GET_VAR(__WGLEW_ARB_context_flush_control) 192 | 193 | #endif /* WGL_ARB_context_flush_control */ 194 | 195 | /* ------------------------- WGL_ARB_create_context ------------------------ */ 196 | 197 | #ifndef WGL_ARB_create_context 198 | #define WGL_ARB_create_context 1 199 | 200 | #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 201 | #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 202 | #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 203 | #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 204 | #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 205 | #define WGL_CONTEXT_FLAGS_ARB 0x2094 206 | #define ERROR_INVALID_VERSION_ARB 0x2095 207 | #define ERROR_INVALID_PROFILE_ARB 0x2096 208 | 209 | typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList); 210 | 211 | #define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB) 212 | 213 | #define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context) 214 | 215 | #endif /* WGL_ARB_create_context */ 216 | 217 | /* --------------------- WGL_ARB_create_context_profile -------------------- */ 218 | 219 | #ifndef WGL_ARB_create_context_profile 220 | #define WGL_ARB_create_context_profile 1 221 | 222 | #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 223 | #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 224 | #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 225 | 226 | #define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile) 227 | 228 | #endif /* WGL_ARB_create_context_profile */ 229 | 230 | /* ------------------- WGL_ARB_create_context_robustness ------------------- */ 231 | 232 | #ifndef WGL_ARB_create_context_robustness 233 | #define WGL_ARB_create_context_robustness 1 234 | 235 | #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 236 | #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 237 | #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 238 | #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 239 | 240 | #define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness) 241 | 242 | #endif /* WGL_ARB_create_context_robustness */ 243 | 244 | /* ----------------------- WGL_ARB_extensions_string ----------------------- */ 245 | 246 | #ifndef WGL_ARB_extensions_string 247 | #define WGL_ARB_extensions_string 1 248 | 249 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); 250 | 251 | #define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB) 252 | 253 | #define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string) 254 | 255 | #endif /* WGL_ARB_extensions_string */ 256 | 257 | /* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */ 258 | 259 | #ifndef WGL_ARB_framebuffer_sRGB 260 | #define WGL_ARB_framebuffer_sRGB 1 261 | 262 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 263 | 264 | #define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB) 265 | 266 | #endif /* WGL_ARB_framebuffer_sRGB */ 267 | 268 | /* ----------------------- WGL_ARB_make_current_read ----------------------- */ 269 | 270 | #ifndef WGL_ARB_make_current_read 271 | #define WGL_ARB_make_current_read 1 272 | 273 | #define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 274 | #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 275 | 276 | typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); 277 | typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); 278 | 279 | #define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) 280 | #define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB) 281 | 282 | #define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read) 283 | 284 | #endif /* WGL_ARB_make_current_read */ 285 | 286 | /* -------------------------- WGL_ARB_multisample -------------------------- */ 287 | 288 | #ifndef WGL_ARB_multisample 289 | #define WGL_ARB_multisample 1 290 | 291 | #define WGL_SAMPLE_BUFFERS_ARB 0x2041 292 | #define WGL_SAMPLES_ARB 0x2042 293 | 294 | #define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample) 295 | 296 | #endif /* WGL_ARB_multisample */ 297 | 298 | /* ---------------------------- WGL_ARB_pbuffer ---------------------------- */ 299 | 300 | #ifndef WGL_ARB_pbuffer 301 | #define WGL_ARB_pbuffer 1 302 | 303 | #define WGL_DRAW_TO_PBUFFER_ARB 0x202D 304 | #define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E 305 | #define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F 306 | #define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 307 | #define WGL_PBUFFER_LARGEST_ARB 0x2033 308 | #define WGL_PBUFFER_WIDTH_ARB 0x2034 309 | #define WGL_PBUFFER_HEIGHT_ARB 0x2035 310 | #define WGL_PBUFFER_LOST_ARB 0x2036 311 | 312 | DECLARE_HANDLE(HPBUFFERARB); 313 | 314 | typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); 315 | typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); 316 | typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); 317 | typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue); 318 | typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); 319 | 320 | #define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB) 321 | #define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB) 322 | #define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB) 323 | #define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB) 324 | #define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB) 325 | 326 | #define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer) 327 | 328 | #endif /* WGL_ARB_pbuffer */ 329 | 330 | /* -------------------------- WGL_ARB_pixel_format ------------------------- */ 331 | 332 | #ifndef WGL_ARB_pixel_format 333 | #define WGL_ARB_pixel_format 1 334 | 335 | #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 336 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 337 | #define WGL_DRAW_TO_BITMAP_ARB 0x2002 338 | #define WGL_ACCELERATION_ARB 0x2003 339 | #define WGL_NEED_PALETTE_ARB 0x2004 340 | #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 341 | #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 342 | #define WGL_SWAP_METHOD_ARB 0x2007 343 | #define WGL_NUMBER_OVERLAYS_ARB 0x2008 344 | #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 345 | #define WGL_TRANSPARENT_ARB 0x200A 346 | #define WGL_SHARE_DEPTH_ARB 0x200C 347 | #define WGL_SHARE_STENCIL_ARB 0x200D 348 | #define WGL_SHARE_ACCUM_ARB 0x200E 349 | #define WGL_SUPPORT_GDI_ARB 0x200F 350 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 351 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 352 | #define WGL_STEREO_ARB 0x2012 353 | #define WGL_PIXEL_TYPE_ARB 0x2013 354 | #define WGL_COLOR_BITS_ARB 0x2014 355 | #define WGL_RED_BITS_ARB 0x2015 356 | #define WGL_RED_SHIFT_ARB 0x2016 357 | #define WGL_GREEN_BITS_ARB 0x2017 358 | #define WGL_GREEN_SHIFT_ARB 0x2018 359 | #define WGL_BLUE_BITS_ARB 0x2019 360 | #define WGL_BLUE_SHIFT_ARB 0x201A 361 | #define WGL_ALPHA_BITS_ARB 0x201B 362 | #define WGL_ALPHA_SHIFT_ARB 0x201C 363 | #define WGL_ACCUM_BITS_ARB 0x201D 364 | #define WGL_ACCUM_RED_BITS_ARB 0x201E 365 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201F 366 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 367 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 368 | #define WGL_DEPTH_BITS_ARB 0x2022 369 | #define WGL_STENCIL_BITS_ARB 0x2023 370 | #define WGL_AUX_BUFFERS_ARB 0x2024 371 | #define WGL_NO_ACCELERATION_ARB 0x2025 372 | #define WGL_GENERIC_ACCELERATION_ARB 0x2026 373 | #define WGL_FULL_ACCELERATION_ARB 0x2027 374 | #define WGL_SWAP_EXCHANGE_ARB 0x2028 375 | #define WGL_SWAP_COPY_ARB 0x2029 376 | #define WGL_SWAP_UNDEFINED_ARB 0x202A 377 | #define WGL_TYPE_RGBA_ARB 0x202B 378 | #define WGL_TYPE_COLORINDEX_ARB 0x202C 379 | #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 380 | #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 381 | #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 382 | #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A 383 | #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B 384 | 385 | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 386 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); 387 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); 388 | 389 | #define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) 390 | #define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) 391 | #define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB) 392 | 393 | #define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format) 394 | 395 | #endif /* WGL_ARB_pixel_format */ 396 | 397 | /* ----------------------- WGL_ARB_pixel_format_float ---------------------- */ 398 | 399 | #ifndef WGL_ARB_pixel_format_float 400 | #define WGL_ARB_pixel_format_float 1 401 | 402 | #define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 403 | 404 | #define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float) 405 | 406 | #endif /* WGL_ARB_pixel_format_float */ 407 | 408 | /* ------------------------- WGL_ARB_render_texture ------------------------ */ 409 | 410 | #ifndef WGL_ARB_render_texture 411 | #define WGL_ARB_render_texture 1 412 | 413 | #define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 414 | #define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 415 | #define WGL_TEXTURE_FORMAT_ARB 0x2072 416 | #define WGL_TEXTURE_TARGET_ARB 0x2073 417 | #define WGL_MIPMAP_TEXTURE_ARB 0x2074 418 | #define WGL_TEXTURE_RGB_ARB 0x2075 419 | #define WGL_TEXTURE_RGBA_ARB 0x2076 420 | #define WGL_NO_TEXTURE_ARB 0x2077 421 | #define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 422 | #define WGL_TEXTURE_1D_ARB 0x2079 423 | #define WGL_TEXTURE_2D_ARB 0x207A 424 | #define WGL_MIPMAP_LEVEL_ARB 0x207B 425 | #define WGL_CUBE_MAP_FACE_ARB 0x207C 426 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D 427 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E 428 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F 429 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 430 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 431 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 432 | #define WGL_FRONT_LEFT_ARB 0x2083 433 | #define WGL_FRONT_RIGHT_ARB 0x2084 434 | #define WGL_BACK_LEFT_ARB 0x2085 435 | #define WGL_BACK_RIGHT_ARB 0x2086 436 | #define WGL_AUX0_ARB 0x2087 437 | #define WGL_AUX1_ARB 0x2088 438 | #define WGL_AUX2_ARB 0x2089 439 | #define WGL_AUX3_ARB 0x208A 440 | #define WGL_AUX4_ARB 0x208B 441 | #define WGL_AUX5_ARB 0x208C 442 | #define WGL_AUX6_ARB 0x208D 443 | #define WGL_AUX7_ARB 0x208E 444 | #define WGL_AUX8_ARB 0x208F 445 | #define WGL_AUX9_ARB 0x2090 446 | 447 | typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); 448 | typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); 449 | typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList); 450 | 451 | #define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB) 452 | #define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB) 453 | #define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB) 454 | 455 | #define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture) 456 | 457 | #endif /* WGL_ARB_render_texture */ 458 | 459 | /* ---------------- WGL_ARB_robustness_application_isolation --------------- */ 460 | 461 | #ifndef WGL_ARB_robustness_application_isolation 462 | #define WGL_ARB_robustness_application_isolation 1 463 | 464 | #define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 465 | 466 | #define WGLEW_ARB_robustness_application_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_application_isolation) 467 | 468 | #endif /* WGL_ARB_robustness_application_isolation */ 469 | 470 | /* ---------------- WGL_ARB_robustness_share_group_isolation --------------- */ 471 | 472 | #ifndef WGL_ARB_robustness_share_group_isolation 473 | #define WGL_ARB_robustness_share_group_isolation 1 474 | 475 | #define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 476 | 477 | #define WGLEW_ARB_robustness_share_group_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_share_group_isolation) 478 | 479 | #endif /* WGL_ARB_robustness_share_group_isolation */ 480 | 481 | /* ----------------------- WGL_ATI_pixel_format_float ---------------------- */ 482 | 483 | #ifndef WGL_ATI_pixel_format_float 484 | #define WGL_ATI_pixel_format_float 1 485 | 486 | #define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 487 | #define GL_RGBA_FLOAT_MODE_ATI 0x8820 488 | #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 489 | 490 | #define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float) 491 | 492 | #endif /* WGL_ATI_pixel_format_float */ 493 | 494 | /* -------------------- WGL_ATI_render_texture_rectangle ------------------- */ 495 | 496 | #ifndef WGL_ATI_render_texture_rectangle 497 | #define WGL_ATI_render_texture_rectangle 1 498 | 499 | #define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 500 | 501 | #define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle) 502 | 503 | #endif /* WGL_ATI_render_texture_rectangle */ 504 | 505 | /* ------------------- WGL_EXT_create_context_es2_profile ------------------ */ 506 | 507 | #ifndef WGL_EXT_create_context_es2_profile 508 | #define WGL_EXT_create_context_es2_profile 1 509 | 510 | #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 511 | 512 | #define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile) 513 | 514 | #endif /* WGL_EXT_create_context_es2_profile */ 515 | 516 | /* ------------------- WGL_EXT_create_context_es_profile ------------------- */ 517 | 518 | #ifndef WGL_EXT_create_context_es_profile 519 | #define WGL_EXT_create_context_es_profile 1 520 | 521 | #define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 522 | 523 | #define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile) 524 | 525 | #endif /* WGL_EXT_create_context_es_profile */ 526 | 527 | /* -------------------------- WGL_EXT_depth_float -------------------------- */ 528 | 529 | #ifndef WGL_EXT_depth_float 530 | #define WGL_EXT_depth_float 1 531 | 532 | #define WGL_DEPTH_FLOAT_EXT 0x2040 533 | 534 | #define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float) 535 | 536 | #endif /* WGL_EXT_depth_float */ 537 | 538 | /* ---------------------- WGL_EXT_display_color_table ---------------------- */ 539 | 540 | #ifndef WGL_EXT_display_color_table 541 | #define WGL_EXT_display_color_table 1 542 | 543 | typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); 544 | typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); 545 | typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); 546 | typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); 547 | 548 | #define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) 549 | #define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) 550 | #define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT) 551 | #define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT) 552 | 553 | #define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table) 554 | 555 | #endif /* WGL_EXT_display_color_table */ 556 | 557 | /* ----------------------- WGL_EXT_extensions_string ----------------------- */ 558 | 559 | #ifndef WGL_EXT_extensions_string 560 | #define WGL_EXT_extensions_string 1 561 | 562 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); 563 | 564 | #define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT) 565 | 566 | #define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string) 567 | 568 | #endif /* WGL_EXT_extensions_string */ 569 | 570 | /* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */ 571 | 572 | #ifndef WGL_EXT_framebuffer_sRGB 573 | #define WGL_EXT_framebuffer_sRGB 1 574 | 575 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 576 | 577 | #define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB) 578 | 579 | #endif /* WGL_EXT_framebuffer_sRGB */ 580 | 581 | /* ----------------------- WGL_EXT_make_current_read ----------------------- */ 582 | 583 | #ifndef WGL_EXT_make_current_read 584 | #define WGL_EXT_make_current_read 1 585 | 586 | #define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 587 | 588 | typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); 589 | typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); 590 | 591 | #define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) 592 | #define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT) 593 | 594 | #define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read) 595 | 596 | #endif /* WGL_EXT_make_current_read */ 597 | 598 | /* -------------------------- WGL_EXT_multisample -------------------------- */ 599 | 600 | #ifndef WGL_EXT_multisample 601 | #define WGL_EXT_multisample 1 602 | 603 | #define WGL_SAMPLE_BUFFERS_EXT 0x2041 604 | #define WGL_SAMPLES_EXT 0x2042 605 | 606 | #define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample) 607 | 608 | #endif /* WGL_EXT_multisample */ 609 | 610 | /* ---------------------------- WGL_EXT_pbuffer ---------------------------- */ 611 | 612 | #ifndef WGL_EXT_pbuffer 613 | #define WGL_EXT_pbuffer 1 614 | 615 | #define WGL_DRAW_TO_PBUFFER_EXT 0x202D 616 | #define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E 617 | #define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F 618 | #define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 619 | #define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 620 | #define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 621 | #define WGL_PBUFFER_LARGEST_EXT 0x2033 622 | #define WGL_PBUFFER_WIDTH_EXT 0x2034 623 | #define WGL_PBUFFER_HEIGHT_EXT 0x2035 624 | 625 | DECLARE_HANDLE(HPBUFFEREXT); 626 | 627 | typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); 628 | typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); 629 | typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); 630 | typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue); 631 | typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); 632 | 633 | #define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT) 634 | #define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT) 635 | #define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT) 636 | #define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT) 637 | #define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT) 638 | 639 | #define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer) 640 | 641 | #endif /* WGL_EXT_pbuffer */ 642 | 643 | /* -------------------------- WGL_EXT_pixel_format ------------------------- */ 644 | 645 | #ifndef WGL_EXT_pixel_format 646 | #define WGL_EXT_pixel_format 1 647 | 648 | #define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 649 | #define WGL_DRAW_TO_WINDOW_EXT 0x2001 650 | #define WGL_DRAW_TO_BITMAP_EXT 0x2002 651 | #define WGL_ACCELERATION_EXT 0x2003 652 | #define WGL_NEED_PALETTE_EXT 0x2004 653 | #define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 654 | #define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 655 | #define WGL_SWAP_METHOD_EXT 0x2007 656 | #define WGL_NUMBER_OVERLAYS_EXT 0x2008 657 | #define WGL_NUMBER_UNDERLAYS_EXT 0x2009 658 | #define WGL_TRANSPARENT_EXT 0x200A 659 | #define WGL_TRANSPARENT_VALUE_EXT 0x200B 660 | #define WGL_SHARE_DEPTH_EXT 0x200C 661 | #define WGL_SHARE_STENCIL_EXT 0x200D 662 | #define WGL_SHARE_ACCUM_EXT 0x200E 663 | #define WGL_SUPPORT_GDI_EXT 0x200F 664 | #define WGL_SUPPORT_OPENGL_EXT 0x2010 665 | #define WGL_DOUBLE_BUFFER_EXT 0x2011 666 | #define WGL_STEREO_EXT 0x2012 667 | #define WGL_PIXEL_TYPE_EXT 0x2013 668 | #define WGL_COLOR_BITS_EXT 0x2014 669 | #define WGL_RED_BITS_EXT 0x2015 670 | #define WGL_RED_SHIFT_EXT 0x2016 671 | #define WGL_GREEN_BITS_EXT 0x2017 672 | #define WGL_GREEN_SHIFT_EXT 0x2018 673 | #define WGL_BLUE_BITS_EXT 0x2019 674 | #define WGL_BLUE_SHIFT_EXT 0x201A 675 | #define WGL_ALPHA_BITS_EXT 0x201B 676 | #define WGL_ALPHA_SHIFT_EXT 0x201C 677 | #define WGL_ACCUM_BITS_EXT 0x201D 678 | #define WGL_ACCUM_RED_BITS_EXT 0x201E 679 | #define WGL_ACCUM_GREEN_BITS_EXT 0x201F 680 | #define WGL_ACCUM_BLUE_BITS_EXT 0x2020 681 | #define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 682 | #define WGL_DEPTH_BITS_EXT 0x2022 683 | #define WGL_STENCIL_BITS_EXT 0x2023 684 | #define WGL_AUX_BUFFERS_EXT 0x2024 685 | #define WGL_NO_ACCELERATION_EXT 0x2025 686 | #define WGL_GENERIC_ACCELERATION_EXT 0x2026 687 | #define WGL_FULL_ACCELERATION_EXT 0x2027 688 | #define WGL_SWAP_EXCHANGE_EXT 0x2028 689 | #define WGL_SWAP_COPY_EXT 0x2029 690 | #define WGL_SWAP_UNDEFINED_EXT 0x202A 691 | #define WGL_TYPE_RGBA_EXT 0x202B 692 | #define WGL_TYPE_COLORINDEX_EXT 0x202C 693 | 694 | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 695 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); 696 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); 697 | 698 | #define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) 699 | #define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) 700 | #define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT) 701 | 702 | #define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format) 703 | 704 | #endif /* WGL_EXT_pixel_format */ 705 | 706 | /* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */ 707 | 708 | #ifndef WGL_EXT_pixel_format_packed_float 709 | #define WGL_EXT_pixel_format_packed_float 1 710 | 711 | #define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 712 | 713 | #define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float) 714 | 715 | #endif /* WGL_EXT_pixel_format_packed_float */ 716 | 717 | /* -------------------------- WGL_EXT_swap_control ------------------------- */ 718 | 719 | #ifndef WGL_EXT_swap_control 720 | #define WGL_EXT_swap_control 1 721 | 722 | typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); 723 | typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); 724 | 725 | #define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT) 726 | #define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT) 727 | 728 | #define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control) 729 | 730 | #endif /* WGL_EXT_swap_control */ 731 | 732 | /* ----------------------- WGL_EXT_swap_control_tear ----------------------- */ 733 | 734 | #ifndef WGL_EXT_swap_control_tear 735 | #define WGL_EXT_swap_control_tear 1 736 | 737 | #define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear) 738 | 739 | #endif /* WGL_EXT_swap_control_tear */ 740 | 741 | /* --------------------- WGL_I3D_digital_video_control --------------------- */ 742 | 743 | #ifndef WGL_I3D_digital_video_control 744 | #define WGL_I3D_digital_video_control 1 745 | 746 | #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 747 | #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 748 | #define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 749 | #define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 750 | 751 | typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); 752 | typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); 753 | 754 | #define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D) 755 | #define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D) 756 | 757 | #define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control) 758 | 759 | #endif /* WGL_I3D_digital_video_control */ 760 | 761 | /* ----------------------------- WGL_I3D_gamma ----------------------------- */ 762 | 763 | #ifndef WGL_I3D_gamma 764 | #define WGL_I3D_gamma 1 765 | 766 | #define WGL_GAMMA_TABLE_SIZE_I3D 0x204E 767 | #define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F 768 | 769 | typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); 770 | typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); 771 | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); 772 | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); 773 | 774 | #define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) 775 | #define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D) 776 | #define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D) 777 | #define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D) 778 | 779 | #define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma) 780 | 781 | #endif /* WGL_I3D_gamma */ 782 | 783 | /* ---------------------------- WGL_I3D_genlock ---------------------------- */ 784 | 785 | #ifndef WGL_I3D_genlock 786 | #define WGL_I3D_genlock 1 787 | 788 | #define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 789 | #define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 790 | #define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 791 | #define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 792 | #define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 793 | #define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 794 | #define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A 795 | #define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B 796 | #define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C 797 | 798 | typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); 799 | typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); 800 | typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); 801 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); 802 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); 803 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); 804 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate); 805 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay); 806 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); 807 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); 808 | typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); 809 | typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); 810 | 811 | #define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) 812 | #define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) 813 | #define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D) 814 | #define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D) 815 | #define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D) 816 | #define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D) 817 | #define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D) 818 | #define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D) 819 | #define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D) 820 | #define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D) 821 | #define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D) 822 | #define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D) 823 | 824 | #define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock) 825 | 826 | #endif /* WGL_I3D_genlock */ 827 | 828 | /* -------------------------- WGL_I3D_image_buffer ------------------------- */ 829 | 830 | #ifndef WGL_I3D_image_buffer 831 | #define WGL_I3D_image_buffer 1 832 | 833 | #define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 834 | #define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 835 | 836 | typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); 837 | typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); 838 | typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); 839 | typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); 840 | 841 | #define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) 842 | #define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) 843 | #define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D) 844 | #define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D) 845 | 846 | #define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer) 847 | 848 | #endif /* WGL_I3D_image_buffer */ 849 | 850 | /* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */ 851 | 852 | #ifndef WGL_I3D_swap_frame_lock 853 | #define WGL_I3D_swap_frame_lock 1 854 | 855 | typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); 856 | typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); 857 | typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); 858 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); 859 | 860 | #define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D) 861 | #define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D) 862 | #define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D) 863 | #define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D) 864 | 865 | #define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock) 866 | 867 | #endif /* WGL_I3D_swap_frame_lock */ 868 | 869 | /* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */ 870 | 871 | #ifndef WGL_I3D_swap_frame_usage 872 | #define WGL_I3D_swap_frame_usage 1 873 | 874 | typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); 875 | typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); 876 | typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); 877 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); 878 | 879 | #define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) 880 | #define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) 881 | #define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D) 882 | #define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D) 883 | 884 | #define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage) 885 | 886 | #endif /* WGL_I3D_swap_frame_usage */ 887 | 888 | /* --------------------------- WGL_NV_DX_interop --------------------------- */ 889 | 890 | #ifndef WGL_NV_DX_interop 891 | #define WGL_NV_DX_interop 1 892 | 893 | #define WGL_ACCESS_READ_ONLY_NV 0x0000 894 | #define WGL_ACCESS_READ_WRITE_NV 0x0001 895 | #define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 896 | 897 | typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); 898 | typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); 899 | typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); 900 | typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice); 901 | typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access); 902 | typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle); 903 | typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); 904 | typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); 905 | 906 | #define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV) 907 | #define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV) 908 | #define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV) 909 | #define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV) 910 | #define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV) 911 | #define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV) 912 | #define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV) 913 | #define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV) 914 | 915 | #define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop) 916 | 917 | #endif /* WGL_NV_DX_interop */ 918 | 919 | /* --------------------------- WGL_NV_DX_interop2 -------------------------- */ 920 | 921 | #ifndef WGL_NV_DX_interop2 922 | #define WGL_NV_DX_interop2 1 923 | 924 | #define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2) 925 | 926 | #endif /* WGL_NV_DX_interop2 */ 927 | 928 | /* --------------------------- WGL_NV_copy_image --------------------------- */ 929 | 930 | #ifndef WGL_NV_copy_image 931 | #define WGL_NV_copy_image 1 932 | 933 | typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); 934 | 935 | #define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV) 936 | 937 | #define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image) 938 | 939 | #endif /* WGL_NV_copy_image */ 940 | 941 | /* ------------------------ WGL_NV_delay_before_swap ----------------------- */ 942 | 943 | #ifndef WGL_NV_delay_before_swap 944 | #define WGL_NV_delay_before_swap 1 945 | 946 | typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); 947 | 948 | #define wglDelayBeforeSwapNV WGLEW_GET_FUN(__wglewDelayBeforeSwapNV) 949 | 950 | #define WGLEW_NV_delay_before_swap WGLEW_GET_VAR(__WGLEW_NV_delay_before_swap) 951 | 952 | #endif /* WGL_NV_delay_before_swap */ 953 | 954 | /* -------------------------- WGL_NV_float_buffer -------------------------- */ 955 | 956 | #ifndef WGL_NV_float_buffer 957 | #define WGL_NV_float_buffer 1 958 | 959 | #define WGL_FLOAT_COMPONENTS_NV 0x20B0 960 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 961 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 962 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 963 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 964 | #define WGL_TEXTURE_FLOAT_R_NV 0x20B5 965 | #define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 966 | #define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 967 | #define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 968 | 969 | #define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer) 970 | 971 | #endif /* WGL_NV_float_buffer */ 972 | 973 | /* -------------------------- WGL_NV_gpu_affinity -------------------------- */ 974 | 975 | #ifndef WGL_NV_gpu_affinity 976 | #define WGL_NV_gpu_affinity 1 977 | 978 | #define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 979 | #define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 980 | 981 | DECLARE_HANDLE(HGPUNV); 982 | typedef struct _GPU_DEVICE { 983 | DWORD cb; 984 | CHAR DeviceName[32]; 985 | CHAR DeviceString[128]; 986 | DWORD Flags; 987 | RECT rcVirtualScreen; 988 | } GPU_DEVICE, *PGPU_DEVICE; 989 | 990 | typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); 991 | typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); 992 | typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); 993 | typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); 994 | typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); 995 | 996 | #define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV) 997 | #define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV) 998 | #define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV) 999 | #define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV) 1000 | #define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV) 1001 | 1002 | #define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity) 1003 | 1004 | #endif /* WGL_NV_gpu_affinity */ 1005 | 1006 | /* ---------------------- WGL_NV_multisample_coverage ---------------------- */ 1007 | 1008 | #ifndef WGL_NV_multisample_coverage 1009 | #define WGL_NV_multisample_coverage 1 1010 | 1011 | #define WGL_COVERAGE_SAMPLES_NV 0x2042 1012 | #define WGL_COLOR_SAMPLES_NV 0x20B9 1013 | 1014 | #define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage) 1015 | 1016 | #endif /* WGL_NV_multisample_coverage */ 1017 | 1018 | /* -------------------------- WGL_NV_present_video ------------------------- */ 1019 | 1020 | #ifndef WGL_NV_present_video 1021 | #define WGL_NV_present_video 1 1022 | 1023 | #define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 1024 | 1025 | DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); 1026 | 1027 | typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList); 1028 | typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList); 1029 | typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue); 1030 | 1031 | #define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV) 1032 | #define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV) 1033 | #define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV) 1034 | 1035 | #define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video) 1036 | 1037 | #endif /* WGL_NV_present_video */ 1038 | 1039 | /* ---------------------- WGL_NV_render_depth_texture ---------------------- */ 1040 | 1041 | #ifndef WGL_NV_render_depth_texture 1042 | #define WGL_NV_render_depth_texture 1 1043 | 1044 | #define WGL_NO_TEXTURE_ARB 0x2077 1045 | #define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 1046 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 1047 | #define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 1048 | #define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 1049 | #define WGL_DEPTH_COMPONENT_NV 0x20A7 1050 | 1051 | #define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture) 1052 | 1053 | #endif /* WGL_NV_render_depth_texture */ 1054 | 1055 | /* -------------------- WGL_NV_render_texture_rectangle -------------------- */ 1056 | 1057 | #ifndef WGL_NV_render_texture_rectangle 1058 | #define WGL_NV_render_texture_rectangle 1 1059 | 1060 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 1061 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 1062 | #define WGL_TEXTURE_RECTANGLE_NV 0x20A2 1063 | 1064 | #define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle) 1065 | 1066 | #endif /* WGL_NV_render_texture_rectangle */ 1067 | 1068 | /* --------------------------- WGL_NV_swap_group --------------------------- */ 1069 | 1070 | #ifndef WGL_NV_swap_group 1071 | #define WGL_NV_swap_group 1 1072 | 1073 | typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); 1074 | typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); 1075 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count); 1076 | typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers); 1077 | typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier); 1078 | typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); 1079 | 1080 | #define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV) 1081 | #define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV) 1082 | #define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV) 1083 | #define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV) 1084 | #define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV) 1085 | #define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV) 1086 | 1087 | #define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group) 1088 | 1089 | #endif /* WGL_NV_swap_group */ 1090 | 1091 | /* ----------------------- WGL_NV_vertex_array_range ----------------------- */ 1092 | 1093 | #ifndef WGL_NV_vertex_array_range 1094 | #define WGL_NV_vertex_array_range 1 1095 | 1096 | typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); 1097 | typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); 1098 | 1099 | #define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) 1100 | #define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) 1101 | 1102 | #define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range) 1103 | 1104 | #endif /* WGL_NV_vertex_array_range */ 1105 | 1106 | /* -------------------------- WGL_NV_video_capture ------------------------- */ 1107 | 1108 | #ifndef WGL_NV_video_capture 1109 | #define WGL_NV_video_capture 1 1110 | 1111 | #define WGL_UNIQUE_ID_NV 0x20CE 1112 | #define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF 1113 | 1114 | DECLARE_HANDLE(HVIDEOINPUTDEVICENV); 1115 | 1116 | typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); 1117 | typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList); 1118 | typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); 1119 | typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue); 1120 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); 1121 | 1122 | #define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV) 1123 | #define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV) 1124 | #define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV) 1125 | #define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV) 1126 | #define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV) 1127 | 1128 | #define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture) 1129 | 1130 | #endif /* WGL_NV_video_capture */ 1131 | 1132 | /* -------------------------- WGL_NV_video_output -------------------------- */ 1133 | 1134 | #ifndef WGL_NV_video_output 1135 | #define WGL_NV_video_output 1 1136 | 1137 | #define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 1138 | #define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 1139 | #define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 1140 | #define WGL_VIDEO_OUT_COLOR_NV 0x20C3 1141 | #define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 1142 | #define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 1143 | #define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 1144 | #define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 1145 | #define WGL_VIDEO_OUT_FRAME 0x20C8 1146 | #define WGL_VIDEO_OUT_FIELD_1 0x20C9 1147 | #define WGL_VIDEO_OUT_FIELD_2 0x20CA 1148 | #define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB 1149 | #define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC 1150 | 1151 | DECLARE_HANDLE(HPVIDEODEV); 1152 | 1153 | typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); 1154 | typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice); 1155 | typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); 1156 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); 1157 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); 1158 | typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock); 1159 | 1160 | #define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV) 1161 | #define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV) 1162 | #define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV) 1163 | #define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV) 1164 | #define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV) 1165 | #define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV) 1166 | 1167 | #define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output) 1168 | 1169 | #endif /* WGL_NV_video_output */ 1170 | 1171 | /* -------------------------- WGL_OML_sync_control ------------------------- */ 1172 | 1173 | #ifndef WGL_OML_sync_control 1174 | #define WGL_OML_sync_control 1 1175 | 1176 | typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); 1177 | typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); 1178 | typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); 1179 | typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); 1180 | typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); 1181 | typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); 1182 | 1183 | #define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) 1184 | #define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) 1185 | #define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML) 1186 | #define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML) 1187 | #define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML) 1188 | #define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML) 1189 | 1190 | #define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control) 1191 | 1192 | #endif /* WGL_OML_sync_control */ 1193 | 1194 | /* ------------------------------------------------------------------------- */ 1195 | 1196 | #ifdef GLEW_MX 1197 | #define WGLEW_FUN_EXPORT 1198 | #define WGLEW_VAR_EXPORT 1199 | #else 1200 | #define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT 1201 | #define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT 1202 | #endif /* GLEW_MX */ 1203 | 1204 | #ifdef GLEW_MX 1205 | struct WGLEWContextStruct 1206 | { 1207 | #endif /* GLEW_MX */ 1208 | 1209 | WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; 1210 | 1211 | WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD; 1212 | WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD; 1213 | WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD; 1214 | WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD; 1215 | WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD; 1216 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD; 1217 | WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD; 1218 | WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; 1219 | WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD; 1220 | 1221 | WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; 1222 | WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB; 1223 | WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB; 1224 | WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB; 1225 | 1226 | WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB; 1227 | 1228 | WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB; 1229 | 1230 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB; 1231 | WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB; 1232 | 1233 | WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB; 1234 | WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB; 1235 | WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB; 1236 | WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB; 1237 | WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB; 1238 | 1239 | WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB; 1240 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB; 1241 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB; 1242 | 1243 | WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB; 1244 | WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB; 1245 | WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB; 1246 | 1247 | WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT; 1248 | WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT; 1249 | WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT; 1250 | WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT; 1251 | 1252 | WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT; 1253 | 1254 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT; 1255 | WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT; 1256 | 1257 | WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT; 1258 | WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT; 1259 | WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT; 1260 | WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT; 1261 | WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT; 1262 | 1263 | WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT; 1264 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT; 1265 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT; 1266 | 1267 | WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT; 1268 | WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT; 1269 | 1270 | WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D; 1271 | WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D; 1272 | 1273 | WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D; 1274 | WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D; 1275 | WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D; 1276 | WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D; 1277 | 1278 | WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D; 1279 | WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D; 1280 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D; 1281 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D; 1282 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D; 1283 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D; 1284 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D; 1285 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D; 1286 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D; 1287 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D; 1288 | WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D; 1289 | WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D; 1290 | 1291 | WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D; 1292 | WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D; 1293 | WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D; 1294 | WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D; 1295 | 1296 | WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D; 1297 | WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D; 1298 | WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D; 1299 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D; 1300 | 1301 | WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D; 1302 | WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; 1303 | WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; 1304 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; 1305 | 1306 | WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV; 1307 | WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV; 1308 | WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV; 1309 | WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV; 1310 | WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV; 1311 | WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV; 1312 | WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV; 1313 | WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV; 1314 | 1315 | WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV; 1316 | 1317 | WGLEW_FUN_EXPORT PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV; 1318 | 1319 | WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV; 1320 | WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV; 1321 | WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV; 1322 | WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV; 1323 | WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV; 1324 | 1325 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV; 1326 | WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV; 1327 | WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV; 1328 | 1329 | WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV; 1330 | WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV; 1331 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV; 1332 | WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV; 1333 | WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV; 1334 | WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV; 1335 | 1336 | WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; 1337 | WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; 1338 | 1339 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV; 1340 | WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV; 1341 | WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV; 1342 | WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV; 1343 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV; 1344 | 1345 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV; 1346 | WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV; 1347 | WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV; 1348 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV; 1349 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV; 1350 | WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV; 1351 | 1352 | WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML; 1353 | WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML; 1354 | WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML; 1355 | WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML; 1356 | WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML; 1357 | WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML; 1358 | WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample; 1359 | WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control; 1360 | WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association; 1361 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region; 1362 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_context_flush_control; 1363 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context; 1364 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile; 1365 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness; 1366 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string; 1367 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB; 1368 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read; 1369 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample; 1370 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer; 1371 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format; 1372 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float; 1373 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture; 1374 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_application_isolation; 1375 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_share_group_isolation; 1376 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float; 1377 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle; 1378 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile; 1379 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile; 1380 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float; 1381 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table; 1382 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string; 1383 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB; 1384 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read; 1385 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample; 1386 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer; 1387 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format; 1388 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float; 1389 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control; 1390 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear; 1391 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control; 1392 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma; 1393 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock; 1394 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer; 1395 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; 1396 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; 1397 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop; 1398 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2; 1399 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image; 1400 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_delay_before_swap; 1401 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer; 1402 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity; 1403 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage; 1404 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video; 1405 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture; 1406 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; 1407 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group; 1408 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range; 1409 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture; 1410 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output; 1411 | WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control; 1412 | 1413 | #ifdef GLEW_MX 1414 | }; /* WGLEWContextStruct */ 1415 | #endif /* GLEW_MX */ 1416 | 1417 | /* ------------------------------------------------------------------------- */ 1418 | 1419 | #ifdef GLEW_MX 1420 | 1421 | typedef struct WGLEWContextStruct WGLEWContext; 1422 | GLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx); 1423 | GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name); 1424 | 1425 | #define wglewInit() wglewContextInit(wglewGetContext()) 1426 | #define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x) 1427 | 1428 | #define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x)) 1429 | #define WGLEW_GET_FUN(x) wglewGetContext()->x 1430 | 1431 | #else /* GLEW_MX */ 1432 | 1433 | #define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) 1434 | #define WGLEW_GET_FUN(x) x 1435 | 1436 | GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); 1437 | 1438 | #endif /* GLEW_MX */ 1439 | 1440 | GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); 1441 | 1442 | #ifdef __cplusplus 1443 | } 1444 | #endif 1445 | 1446 | #undef GLEWAPI 1447 | 1448 | #endif /* __wglew_h__ */ 1449 | --------------------------------------------------------------------------------