Smoother rendering.

This commit is contained in:
2018-03-22 15:17:57 +01:00
parent 632c85b2fb
commit 1492298f2f
2 changed files with 15 additions and 1 deletions

View File

@@ -56,6 +56,8 @@ void ActivityAnimation::draw(float timeScale)
caffe::caffe_scal(bufferLength, timeScale, vertexBuffer.get()); caffe::caffe_scal(bufferLength, timeScale, vertexBuffer.get());
caffe::caffe_add(bufferLength, startingPos.data(), vertexBuffer.get(), vertexBuffer.get()); caffe::caffe_add(bufferLength, startingPos.data(), vertexBuffer.get(), vertexBuffer.get());
glPointSize(5);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, colorBuf.data()); glColorPointer(3, GL_FLOAT, 0, colorBuf.data());

View File

@@ -166,7 +166,7 @@ static void idleFunc()
checkGLErrors(); checkGLErrors();
glutPostRedisplay(); glutPostRedisplay();
throttleIdleFunc(); throttleIdleFunc();
rendererData.animationStep = 0.025f + 0.95f * (1 - cos(M_PI * getAnimationStep(std::chrono::seconds(5)))) / 2; rendererData.animationStep = (1 - cos(M_PI * getAnimationStep(std::chrono::seconds(5)))) / 2;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@@ -197,6 +197,18 @@ int main(int argc, char *argv[])
// Enable depth test to fix objects behind you // Enable depth test to fix objects behind you
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
// Nicer rendering
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POINT_SMOOTH, GL_NICEST);
glHint(GL_LINE_SMOOTH, GL_NICEST);
glHint(GL_POLYGON_SMOOTH, GL_NICEST);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glBlendFunc(GL_DST_ALPHA,GL_ONE_MINUS_DST_ALPHA);
// Start visualisation // Start visualisation
glutMainLoop(); glutMainLoop();