Low level graphic

Dear guys,

JME is only the 3D engine, I don't want to use JMEDesktop for the Menu of my game. I want to use low level graphics manipulation for creating the Menu. Example, when you're playing car racing, after you press Escape, the Menu (2D Graphics) will show up and the background will still the car in 3D racing. What I want is to draw the Menu (from image, …) as Canvas (low level graphics). I don't want to use any library for the Menu. I'm using GameState. How can I do that. I can't get the Canvas to call graphic.drawImage(…) as what I did with 2D game engine

Could you help me!

The canvas used by jME is special and has its paint method specified by LWJGL. You cannot really mix Java2D and jME calls in the same Canvas, unless you mess with the LWJGL code. I would recommend using a flat quad that fills all the camera view and then draw your menu on top of that.

But how can I draw each picture on the Quad? Could I get some thing like Canvas from Quad? As I know, I can only apply the texture on the Quad, but with texture, we cannot create animation in 2D

It really depends on the method you are trying to do. One, which is not particularly fast, but might be appropriate for a menu which does not change very often, is to draw your menu not to a Canvas, but to an Image (BufferedImage for instance) and then use that as the Texture for that Quad.



However, what I was thinking about what to have the quad be static, and then draw whatever you needed (say FengGUI, JMEDesktop, or even 3D objects) on top of that… The quad would just provide a nice background for your menu, and would occlude your scene (assuming it has not been detached/deactivated).

Perhaps this is another case where something like a texture atlas would be a good fit?  To animate you simply update texcoords to display the current "frame" you wish to have active.



There was an old thread(s) around here for doing 2D sprite style animation on a quad, if you do a few searches it'll likely turn up.

The problem with the atlas is that the number of frames would be constant, and not changeable in practice at runtime.