summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2013-03-31 11:48:31 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2013-03-31 11:48:31 +0000
commitbe749b6ed55e8f31b438ebeae97e76ae223290db (patch)
tree33e32e0318195f2c5a55d5068ead5350f75e4d65
parent33171efc37387fc1641063abd4ca4c6828653b7c (diff)
download2013-gpudataviz-be749b6ed55e8f31b438ebeae97e76ae223290db.tar.gz
2013-gpudataviz-be749b6ed55e8f31b438ebeae97e76ae223290db.tar.bz2
2013-gpudataviz-be749b6ed55e8f31b438ebeae97e76ae223290db.zip
Cosmetics
git-svn-id: file:///var/svn/2013-gpudataviz/trunk@26 371a6b4a-a258-45f8-9dcc-bdd82ce0ac9d
-rw-r--r--src/gpudataviz.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/gpudataviz.cpp b/src/gpudataviz.cpp
index 3ef881e..1f59768 100644
--- a/src/gpudataviz.cpp
+++ b/src/gpudataviz.cpp
@@ -51,6 +51,7 @@ int main(int argc, char* argv[]) {
I want to keep all interesting code parts in this file, in natural reading order
*/
MyGTKGLSceneWidget::MyGTKGLSceneWidget(Glib::RefPtr<Gdk::GL::Config> &glconfig) {
+ CALL_TRACE;
set_gl_capability(glconfig);
Gdk::EventMask mask = Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_MOTION_MASK \
| Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK \
@@ -149,7 +150,7 @@ void MyGTKGLSceneWidget::on_realize() {
knames.clear();
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Projection setup is done at on_configure_event
// Camera setup (ie initial MODELVIEW matrix) is done at on_expose_event
@@ -165,25 +166,25 @@ bool MyGTKGLSceneWidget::on_configure_event(GdkEventConfigure* event) {
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();
// *** OpenGL BEGIN ***
-
//FIXME could segfault if get_gl_window() has failed
- if (!glwindow->gl_begin(get_gl_context())) {
+ if (!glwindow->gl_begin(get_gl_context())) {
std::cerr << "Oups : glwindow->gl_begin(get_gl_context())" << std::endl;
return false;
}
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(60.0, w/h, 0.1, 10.0);
+ glViewport(0, 0, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(60.0, w/h, 0.1, 10.0);
- glwindow->gl_end();
+ glwindow->gl_end();
// *** OpenGL END ***
return true;
}
bool MyGTKGLSceneWidget::on_expose_event(GdkEventExpose* event) {
+ std::cout << "e" << std::flush;
// CALL_TRACE ; // This one runs mainly when GTK GL Widget have to be redrawn
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();
@@ -256,7 +257,7 @@ bool MyGTKGLSceneWidget::on_expose_event(GdkEventExpose* event) {
}
void MyGTKGLSceneWidget::step() {
- this->time += 0.01f;
+ this->time += 0.05f;
this->need_recompute = true;
}
@@ -314,6 +315,7 @@ bool MyGTKGLSceneWidget::on_scroll_event(GdkEventScroll *event) {
)
bool MyGTKGLSceneWidget::do_mouse_logic(GdkEventType type, guint state, guint x, guint y) {
+ std::cout << "m" << std::flush;
//CALL_TRACE ; // This one runs when a mouse event is catched by the GTK GL Widget
/*
* type : the type of the event.
@@ -359,7 +361,7 @@ bool MyGTKGLSceneWidget::do_mouse_logic(GdkEventType type, guint state, guint x,
if (this->camera.tz + 0.5f <= -0.5f) {
this->camera.tz += 0.5f;
- std::cout << "camera.tz == " << this->camera.tz << std::endl;
+ //std::cout << "camera.tz == " << this->camera.tz << std::endl;
redraw=true;
}
}
@@ -368,7 +370,7 @@ bool MyGTKGLSceneWidget::do_mouse_logic(GdkEventType type, guint state, guint x,
MOUSE_WHEEL(GDK_SCROLL_DOWN, 0, 0) {
if (this->camera.tz - 0.5f >= -9.0f) {
this->camera.tz -= 0.5f;
- std::cout << "camera.tz == " << this->camera.tz << std::endl;
+ //std::cout << "camera.tz == " << this->camera.tz << std::endl;
redraw=true;
}
}
@@ -406,16 +408,18 @@ bool MyGTKGLSceneWidget::do_mouse_logic(GdkEventType type, guint state, guint x,
prev_type=type;
}
+ if ( redraw ) std::cout << "q" << std::flush;
if ( redraw ) queue_draw();
if ( recompute ) this->need_recompute=true;
return true;
}
bool MyGTKGLSceneWidget::on_gtk_idle() {
- CALL_TRACE ; // This one runs when there is no more GTK event in the current iteration
+ //CALL_TRACE ; // This one runs when there is no more GTK event in the current iteration
+
// Note : This signal is not always connected.
// Connected by Glib::signal_idle().connect() call
- // Disconnected automatically if it returns false
+ // Disconnected automatically the first time it returns false
if ( ! continuous_play ) return false;
this->step();