From: Kenneth B. R. <kbr...@al...> - 2001-02-20 19:58:14
|
> On Tuesday 20 February 2001 05:42, Joe & Bobbey Huwaldt wrote: > > > > Is there a method by which I can draw on top of a GLCanvas using the > > regular AWT methods? For example, I would like to render a 3D scene using > > GL4Java, then draw some items on top of part of that scene using a regular > > AWT graphics context. My first thought was that I would override paint(), > > but I see that you have prevented that. Did you provide any other way to > > do the same thing? Is it even possible (I haven't looked at the source > > code, so I don't know how the implementation works)? > > In the upcoming 2.5.0-test3 this should work, if you use the new factory api, > because the java window itself will have all the capabilities needed > while using the JDK 1.3 class GraphicsConfiguration internaly > (-> no more new native window will be created) ! Actually this is not guaranteed to work. The AWT may not be able to draw to the same window being drawn to by OpenGL. I believe the root of the problem is a driver issue on Windows; I think it is illegal to mix Windows GDI and OpenGL calls to the same device context. > > I want to do this because it is often easier to draw simple geometry and > > images using the AWT methods than it is to try and do the same thing > > through OpenGL. It would be really nice if I could draw AWT graphics > > elements over top of an OpenGL scene. There are several C/C++ libraries which use OpenGL to draw non-3D images which you might be able to borrow from or port pieces of to make this easier. See GLUI, for example: http://www.cs.unc.edu/~rademach/glui/ -Ken |