From: fredb Date: Mon, 24 Nov 2008 20:26:12 +0000 (+0000) Subject: Stuart : X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8303e300334b2b395dded0fb880e76b4d33b6794;p=simgear.git Stuart : > Warning: detected OpenGL error 'valeur non valide' after RenderBin::draw(,) Fixed in the patch below. For some reason the shader didn't like index 16 being used... The patch also fixes the chequer-board effect that was causing very sparse cloud cover. --- diff --git a/simgear/scene/sky/CloudShaderGeometry.hxx b/simgear/scene/sky/CloudShaderGeometry.hxx index 6e6ac4d2..50225f65 100755 --- a/simgear/scene/sky/CloudShaderGeometry.hxx +++ b/simgear/scene/sky/CloudShaderGeometry.hxx @@ -42,12 +42,12 @@ class CloudShaderGeometry : public osg::Drawable { public: + const static unsigned int CLOUD_HEIGHT = 10; const static unsigned int TEXTURE_INDEX_X = 11; const static unsigned int TEXTURE_INDEX_Y = 12; const static unsigned int WIDTH = 13; const static unsigned int HEIGHT = 14; const static unsigned int SHADE = 15; - const static unsigned int CLOUD_HEIGHT = 16; CloudShaderGeometry() { diff --git a/simgear/scene/sky/cloudfield.cxx b/simgear/scene/sky/cloudfield.cxx index 0d225a0a..f901b0f4 100644 --- a/simgear/scene/sky/cloudfield.cxx +++ b/simgear/scene/sky/cloudfield.cxx @@ -157,14 +157,16 @@ SGCloudField::SGCloudField() : } } + int leafs = QUADTREE_SIZE / BRANCH_SIZE; + for (int x = 0; x < QUADTREE_SIZE; x++) { for (int y = 0; y < QUADTREE_SIZE; y++) { field_group[x][y]= new osg::Switch; field_group[x][y]->setName("3D cloud group"); // Work out where to put this node in the quad tree - int i = (int) (BRANCH_SIZE * ((float) x) / ((float) QUADTREE_SIZE)); - int j = (int) (BRANCH_SIZE * ((float) y) / ((float) QUADTREE_SIZE)); + int i = x / leafs; + int j = y / leafs; quad[i][j]->addChild(field_group[x][y].get(), 0.0f, 20000.0f); } }