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
if (texture() && texture()->SomeMethod()) { | |
texture()->SomeOtherMethod()->FooBar(); | |
} | |
vs | |
Texture* tex = texture(); | |
if (tex && tex->SomeMethod()) { | |
tex->SomeOtherMethod()->FooBar(); | |
} |
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
Truly superior pilots are those who use their superior judgment to avoid those situations where they might have to use their superior skills. | |
— cliché |
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
// ----------------------------------------------------------------------------- | |
// PUBLIC | |
public: |
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
#version 150 | |
out vec4 gl_FragColor | |
#ifdef GL_ES | |
precision mediump float; | |
#define COLOR_PRECISION lowp | |
#else | |
#define COLOR_PRECISION | |
#endif | |
uniform COLOR_PRECISION vec4 uRenderColor; | |
uniform sampler2D uTexture; |
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
The GL_TRANSFORM_FEEDBACK_BUFFER buffer binding point may be | |
passed to glBindBuffer, but will not directly affect transform | |
feedback state. Instead, the indexed GL_TRANSFORM_FEEDBACK_BUFFER | |
bindings must be used through a call to glBindBufferBase or | |
glBindBufferRange. This will affect the generic | |
GL_TRANSFORM_FEEDBACK_BUFFER binding. | |
Likewise, the GL_UNIFORM_BUFFER buffer binding point may be used, | |
but does not directly affect uniform buffer | |
state. glBindBufferBase or glBindBufferRange must be used to bind |
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
;; I'm always opening a buffer in the wrong window. These function | |
;; help move the newly opened buffer to another window and restore the | |
;; buffer I was previously looking at. | |
(defun djg/buf-move (dir errmsg) | |
(let* ((other-win (windmove-find-other-window dir)) | |
(buf-this-buf (window-buffer (selected-window)))) | |
(if (null other-win) | |
(error errmsg) | |
(set-window-buffer other-win buf-this-buf) | |
(switch-to-prev-buffer)))) |
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
$ ninja && ./xfb | |
[2/2] clang++ xfb.o deRandom.o gl3w.o -o xfb -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo | |
glDrawArrays(0x0000, 0, 64) | |
pauseTransformFeedback | |
glDrawArrays(0x0000, 64, 64) | |
resumeTransformFeedback | |
glDrawArrays(0x0000, 128, 64) | |
GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 64 |
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
GLuint buf; | |
glGenBuffers(1, &buf); | |
// glBindBuffer(GL_UNIFORM, buf); <-- OSX needs this or ... | |
glBindBufferRange(GL_UNIFORM_BUFFER, 0, buf, 0, 4); // ... this returns GL_INVALID_VALUE |
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
int* bsearch(int val, int* base, int nelems) | |
{ | |
if (base == NULL || nelems == 0) | |
return NULL; | |
int lo = 0; | |
int hi = nelems - 1; | |
for (;;) | |
{ |
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
int binarysearch(DataType t) | |
/* return (any) position | |
if t in sorted x[0..n-1] or | |
-1 if t is not present */ | |
{ | |
int l, u, m; | |
l = 0; | |
u = n-1; | |
while (l <= u) { | |
m = (l + u) / 2; |
OlderNewer