2 * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <gtk/gtkgl.h>
29 GisPluginTest *gis_plugin_test_new(GisWorld *world, GisView *view, GisOpenGL *opengl)
31 g_debug("GisPluginTest: new");
32 GisPluginTest *self = g_object_new(GIS_TYPE_PLUGIN_TEST, NULL);
34 self->opengl = opengl;
38 static void gis_plugin_test_expose(GisPlugin *_self)
40 GisPluginTest *self = GIS_PLUGIN_TEST(_self);
41 g_debug("GisPluginTest: expose");
43 double width = GTK_WIDGET(self->opengl)->allocation.width;
44 double height = GTK_WIDGET(self->opengl)->allocation.height;
50 gis_opengl_project(self->opengl,
51 38.841847, -90.491982, 0, &px, &py, &pz);
54 //cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
55 //cairo_t *cairo = cairo_create(surface);
56 //cairo_set_source_rgba(cairo, 1, 1, 1, 1);
57 //cairo_arc(cairo, px, py, 4, 0, 2*G_PI);
59 //cairo_move_to(cairo, px+4, py-8);
60 //cairo_set_font_size(cairo, 10);
61 //cairo_show_text(cairo, "Marker!");
64 //glEnable(GL_TEXTURE_2D);
65 //glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
66 //glPixelStorei(GL_PACK_ALIGNMENT, 1);
67 //glGenTextures(1, &tex);
68 //glBindTexture(GL_TEXTURE_2D, tex);
69 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
70 // cairo_image_surface_get_data(surface));
71 //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
72 //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
74 //glMatrixMode(GL_PROJECTION);
76 //glMatrixMode(GL_MODELVIEW);
79 //glDisable(GL_COLOR_MATERIAL);
80 //glDisable(GL_CULL_FACE);
81 //glDisable(GL_DEPTH_TEST);
82 //glDisable(GL_LIGHTING);
84 //glTexCoord2d(0, 0); glVertex3f(-1, 1, 1);
85 //glTexCoord2d(1, 0); glVertex3f( 1, 1, 1);
86 //glTexCoord2d(1, 1); glVertex3f( 1, -1, 1);
87 //glTexCoord2d(0, 1); glVertex3f(-1, -1, 1);
89 //glDeleteTextures(1, &tex);
90 //cairo_destroy(cairo);
91 //cairo_surface_destroy(surface);
99 static void gis_plugin_test_plugin_init(GisPluginInterface *iface);
100 G_DEFINE_TYPE_WITH_CODE(GisPluginTest, gis_plugin_test, G_TYPE_OBJECT,
101 G_IMPLEMENT_INTERFACE(GIS_TYPE_PLUGIN,
102 gis_plugin_test_plugin_init));
103 static void gis_plugin_test_plugin_init(GisPluginInterface *iface)
105 g_debug("GisPluginTest: plugin_init");
106 /* Add methods to the interface */
107 iface->expose = gis_plugin_test_expose;
109 /* Class/Object init */
110 static void gis_plugin_test_init(GisPluginTest *self)
112 g_debug("GisPluginTest: init");
117 static void gis_plugin_test_dispose(GObject *gobject)
119 g_debug("GisPluginTest: dispose");
120 GisPluginTest *self = GIS_PLUGIN_TEST(gobject);
121 /* Drop references */
122 G_OBJECT_CLASS(gis_plugin_test_parent_class)->dispose(gobject);
124 static void gis_plugin_test_finalize(GObject *gobject)
126 g_debug("GisPluginTest: finalize");
127 GisPluginTest *self = GIS_PLUGIN_TEST(gobject);
129 G_OBJECT_CLASS(gis_plugin_test_parent_class)->finalize(gobject);
132 static void gis_plugin_test_class_init(GisPluginTestClass *klass)
134 g_debug("GisPluginTest: class_init");
135 GObjectClass *gobject_class = (GObjectClass*)klass;
136 gobject_class->dispose = gis_plugin_test_dispose;
137 gobject_class->finalize = gis_plugin_test_finalize;