[GtkGLExt] gtkglextmm problem
- From: "Martin (OpenGeoMap)" <martin opengeomap org>
- To: gtkglext-list gnome org
- Subject: [GtkGLExt] gtkglextmm problem
- Date: Thu, 21 Aug 2008 17:35:56 -0300
hi!,
i put here a discussion we have in the gtkmm mailing list:
We are talking about the source code you have here:
http://gtkglext.sourceforge.net/reference/gtkglextmm/examples.html
It doesn work for me...
___________________________________
Dave Foster escribió:
I don't currently have gtkglextmm installed. It would be helpful to me
and everyone else on the list if you would post the error messages you
get when compiling your latest source here, since I assume it is
different than in the first mail you sent. I ask becuase it might not
necessarily be a gtkglextmm problem.
The latest source file compile fine. Itś a example i have create by
myself now...
I don know but the doc is for gtkglextmm.1.01 and in my computer i have
gtkglextmm.1.2
the 1.2 package is ubuntu repositories and really easy to install or the
latest source code:
http://sourceforge.net/project/showfiles.php?group_id=54333&package_id=53707&release_id=397294
This is the latest documentation is for 1.0.1:
http://gtkglext.sourceforge.net/reference/gtkglextmm/
could be a version problem?
regards.
dave
On Thu, Aug 21, 2008 at 3:40 PM, Martin (OpenGeoMap)
<martin opengeomap org <mailto:martin opengeomap org>> wrote:
I write this source code and work:
g++ main2.cc `pkg-config --cflags --libs gtkglextmm-x11-1.2`
It seems that the samples from here are bad¿?¿?
http://gtkglext.sourceforge.net/reference/gtkglextmm/examples.html
#include <iostream>
#include <cstdlib>
#include <gtkmm.h>
#include <GL/glu.h>
#include <gtkglmm.h>
#include <math.h>
float boxv[][3] = {
{ -0.5, -0.5, -0.5 },
{ 0.5, -0.5, -0.5 },
{ 0.5, 0.5, -0.5 },
{ -0.5, 0.5, -0.5 },
{ -0.5, -0.5, 0.5 },
{ 0.5, -0.5, 0.5 },
{ 0.5, 0.5, 0.5 },
{ -0.5, 0.5, 0.5 }
};
#define ALPHA 0.5
static float ang = 30.;
class glsample : public Gtk::GL::DrawingArea{
public:
glsample();
virtual ~glsample();
protected:
virtual void on_realize();
virtual bool on_configure_event(GdkEventConfigure* event);
virtual bool on_expose_event(GdkEventExpose* event);
};
glsample::glsample(){
Glib::RefPtr<Gdk::GL::Config> glconfig;
glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB |
Gdk::GL::MODE_DEPTH | Gdk::GL::MODE_DOUBLE);
set_gl_capability(glconfig);
}
glsample::~glsample(){
}
void glsample::on_realize(){
Gtk::GL::DrawingArea::on_realize();
//get gl::window
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();
glwindow->gl_begin(get_gl_context());
glwindow->gl_begin(get_gl_context());
glClearColor(1.0, 0.0, 0.0, 1.0);
glMatrixMode(GL_PROJECTION);
glOrtho(-0.5, 0.5, -0.5, 0.5, -0.1, 0.1);
glColor3f(1.0f, 0.0f, 0.0f);
glDisable(GL_DEPTH_TEST);
glwindow->gl_end();
}
bool glsample::on_configure_event(GdkEventConfigure* event){
//get gl::window
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();
glwindow->gl_begin(get_gl_context());
glViewport(0, 0, GLsizei(get_width()), GLsizei(get_height()));
glwindow->gl_end();
return true;
}
bool glsample::on_expose_event(GdkEventExpose* event){
//get gl::window
Glib::RefPtr<Gdk::GL::Window> glwindow = get_gl_window();
glwindow->gl_begin(get_gl_context());
glClear(GL_COLOR_BUFFER_BIT);
glwindow->swap_buffers();
glBegin (GL_TRIANGLES);
glIndexi (0);
glColor3f (1.0f, 0.0f, 0.0f);
glVertex2i (0, 1);
glIndexi (0);
glColor3f (0.0f, 1.0f, 0.0f);
glVertex2i (-1, -1);
glIndexi (0);
glColor3f (0.0f, 0.0f, 1.0f);
glVertex2i (1, -1);
glEnd ();
// Error detection.
GLenum error = glGetError();
if(error != GL_NO_ERROR)
{
std::cerr << "\n OpenGL error: " << gluErrorString(error);
std::cerr.flush();
}
//main loop
glwindow->gl_end();
glwindow->swap_buffers ();
return true;
}
int main(int argc, char *argv[]){
Gtk::Main init (argc, argv);
Gtk::GL::init (argc, argv);
Gtk::Window window;
window.set_title ("Widget Demo");
glsample drawing;
window.add (drawing);
window.show_all ();
Gtk::Main::run (window);
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]