Skip to content

Instantly share code, notes, and snippets.

#include "ofMain.h"
void enableMidmap(ofTexture& texture) {
texture.bind();
int textureTarget = texture.getTextureData().textureTarget;
glTexParameteri(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glGenerateMipmap(GL_TEXTURE_2D); // automatically creates midmaps for textures
texture.unbind();
@trentbrooks
trentbrooks / gist:4f01a8589743c6a4dd94
Created November 12, 2014 22:42
Command line easy tcp client (send and receive)
telnet localhost 12345
@trentbrooks
trentbrooks / gist:6fa34bb9d8db0c880ca6
Created November 23, 2014 22:21
Ubuntu remote compile OF app
make clean
make Release
sudo chmod a+x app_binary
@trentbrooks
trentbrooks / gist:ea0ba99f4d0816483866
Last active December 9, 2016 10:54
Raspberry PI install system image from terminal
diskutil list
diskutil unmountDisk /dev/disk3
// snappy ubuntu core
sudo dd bs=1m if=~/Downloads/pi-snappy.img of=/dev/disk3
// raspbian
sudo dd bs=1m if=~/Downloads/2015-01-31-raspbian.img of=/dev/disk3
// retropie (assumes .img is in Downloads folder)
@trentbrooks
trentbrooks / gist:452dfc8dfaa95892aedf
Created February 26, 2015 05:24
Raspberry Pi2 + openframeworks setup
// 1 update gcc to 4.8
sudo apt-get install g++-4.8
cd /usr/bin
sudo rm g++
sudo ln -s g++-4.8 g++
// 1 download OF (from github or stable linuxarm7l release with https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.rpi2.mk)
cd ~
curl -o https://github.com/openframeworks/openFrameworks/archive/master.zip
curl -o http://www.openframeworks.cc/versions/v0.8.4/of_v0.8.4_linuxarmv7l_release.tar.gz
@trentbrooks
trentbrooks / gist:e41a592ea87f2815d2c4
Last active August 29, 2015 14:22
threading/mutex objc problem
- (void)updateData:(NSTimer*)timer {
// if already getting data do nothing
if(!self.isFetchDataComplete) {
NSLog(@"Do not get data - flag is OFF...");
return;
}
// reset the flag
self.isFetchDataComplete = FALSE;
@trentbrooks
trentbrooks / gist:614b5afe68e620a7dd7b
Created July 9, 2015 04:53
Heroku site (Rockhampton)
cd rockhamptongallery
heroku git:remote -a rockhampton-web
//should list two remotes, origin/github and heroku
git remote -v
middleman build
git add -f app/build # -f because we are ignoring git dir
git push heroku develop:master # heroku only works with master branch, so push our develop onto their master.
git clone http://github.com/trentbrooks/someproject
git bundle create someproject.bundle --all
- need to zip assets if not in archive
- if OF, might need details about which version and addons
@trentbrooks
trentbrooks / gist:f8a0bd42334c12890083
Created September 21, 2015 06:59
ofAVFoundationVideoPlayer previousFrame() replacement
#ifdef __OBJC__
ofAVFoundationVideoPlayer* p = (ofAVFoundationVideoPlayer*)videoPtr->getAVFoundationVideoPlayer();
if(p != nullptr) {
double timeSec = CMTimeGetSeconds([p getCurrentTime]) - (1.0/[p getFrameRate]);
CMTime time = CMTimeMakeWithSeconds(timeSec, NSEC_PER_SEC);
[p seekToTime:time withTolerance:kCMTimeZero];
}
#endif
@trentbrooks
trentbrooks / gist:523b60764bc5b6cfada7
Last active October 2, 2015 03:18
Instructions for George
// 1. go into github repo via terminal
cd brighthearts-beta
// 2. check which branch your on - eg. HPV-Vaccine
git branch
// 3. delete all your local changes, and reset to what is on github
git reset --hard HEAD
// 4. pull down the latest changes