Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, November 2006
Define a 3d object in a QGLWidget


Message 1 in thread

Dear all,

  I'm a little confused about QGLWidget. In Qt C++ hellogl example, there
are many calls to opengl primitives (e.g. glVertex3d, glRotated...) to
defined 3d objects in methods like paintGL() or initializeGL() of the
QGLWidget subclass. However, I not found this methods in Qt-Jambi. How can I
define 3d objects in a QGLWidget ? Maybe QGLWidget isn't entirely ported
into Qt-Jambi ?

  Sorry for my naive question, I'm a newbe with Qt and Qt-Jambi.

  Laurent.

Message 2 in thread

On Saturday 04 November 2006 22:32, Laurent Jourdren wrote:
> Dear all,
>
>   I'm a little confused about QGLWidget. In Qt C++ hellogl example, there
> are many calls to opengl primitives (e.g. glVertex3d, glRotated...) to
> defined 3d objects in methods like paintGL() or initializeGL() of the
> QGLWidget subclass. However, I not found this methods in Qt-Jambi. How can
> I define 3d objects in a QGLWidget ? Maybe QGLWidget isn't entirely ported
> into Qt-Jambi ?
>
>   Sorry for my naive question, I'm a newbe with Qt and Qt-Jambi.
>
>   Laurent.

Hi, Laurent!

These gl* functions aren't part of Qt, but of your OpenGL implementation, 
which is a separate C library. The QGLWidget only sets up an OpenGL context 
in which these OpenGL functions render. In C++ you can use these OpenGL 
functions directly. But in Java you need to use a wrapper like LWJGL or JOGL 
to access OpenGL. I am using JOGL with Qt Jambi and this combination works 
nicely. You need to follow the hints about external contexts in the JOGL 
documentation and you should be fine.

Regards,
Gregor


Message 3 in thread

2006/11/5, Gregor Mückl <GregorMueckl@xxxxxx>:
>
> On Saturday 04 November 2006 22:32, Laurent Jourdren wrote:
> > Dear all,
> >
> >   I'm a little confused about QGLWidget. In Qt C++ hellogl example,
> there
> > are many calls to opengl primitives (e.g. glVertex3d, glRotated...) to
> > defined 3d objects in methods like paintGL() or initializeGL() of the
> > QGLWidget subclass. However, I not found this methods in Qt-Jambi. How
> can
> > I define 3d objects in a QGLWidget ? Maybe QGLWidget isn't entirely
> ported
> > into Qt-Jambi ?
> >
> >   Sorry for my naive question, I'm a newbe with Qt and Qt-Jambi.
> >
> >   Laurent.
>
> Hi, Laurent!
>
> These gl* functions aren't part of Qt, but of your OpenGL implementation,
> which is a separate C library. The QGLWidget only sets up an OpenGL
> context
> in which these OpenGL functions render. In C++ you can use these OpenGL
> functions directly. But in Java you need to use a wrapper like LWJGL or
> JOGL
> to access OpenGL. I am using JOGL with Qt Jambi and this combination works
> nicely. You need to follow the hints about external contexts in the JOGL
> documentation and you should be fine.



  Hi Gregor,

   With JOGL wrapper, I put the following lines in the initializeGL() method
:

   GLContext context = GLDrawableFactory.getFactory
().createExternalGLContext();
   GL gl = context.getGL();

  And everything works fine now. I've been able to translate the C++ Qt
hellogl example to QtJambi !!!

  Thanks !

  Laurent.