aboutsummaryrefslogtreecommitdiff
path: root/src/scene-buffer.cpp
diff options
context:
space:
mode:
authorAlexandros Frantzis <alexandros.frantzis@linaro.org>2012-08-15 10:38:45 +0300
committerAlexandros Frantzis <alexandros.frantzis@linaro.org>2012-08-15 10:38:45 +0300
commit24d4339f49fbb84f20af015dc72d33256320d5db (patch)
tree0e41cebcf317181007cfb442c5369479ca4a63fe /src/scene-buffer.cpp
parentab5e6cfeb163f03023707a26312a6c3f2b5e5f7e (diff)
downloadglmark2-24d4339f49fbb84f20af015dc72d33256320d5db.tar.gz
Scene: Add ::supported() method and implement it for scenes that need it.
Diffstat (limited to 'src/scene-buffer.cpp')
-rw-r--r--src/scene-buffer.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/scene-buffer.cpp b/src/scene-buffer.cpp
index 5cf11a6..2214e53 100644
--- a/src/scene-buffer.cpp
+++ b/src/scene-buffer.cpp
@@ -327,6 +327,22 @@ SceneBuffer::~SceneBuffer()
}
bool
+SceneBuffer::supported(bool show_errors)
+{
+ if (options_["update-method"].value != "subdata" &&
+ (GLExtensions::MapBuffer == 0 || GLExtensions::UnmapBuffer == 0))
+ {
+ if (show_errors) {
+ Log::error("Requested MapBuffer VBO update method but GL_OES_mapbuffer"
+ " is not supported!\n");
+ }
+ return false;
+ }
+
+ return true;
+}
+
+bool
SceneBuffer::load()
{
running_ = false;
@@ -347,6 +363,10 @@ SceneBuffer::setup()
Scene::setup();
bool should_run = true;
+
+ if (!supported(true))
+ should_run = false;
+
bool interleave = (options_["interleave"].value == "true");
Mesh::VBOUpdateMethod update_method;
Mesh::VBOUsage usage;
@@ -374,13 +394,6 @@ SceneBuffer::setup()
nlength = Util::fromString<size_t>(options_["columns"].value);
nwidth = Util::fromString<size_t>(options_["rows"].value);
- if (update_method == Mesh::VBOUpdateMethodMap &&
- (GLExtensions::MapBuffer == 0 || GLExtensions::UnmapBuffer == 0))
- {
- Log::error("Requested MapBuffer VBO update method but GL_OES_mapbuffer"
- " is not supported!\n");
- should_run = false;
- }
priv_->wave = new WaveMesh(5.0, 2.0, nlength, nwidth,
update_fraction * (1.0 - update_dispersion + 0.0001),