Browse Source

Bind default Vertex Array Object on initialization.

According to OpenGL specifications no default VAO is bound
automatically, so without that it shouldn't work. The reason why it was
working for me on NVidia was a driver bug, which is now fixed in recent
drivers (280.xx, maybe) if using Core OpenGL.
vectorfields
Vladimír Vondruš 15 years ago
parent
commit
5d56e993a8
  1. 9
      src/Scene.cpp
  2. 6
      src/Scene.h

9
src/Scene.cpp

@ -19,6 +19,15 @@ using namespace std;
namespace Magnum {
Scene::Scene(): Object(0), _features(0), _camera(0) {
_parent = this;
setClearColor(0.1f, 0.1f, 0.1f, 1.0f);
/* Bind default VAO */
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
}
void Scene::setFeature(Scene::Feature feature, bool enabled) {
GLenum _feature;
switch(feature) {

6
src/Scene.h

@ -43,10 +43,7 @@ class Scene: public Object {
};
/** @brief Constructor */
inline Scene(): Object(0), _features(0), _camera(0) {
_parent = this;
setClearColor(0.1f, 0.1f, 0.1f, 1.0f);
}
Scene();
/** @brief Clear color */
inline Vector4 clearColor() const { return _clearColor; }
@ -96,6 +93,7 @@ class Scene: public Object {
unsigned int _features;
Vector4 _clearColor;
Camera* _camera;
GLuint vao;
unsigned int viewportWidth, viewportHeight;

Loading…
Cancel
Save