+bool Renderer::create()
+{
+ if(!(sprog = sdr_man->create_shader_program("default.v.glsl", "default.f.glsl"))) {
+ return false;
+ }
+
+ if(!(sprog->link())) {
+ return false;
+ }
+
+ /* getting material uniform locations: diffuse, specular, specular exponent (strength) */
+
+ if((diff_loc = sprog->get_uniform_location("diffuse")) == -1) {
+ fprintf(stderr, "Invalid uniform location: can't find \"diffuse\".\n");
+ return false;
+ }
+
+ if((spec_loc = sprog->get_uniform_location("specular")) == -1) {
+ fprintf(stderr, "Invalid uniform location: can't find \"specular\".\n");
+ return false;
+ }
+
+ if((shin_loc = sprog->get_uniform_location("shininess")) == -1) {
+ fprintf(stderr, "Invalid uniform location: can't find \"shininess\".\n");
+ return false;
+ }
+
+ /* uniform locations for matrices */
+
+ if((mmviewproj_loc = sprog->get_uniform_location("mmviewproj")) == -1) {
+ fprintf(stderr, "Invalid uniform location: can't find \"mmviewproj\".\n");
+ return false;
+ }
+
+ if((mview_loc = sprog->get_uniform_location("mview")) == -1) {
+ fprintf(stderr, "Invalid uniform location: can't find \"mview\".\n");
+ return false;
+ }
+
+ return true;
+}
+
+void Renderer::draw() const
+{
+ if(!camera || !scene)
+ return;
+
+ if(!sprog->link())
+ return;
+
+ sprog->use();
+
+ for(size_t i=0; i<scene->objects.size(); i++) {
+ draw_object(scene->objects[i]);
+ }
+}
+
+void Renderer::draw_object(Object *object) const