This file contains hidden or 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
// just give it a path getAssetPath( "MyEnormous.obj" ) and it'll do the rest. | |
// the first time through will be very long. :) | |
geom::SourceRef getGeometry( const ci::fs::path &geomPath ) | |
{ | |
auto tri = TriMesh::create( TriMesh::Format().positions().normals().texCoords() ); | |
if( geomPath.extension() == ".obj" ) { | |
auto binPath = geomPath; | |
binPath.replace_extension( "bin" ); | |
if( !fs::exists( binPath ) ) { |
This file contains hidden or 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
ocl::printSupportedImageFormats( mClContext, CL_MEM_OBJECT_IMAGE2D ); | |
auto imageSource = loadImage( loadAsset( "sunset.jpg" ) ); | |
mClImage = ocl::createImage2D( imageSource, mClContext ); | |
mClBuffer = ocl::createBuffer( imageSource, mClContext ); | |
auto source = ocl::createSource( mClImage ); | |
mGlTexture = gl::Texture2d::create( source ); | |
writeImage( getAppPath(), source, ImageTarget::Options(), "png" ); |
This file contains hidden or 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 <chrono> | |
namespace cinder { | |
// nanoseconds Alias | |
using nanoseconds = std::chrono::nanoseconds; | |
/** \brief A high-resolution timer class **/ | |
class Timer { | |
using clock = std::chrono::high_resolution_clock; |
This file contains hidden or 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
namespace osc { | |
template<typename ReceiveProtocol> | |
class Server { | |
public: | |
Server( asio::io_server &io = app::App::get()->io_service() ); | |
Server( const Server &server ) = delete; | |
Server& operator=( const Server &server ) = delete; | |
Server( Server &&server ); | |
Server& operator=( Server &&server ); |
This file contains hidden or 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 "cinder/app/AppNative.h" | |
#include "cinder/app/RendererGl.h" | |
#include "cinder/gl/gl.h" | |
#include "cinder/qtime/QuickTimeGl.h" | |
#include "cinder/gl/Texture.h" | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; |
This file contains hidden or 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
# Computer needs to generate a secret number | |
secret_number = rand(5) + 1 | |
# initialize a variable called trys that equals 0 | |
# begin the loop | |
# Tell the user to guess a number between 1 and 10 | |
puts "guess a number between 1 and 5" | |
# User guesses a number | |
user_guess = gets.to_i |
NewerOlder