image = QImage(width, height, 32); // 32 Bit
Sphere s(Point(0.0,0.0,-50.0), 40.0);
cout << shapes.size() <
The object s has been allocated within the stack frame of the "createScene" function. It is a local variable, and it will be destructed and invalidated as soon as the "createScene" function ends. Therefore, you have put a pointer to a non-existent object into your shapes vector. What you should do, instead, is allocate a Shape object on the heap (perhaps storing it in a boost::shared_ptr?) and put that in the vector.