Index: mojo/examples/sample_app/gles2_client_impl.cc |
diff --git a/mojo/examples/sample_app/gles2_client_impl.cc b/mojo/examples/sample_app/gles2_client_impl.cc |
index ca26b2d4f3dc4da0daec730e874bb297ef05f0db..1913b486e6690a8602ea34bf817adb31aa4b6f0e 100644 |
--- a/mojo/examples/sample_app/gles2_client_impl.cc |
+++ b/mojo/examples/sample_app/gles2_client_impl.cc |
@@ -7,6 +7,7 @@ |
#include <GLES2/gl2.h> |
#include <GLES2/gl2ext.h> |
#include <math.h> |
+#include <stdlib.h> |
#include "mojo/public/c/gles2/gles2.h" |
#include "ui/events/event_constants.h" |
@@ -19,6 +20,10 @@ float CalculateDragDistance(const gfx::PointF& start, const Point& end) { |
return hypot(start.x() - end.x(), start.y() - end.y()); |
} |
+float GetRandomColor() { |
+ return static_cast<float>(rand()) / static_cast<float>(RAND_MAX); |
+} |
+ |
} |
GLES2ClientImpl::GLES2ClientImpl(ScopedMessagePipeHandle pipe) |
@@ -74,6 +79,8 @@ void GLES2ClientImpl::HandleInputEvent(const Event& event) { |
CalculateDragDistance(capture_point_, event.location()), |
delta); |
+ cube_.set_color(GetRandomColor(), GetRandomColor(), GetRandomColor()); |
+ |
capture_point_ = last_drag_point_ = gfx::PointF(); |
RequestAnimationFrames(); |
} |