summaryrefslogtreecommitdiffstats
path: root/mojo/examples/sample_app/sample_gles2_delegate.h
blob: efd4872d29443868d4c62eb74b8aa50fa2a3ffb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_EXAMPLES_SAMPLE_APP_SAMPLE_GLES2_DELEGATE_H_
#define MOJO_EXAMPLES_SAMPLE_APP_SAMPLE_GLES2_DELEGATE_H_

#include "base/timer/timer.h"
#include "mojo/examples/sample_app/spinning_cube.h"
#include "mojo/public/bindings/gles2_client/gles2_client_impl.h"

namespace mojo {
namespace examples {

class SampleGLES2Delegate : public GLES2Delegate {
 public:
  SampleGLES2Delegate();
  virtual ~SampleGLES2Delegate();

 private:
  virtual void DidCreateContext(
      GLES2ClientImpl* gl, uint32_t width, uint32_t height) MOJO_OVERRIDE;
  virtual void ContextLost(GLES2ClientImpl* gl) MOJO_OVERRIDE;

  void Draw();

  base::Time last_time_;
  base::RepeatingTimer<SampleGLES2Delegate> timer_;
  SpinningCube cube_;
  GLES2ClientImpl* gl_;
};

}  // namespace examples
}  // namespace mojo

#endif  // MOJO_EXAMPLES_SAMPLE_APP_SAMPLE_GLES2_DELEGATE_H_