-
-
Save TankOs/d89f0d58fe48367bb5bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <typeinfo> | |
//#define SFML_SYSTEM_MACOS | |
#if defined(SFML_SYSTEM_MACOS) || defined(SFML_SYSTEM_IOS) | |
typedef void* NativeHandleType; | |
#else | |
typedef unsigned int NativeHandleType; | |
#endif | |
typedef unsigned int GLEXT_GLhandle; | |
template <class T> | |
GLEXT_GLhandle castToGlHandle(T handle) { | |
std::cout << "castToGlHandle(T handle)" << std::endl; | |
return 0; | |
} | |
template <> | |
GLEXT_GLhandle castToGlHandle(void* handle) { | |
std::cout << "castToGlHandle(void* handle)" << std::endl; | |
return 1; | |
} | |
template <class T> | |
T castFromGlHandle(GLEXT_GLhandle handle) { | |
std::cout << "unsigned int castFromGlHandle()" << std::endl; | |
return 0; | |
} | |
template <> | |
void* castFromGlHandle(GLEXT_GLhandle handle) { | |
std::cout << "void* castFromGlHandle()" << std::endl; | |
return 0; | |
} | |
int main() { | |
unsigned int uint; | |
void* vptr; | |
GLEXT_GLhandle handle; | |
std::cout << castToGlHandle(uint) << std::endl; | |
std::cout << castToGlHandle(vptr) << std::endl; | |
std::cout << castFromGlHandle<NativeHandleType>(handle) << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment