void init() { // FBO fbo1.create(); fbo2.create(); }
void onCreate() { rh.loadTexture(texture, "resources/hubble.jpg"); texture.minFilter(GL_NEAREST); texture.maxFilter(GL_NEAREST); rh.loadProgram(textureProgram, "resources/texture", posLoc, -1, texCoordLoc, -1); rh.loadProgram(phongProgram, "resources/phong", posLoc, normalLoc, texCoordLoc, -1); rh.loadProgram(programColor, "resources/color", posLoc, normalLoc, -1, colorLoc); MeshData md1; addCube(md1, true, 0.95); MeshData md2; addCube(md2, true, 0.5); MeshData md3; addCube(md3, 0.33); //this version makes normals, texcoords, and colors each side with a different default color cubeMeshBuffer1.init(md1, posLoc, normalLoc, texCoordLoc, -1); cubeMeshBuffer2.init(md2, posLoc, normalLoc, texCoordLoc, -1); cubeMeshBuffer3.init(md3, posLoc, normalLoc, -1, colorLoc); fbo.create(32, 32); millisToNano(1000); rotateBehavior = Behavior(now()).delay(1000).length(5000).range(vec3(3.14, 3.14, 3.14)).reversing(true).repeats(-1).sine(); proj = glm::perspective(45.0, 1.0, 0.1, 100.0); view = glm::lookAt(vec3(0.0,0.0,5), vec3(0,0,0), vec3(0,1,0) ); model = glm::mat4(); glEnable(GL_DEPTH_TEST); glViewport(0, 0, width, height); }