summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2013-03-11 22:40:08 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2013-03-11 22:40:08 +0000
commitfbe888a709ef2de41959f736d03347c0c2b47c04 (patch)
tree55ee71b21c73e44f73e6925228528c4687d1b0a7
parenta24a7fc7497f61828952b67b1daf85067725b663 (diff)
download2013-gpudataviz-fbe888a709ef2de41959f736d03347c0c2b47c04.tar.gz
2013-gpudataviz-fbe888a709ef2de41959f736d03347c0c2b47c04.tar.bz2
2013-gpudataviz-fbe888a709ef2de41959f736d03347c0c2b47c04.zip
La fonction alpha auto-magique est opérationnelle.
git-svn-id: file:///var/svn/2013-gpudataviz/trunk@24 371a6b4a-a258-45f8-9dcc-bdd82ce0ac9d
-rw-r--r--src/gpudataviz.cpp43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/gpudataviz.cpp b/src/gpudataviz.cpp
index 52b68e5..d3b950d 100644
--- a/src/gpudataviz.cpp
+++ b/src/gpudataviz.cpp
@@ -101,8 +101,8 @@ void MyGTKGLSceneWidget::on_realize() {
//size_t mesh_width=256, mesh_height=256, group_size=256; // TODO : not here
//size_t mesh_width=512, mesh_height=512, group_size=256; // TODO : not here
- size_t mesh_width=1024, mesh_height=1024, group_size=256; // TODO : not here
- //size_t mesh_width=4096, mesh_height=4096, group_size=256; // TODO : not here
+ //size_t mesh_width=1024, mesh_height=1024, group_size=256; // TODO : not here
+ size_t mesh_width=2048, mesh_height=2048, group_size=256; // TODO : not here
GLuint gl_vbo=0;
GLsizeiptr gl_vbo_data_size = mesh_width * mesh_height * sizeof(cl_float4);
@@ -229,39 +229,28 @@ bool MyGTKGLSceneWidget::on_expose_event(GdkEventExpose* event) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Drawing all the stuff
-/*
-TODO : find an auto func for alpha that corresponds to this values
-
-m_w m_h s_w s_h t_z alpha
-1024 1024 1280 1000 -2 0.5
-1024 1024 1024 768 -2 0.125
-1024 1024 320 200 -2 0.025
-
-1024 1024 1280 1000 -2 0.5
-1024 1024 1280 1000 -3.5 0.05
-1024 1024 1280 1000 -6.5 0.025
-
-4096 4096 1280 1000 -2 0.015625
-1024 1024 1280 1000 -2 0.25
-512 512 1280 1000 -2 0.5
-256 256 1280 1000 -2 0.75
-*/
-
+ //TODO : do this (and camera update) in configure event ?
float m_w=this->clKit.getMeshWidth();
float m_h=this->clKit.getMeshHeight();
- float s_w=this->get_width();
+ //float s_w=this->get_width();
float s_h=this->get_height();
float t_z=this->camera.tz;
- float c1=((1024+1024)/(m_w+m_h));
- float c2=((s_w*s_h)/(1280*1024));
- float c3=(4/(t_z*t_z));
-
+/* The comprehensible one
+ float c1=(1024*1024)/(m_w*m_h);
+ float c2=(s_h*s_h)/(1024*1024);
+ float c3=(-2*-2)/(t_z*t_z);
float alpha=0.5*c1*c2*c3;
-
+ if (alpha < 0.01f) alpha = 0.01f;
+ if (alpha > 1.0f) alpha = 1.0f;
std::cout << "c1 == " << c1 << " c2 == " << c2 << " c3 == " << c3 << " alpha == " << alpha << std::endl;;
+*/
-
+/* The optimized one */
+ float alpha=2.0f*(s_h*s_h)/(m_w*m_h)/(t_z*t_z);
+ if (alpha < 0.01f) alpha = 0.01f;
+ if (alpha > 1.0f) alpha = 1.0f;
+
glColor4f(0.40f,0.78f,0.97f,alpha);
glBindBuffer(GL_ARRAY_BUFFER, this->clKit.getGLVBO());
glVertexPointer(4, GL_FLOAT, 0, (GLvoid *) 0);