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
uniform int byp; | |
uniform sampler2D tDiffuse; | |
uniform sampler2D tDisp; | |
uniform float amount; | |
uniform float angle; | |
uniform float seed; | |
uniform float seed_x; | |
uniform float seed_y; | |
uniform float distortion_x; | |
uniform float distortion_y; |
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
// MIUI3 not support GL_OES_packed_depth_stencil workaround | |
glGenRenderbuffers(1, &m_pDepthStencil); | |
glBindRenderbuffer(GL_RENDERBUFFER, m_pDepthStencil); | |
static bool supportedPackedDepthStencil = strstr((const char*)glGetString(GL_EXTENSIONS), "GL_OES_packed_depth_stencil") != NULL; | |
GLenum internalFormat = supportedPackedDepthStencil ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT16; | |
glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, nWidth, nHeight); | |
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_pDepthStencil); |
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
// see http://www.galloway.me.uk/2010/10/arm-hacking-exc_arm_da_align-exception/ | |
// force size to align 4 byte | |
if ((dataSize & 0x3) != 0) { | |
dataSize += 4 - (dataSize & 0x3); | |
} |
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
void printf(const char *s) | |
{ | |
while (*s) | |
{ | |
if (*s == '%' && *(++s) != '%') | |
throw std::runtime_error("invalid format string: missing arguments"); | |
std::cout << *s++; | |
} | |
} | |
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
float Q_rsqrt( float number ) | |
{ | |
long i; | |
float x2, y; | |
const float threehalfs = 1.5F; | |
x2 = number * 0.5F; | |
y = number; | |
i = * ( long * ) &y; // evil floating point bit level hacking | |
i = 0x5f3759df - ( i >> 1 ); // what the fuck? |
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
/** 简易属性解释 | |
@param object 访问对象 | |
@param propertyStr 访问属性字符串,仅限于包含若干.或[]的组合,如"p1.p2[3][4].p5" | |
@param [newValue] 如果不为undefined,则执行 object.propertyStr = newValue | |
@return value of object.propertyStr if newValue !== undefined | |
*/ | |
function parseCombinedPropertyStr(object, propertyStr, newValue) { | |
if (!propertyStr) { | |
return undefined; | |
} |
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
$ curl -O ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz | |
$ tar -xzvf ncurses-5.9.tar.gz | |
$ cd ./ncurses-5.9 | |
$ ./configure --prefix=/usr/local \ | |
--without-cxx --without-cxx-binding --without-ada --without-progs --without-curses-h \ | |
--with-shared --without-debug \ | |
--enable-widec --enable-const --enable-ext-colors --enable-sigwinch --enable-wgetch-events \ | |
&& make | |
$ sudo make install |
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
#show invisible files in finder | |
defaults write com.apple.finder AppleShowAllFiles -bool true |
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
/** | |
* Created with JetBrains WebStorm. | |
* User: xophiix | |
* Date: 14-4-24 | |
* Time: 22:58 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
var passGroup = ["hongmi", "ios-simulator", "ipad2", "lenovo"]; | |
var failGroup = ["htc", "sony", "xiaomi"]; |
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
string extensions = (const char*)glGetString(GL_EXTENSIONS); | |
set<string> extensionSet; | |
size_t strStart = 0; | |
for (size_t i = 0; i < extensions.size(); ++i) { | |
if (extensions[i] == ' ') { | |
string ext = extensions.substr(strStart, i - strStart); | |
extensionSet.insert(ext); | |
strStart = i+1; | |
} |
NewerOlder