ShaderPtr Shader::createSimpleTextureShader( base::Texture2dPtr texture ) { base::ShaderPtr shader = Shader::create().attachPS(base::Path( BASE_PATH ) + "/gfx/glsl/simpleTexture.ps.glsl").attachVS(base::Path( BASE_PATH ) + "/gfx/glsl/simpleTexture.vs.glsl"); if(texture) shader->setUniform( "texture", texture->getUniform() ); return shader; }
void init() { std::cout << "init!\n"; // put your initialization stuff here int width = 512; int height = 512; // init resources geometry = base::geo_cube(); shader = base::Shader::createSimpleTextureShader(); texture = base::Texture2d::createUVRefTexture(); shader->setUniform("texture",texture->getUniform()); initializeStencilShader = base::Shader::create().attachPS(base::Path( SRC_PATH ) + "/src/initializeStencil.ps.glsl").attachVS(base::Path( SRC_PATH ) + "/src/initializeStencil.vs.glsl"); multisampleTexture = base::Texture2d::createRGBAFloat32( 512, 512, true, 4 ); multisampleFBO = base::FBO::create().width(512).height(512).multisample(true).numSamples(4).stencilBuffer(true).attach(multisampleTexture); multisampleTestShader = base::Shader::load( base::Path( SRC_PATH ) + "/src/multisampleTest" ); multisampleTestShader->setUniform( "texture", multisampleTexture->getUniform() ); }