summaryrefslogtreecommitdiff
path: root/src/my_gtk_gl_scene_widget.hpp
blob: 62c8d1674907e531fc23c6d86c35b0a3ee523b16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef MY_GTK_GL_SCENE_H
#define MY_GTK_GL_SCENE_H

#include <gtkmm.h>
#include <gtkglmm.h>
#include <GL/glu.h>
#include "opencl_mesh_kit.hpp"

// Class that will contain all the OpenGL logic for displaying the OpenCL computed data
// Implementation is kept in gpudataviz.cc (I want to keep interesting code part in this file)

class MyGTKGLSceneWidget : public Gtk::DrawingArea, public Gtk::GL::Widget<MyGTKGLSceneWidget>
{
	public:
		MyGTKGLSceneWidget(Glib::RefPtr<Gdk::GL::Config> &glconfig);
		virtual ~MyGTKGLSceneWidget();
		void step();
		bool continuous_play;

	protected:
		virtual void on_size_request(Gtk::Requisition* requisition);
		virtual void on_realize();
		virtual bool on_configure_event(GdkEventConfigure* event);
		virtual bool on_expose_event(GdkEventExpose* event);
		virtual bool on_motion_notify_event (GdkEventMotion *event);
		virtual bool on_button_press_event(GdkEventButton *event);
		virtual bool on_button_release_event(GdkEventButton *event);
		virtual bool on_scroll_event(GdkEventScroll *event);
		virtual bool on_gtk_idle();

		bool do_mouse_logic(GdkEventType type, guint state, guint x, guint y);
	private:
		OpenCLMeshKit clKit;
		struct camera_params { float rx; float ry; float tz; } camera;
		bool need_recompute;
		float time;
};

#endif /*MY_GTK_GL_SCENE_H*/