Creating a minimap in jME 2

Currently, I’m making a game for my final assignment. For that game, I build my own world editor. But now I’m stuck with this problem, creating a minimap. I had tried to make it using render to texture. But i had a problem to save the rendered texture to an image (.png or .jpg). Because of that, I removed the code to create the minimap from my code (I commented it). And after I added some code to finish my world editor, I tried that code again. But now I got a fatal error when the texture renderer render the rootNode which contain my loaded scene.

here is my function:

TextureRenderer tRenderer;
CameraNode camNode;
Texture2D fakeTex;
public void createMinimap(){
tRenderer = display.createTextureRenderer(256, 256, TextureRenderer.Target.Texture2D);
camNode = new CameraNode("Camera Node", tRenderer.getCamera());
camNode.setLocalTranslation(new Vector3f(0,500,0));
camNode.getCamera().setFrustum(1, 10000, -320, 320, -320, 320 );
camNode.lookAt(Vector3f.ZERO, Vector3f.UNIT_Z.negate());
camNode.updateGeometricState(0, true);

Node monitorNode = new Node("Monitor Node");
Quad quad = new Quad("Monitor");
quad.updateGeometry(100, 100);
quad.setLocalTranslation(new Vector3f(50f, 50f, 0));

tRenderer.setBackgroundColor(new ColorRGBA(0.5f, 0f, 0f, 1f));
fakeTex = new Texture2D();
TextureState screen = display.getRenderer().createTextureState();

monitorNode.updateGeometricState(0.0f, true);

and here is the error log:

# A fatal error has been detected by the Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0bed3a51, pid=4884, tid=5452
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) Client VM (14.0-b16 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [iglicd32.dll+0x43a51]
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.


Current thread (0x02f03800): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=5452, stack(0x03190000,0x031e0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

EAX=0x00000000, EBX=0x0000003c, ECX=0x0cc90680, EDX=0x0c27f440
ESP=0x031def30, EBP=0x031df06c, ESI=0x00000000, EDI=0x0c274f40
EIP=0x0bed3a51, EFLAGS=0x00010202

Top of Stack: (sp=0x031def30)
0x031def30: 00000000 0c20daf4 00080538 031def7c
0x031def40: 0c25e1c0 0c20daf4 ffffffff 00000000
0x031def50: 00000010 0000000c 0000003c 00000198
0x031def60: 000a0198 000a0178 031df004 7c916b1e
0x031def70: 00000040 001a2248 00000000 00000010
0x031def80: 00000001 0000005e 00000000 00000010
0x031def90: 000000a3 00000003 000000a6 00000400
0x031defa0: 00000000 000a0198 77f111bc 0c277ef0

Instructions: (pc=0x0bed3a51)
0x0bed3a41: fb 02 7d 04 89 44 24 2c 0f 28 8c 24 80 00 00 00
0x0bed3a51: 0f 12 08 8b 5c 24 2c 0f 16 0b 8b 5c 24 24 0f 28

Stack: [0x03190000,0x031e0000], sp=0x031def30, free space=315k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [iglicd32.dll+0x43a51]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.opengl.GL11.nglDrawElements(IIILjava/nio/Buffer;IJ)V+0
j org.lwjgl.opengl.GL11.glDrawElements(ILjava/nio/IntBuffer;)V+38
j com.jme.renderer.lwjgl.LWJGLRenderer.draw(Lcom/jme/scene/TriMesh;)V+201
j com.jme.scene.TriMesh.draw(Lcom/jme/renderer/Renderer;)V+23
j com.jme.scene.Spatial.onDraw(Lcom/jme/renderer/Renderer;)V+120
j com.jme.scene.Node.draw(Lcom/jme/renderer/Renderer;)V+47
j com.jme.scene.Spatial.onDraw(Lcom/jme/renderer/Renderer;)V+120
j com.jme.scene.PassNode.draw(Lcom/jme/renderer/Renderer;)V+118
j com.gibbon.mfkarpg.terrain.splatting.TerrainPassNode.draw(Lcom/jme/renderer/Renderer;)V+19
j com.jme.scene.Spatial.onDraw(Lcom/jme/renderer/Renderer;)V+120
j com.jme.scene.Node.draw(Lcom/jme/renderer/Renderer;)V+47
j com.jme.scene.Spatial.onDraw(Lcom/jme/renderer/Renderer;)V+120
j com.jme.scene.Node.draw(Lcom/jme/renderer/Renderer;)V+47
j com.jme.scene.Spatial.onDraw(Lcom/jme/renderer/Renderer;)V+120
j com.jme.scene.Node.draw(Lcom/jme/renderer/Renderer;)V+47
j com.jme.scene.Spatial.onDraw(Lcom/jme/renderer/Renderer;)V+120
j com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer.doDraw(Lcom/jme/scene/Spatial;)V+5
j com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer.render(Lcom/jme/scene/Spatial;Lcom/jme/image/Texture;Z)V+142
j com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer.render(Lcom/jme/scene/Spatial;Lcom/jme/image/Texture;)V+4
j xivariawar.worldeditor.WorldEditor$WorldEditorImplementor.simpleRender()V+63
j com.jme.system.canvas.SimplePassCanvasImpl.doRender()V+19
j com.jmex.awt.lwjgl.LWJGLCanvas.paintGL()V+68
j org.lwjgl.opengl.AWTGLCanvas.paint(Ljava/awt/Graphics;)V+162
j sun.awt.RepaintArea.paintComponent(Ljava/awt/Component;Ljava/awt/Graphics;)V+6
j sun.awt.RepaintArea.paint(Ljava/lang/Object;Z)V+326
j java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V+849
j java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V+2
j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46
j java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204
j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
v ~StubRoutines::call_stub


Java Threads: ( => current thread )
0x0baaa400 JavaThread "TimerQueue" daemon [_thread_blocked, id=3552, stack(0x037c0000,0x03810000)]
0x02f59400 JavaThread "Image Fetcher 2" daemon [_thread_blocked, id=5980, stack(0x03770000,0x037c0000)]
0x02f3f000 JavaThread "Image Fetcher 1" daemon [_thread_blocked, id=5528, stack(0x03720000,0x03770000)]
0x02f3b400 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=2252, stack(0x036d0000,0x03720000)]
0x003b7000 JavaThread "DestroyJavaVM" [_thread_blocked, id=6020, stack(0x008c0000,0x00910000)]
=>0x02f03800 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=5452, stack(0x03190000,0x031e0000)]
0x02f01c00 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5772, stack(0x03100000,0x03150000)]
0x02f00800 JavaThread "AWT-Shutdown" [_thread_blocked, id=2124, stack(0x030b0000,0x03100000)]
0x02eff400 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=4472, stack(0x03060000,0x030b0000)]
0x02ab9800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2704, stack(0x02d30000,0x02d80000)]
0x02ab3400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5828, stack(0x02ce0000,0x02d30000)]
0x02ab1c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3192, stack(0x02c90000,0x02ce0000)]
0x02ab0800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1948, stack(0x02c40000,0x02c90000)]
0x02a6e800 JavaThread "Finalizer" daemon [_thread_blocked, id=4804, stack(0x02bf0000,0x02c40000)]
0x02a6d400 JavaThread "Reference Handler" daemon [_thread_blocked, id=4188, stack(0x02ba0000,0x02bf0000)]

Other Threads:
0x02a6b800 VMThread [stack: 0x02b50000,0x02ba0000] [id=5908]
0x02acd400 WatcherThread [stack: 0x02d80000,0x02dd0000] [id=3392]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

def new generation total 1408K, used 1288K [0x22990000, 0x22b10000, 0x22e70000)
eden space 1280K, 91% used [0x22990000, 0x22ab6128, 0x22ad0000)
from space 128K, 87% used [0x22ad0000, 0x22aec178, 0x22af0000)
to space 128K, 0% used [0x22af0000, 0x22af0000, 0x22b10000)
tenured generation total 17796K, used 12787K [0x22e70000, 0x23fd1000, 0x26990000)
the space 17796K, 71% used [0x22e70000, 0x23aecd28, 0x23aece00, 0x23fd1000)
compacting perm gen total 12288K, used 3438K [0x26990000, 0x27590000, 0x2a990000)
the space 12288K, 27% used [0x26990000, 0x26ceb968, 0x26ceba00, 0x27590000)
ro space 8192K, 63% used [0x2a990000, 0x2aea96b0, 0x2aea9800, 0x2b190000)
rw space 12288K, 53% used [0x2b190000, 0x2b804b80, 0x2b804c00, 0x2bd90000)

Dynamic libraries:
0x00400000 - 0x00424000 C:Program FilesJavajre6binjavaw.exe
0x7c900000 - 0x7c9b2000 C:WINDOWSsystem32ntdll.dll
0x7c800000 - 0x7c8f6000 C:WINDOWSsystem32kernel32.dll
0x77dd0000 - 0x77e6b000 C:WINDOWSsystem32ADVAPI32.dll
0x77e70000 - 0x77f03000 C:WINDOWSsystem32RPCRT4.dll
0x77fe0000 - 0x77ff1000 C:WINDOWSsystem32Secur32.dll
0x7e410000 - 0x7e4a1000 C:WINDOWSsystem32USER32.dll
0x77f10000 - 0x77f59000 C:WINDOWSsystem32GDI32.dll
0x76390000 - 0x763ad000 C:WINDOWSsystem32IMM32.DLL
0x629c0000 - 0x629c9000 C:WINDOWSsystem32LPK.DLL
0x74d90000 - 0x74dfb000 C:WINDOWSsystem32USP10.dll
0x7c340000 - 0x7c396000 C:Program FilesJavajre6binmsvcr71.dll
0x6d800000 - 0x6da8b000 C:Program FilesJavajre6binclientjvm.dll
0x76b40000 - 0x76b6d000 C:WINDOWSsystem32WINMM.dll
0x6d7b0000 - 0x6d7bc000 C:Program FilesJavajre6binverify.dll
0x6d330000 - 0x6d34f000 C:Program FilesJavajre6binjava.dll
0x6d290000 - 0x6d298000 C:Program FilesJavajre6binhpi.dll
0x76bf0000 - 0x76bfb000 C:WINDOWSsystem32PSAPI.DLL
0x6d7f0000 - 0x6d7ff000 C:Program FilesJavajre6binzip.dll
0x6d000000 - 0x6d14a000 C:Program FilesJavajre6binawt.dll
0x73000000 - 0x73026000 C:WINDOWSsystem32WINSPOOL.DRV
0x77c10000 - 0x77c68000 C:WINDOWSsystem32msvcrt.dll
0x774e0000 - 0x7761e000 C:WINDOWSsystem32ole32.dll
0x773d0000 - 0x774d3000 C:WINDOWSWinSxSx86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202comctl32.dll
0x77f60000 - 0x77fd6000 C:WINDOWSsystem32SHLWAPI.dll
0x5ad70000 - 0x5ada8000 C:WINDOWSsystem32uxtheme.dll
0x74720000 - 0x7476c000 C:WINDOWSsystem32MSCTF.dll
0x755c0000 - 0x755ee000 C:WINDOWSsystem32msctfime.ime
0x7c9c0000 - 0x7d1d7000 C:WINDOWSsystem32shell32.dll
0x6d230000 - 0x6d284000 C:Program FilesJavajre6binfontmanager.dll
0x6d610000 - 0x6d623000 C:Program FilesJavajre6binnet.dll
0x71ab0000 - 0x71ac7000 C:WINDOWSsystem32WS2_32.dll
0x71aa0000 - 0x71aa8000 C:WINDOWSsystem32WS2HELP.dll
0x6d630000 - 0x6d639000 C:Program FilesJavajre6binnio.dll
0x10000000 - 0x10057000 D:eclipse workspacejMEnativeslwjgl.dll
0x5ed00000 - 0x5edcc000 C:WINDOWSsystem32OPENGL32.dll
0x68b20000 - 0x68b40000 C:WINDOWSsystem32GLU32.dll
0x73760000 - 0x737ab000 C:WINDOWSsystem32DDRAW.dll
0x73bc0000 - 0x73bc6000 C:WINDOWSsystem32DCIMAN32.dll
0x77c00000 - 0x77c08000 C:WINDOWSsystem32VERSION.dll
0x6d360000 - 0x6d366000 C:Program FilesJavajre6binjawt.dll
0x03820000 - 0x03827000 C:Program FilesInternet Download Manageridmmkb.dll
0x77120000 - 0x771ab000 C:WINDOWSsystem32OLEAUT32.DLL
0x0be90000 - 0x0c0cd000 C:WINDOWSsystem32iglicd32.dll
0x0c160000 - 0x0c1aa000 C:WINDOWSsystem32igldev32.dll
0x68000000 - 0x68036000 C:WINDOWSsystem32rsaenh.dll
0x769c0000 - 0x76a74000 C:WINDOWSsystem32USERENV.dll
0x5b860000 - 0x5b8b5000 C:WINDOWSsystem32netapi32.dll
0x71a50000 - 0x71a8f000 C:WINDOWSSystem32mswsock.dll
0x76f20000 - 0x76f47000 C:WINDOWSsystem32DNSAPI.dll
0x76fb0000 - 0x76fb8000 C:WINDOWSSystem32winrnr.dll
0x76f60000 - 0x76f8c000 C:WINDOWSsystem32WLDAP32.dll
0x66210000 - 0x66219000 C:WINDOWSsystem32netwareNWWS2NDS.DLL
0x50d50000 - 0x50d85000 C:WINDOWSsystem32NETWIN32.DLL
0x50d00000 - 0x50d16000 C:WINDOWSsystem32CLNWIN32.DLL
0x50df0000 - 0x50e15000 C:WINDOWSsystem32LOCWIN32.dll
0x50db0000 - 0x50de5000 C:WINDOWSsystem32NCPWIN32.dll
0x71ad0000 - 0x71ad9000 C:WINDOWSsystem32WSOCK32.dll
0x66220000 - 0x6622c000 C:WINDOWSsystem32netwareNWWS2SLP.DLL
0x66250000 - 0x66257000 C:WINDOWSsystem32NWSRVLOC.dll
0x0c370000 - 0x0c389000 C:Program FilesBonjourmdnsNSP.dll
0x76d60000 - 0x76d79000 C:WINDOWSsystem32Iphlpapi.dll
0x76fc0000 - 0x76fc6000 C:WINDOWSsystem32rasadhlp.dll
0x6d450000 - 0x6d474000 C:Program FilesJavajre6binjpeg.dll

VM Arguments:
jvm_args: -Djava.library.path=D:eclipse workspacejMEnatives
java_command: xivariawar.worldeditor.WorldEditor
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:Program FilesJavajre6binclient;C:Program FilesJavajre6bin;C:Program FilesNVIDIA CorporationPhysXCommon;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:Program FilesMicrosoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100DTSBinn;C:Program FilesMicrosoft SQL Server100ToolsBinnVSShellCommon7IDE;C:Program FilesMicrosoft Visual Studio 9.0Common7IDEPrivateAssemblies;C:WINDOWSsystem32WindowsPowerShellv1.0;C:WINDOWSsystem32nls;C:WINDOWSsystem32nlsENGLISH;c:Program FilesMicrosoft SQL Server90Toolsbinn;C:Program FilesAutodeskBackburner;C:Program FilesCommon FilesAutodesk Shared;C:Python26
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel


OS: Windows XP Build 2600 Service Pack 3

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 13, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3

Memory: 4k page, physical 1039532k(245780k free), swap 2500752k(1514324k free)

vm_info: Java HotSpot(TM) Client VM (14.0-b16) for windows-x86 JRE (1.6.0_14-b08), built on May 21 2009 08:03:56 by "java_re" with MS VC++ 7.1

time: Fri Jan 07 15:25:06 2011
elapsed time: 6 seconds

For information, my scene contain a TerrainPage with splatted texture (i'm using a slightly modified TerrainPass posted by Momoko_Fan), a skybox, a waterquad (with WaterRenderPass), and some objects with ogrexml format.

Can somebody help me to solve this problem? I need to know what caused that fatal error and how to fix that. Also how to save the rendered texture to an image file. Or maybe if anyone does know how to create a minimap by using another method, please share it for me.

Thanks in advance.

I have an idea but this might get complicated. To confirm, please detach (comment out or whatever, it just shouldn’t be drawn) the WaterRenderPass and tell me if it works then.

Thanks for your suggestion. I haven’t tried it yet, but I think there’s a possibility WaterRenderPass is the cause. Actually, two days ago I used the computer at my work place (which doesn’t support water effect, the water only appeared as a transparent quad with moving texture), but now when I tried my code with the computer at my home (which support water effect), it works just fine. So maybe WaterRenderPass is the issue for that fatal error (For real confirmation, we have to wait for tomorrow until i get to my workplace’s computer).

So, how do I save the rendered texture into an image file?

Oh yeah, there’s something else I want to ask, it’s about water effect. I can’t seems to get the water rendered correctly. It doesn’t have any refraction so it looks just like a wavy mirror. And also the reflection is a bit weird, it always shows the object’s part which should be under the water. Here is the screenshot (you can see the character with no refraction and a weird reflection).

and this is the code

private void createWater(){
wPass = new WaterRenderPass(cam, 4, false, true);
wPass.setWaterPlane(new Plane(new Vector3f(0.0f, 1.0f, 0.0f), 0.0f));

waterQuad = new Quad("waterQuad", 1, 1);

FloatBuffer normBuf = waterQuad.getNormalBuffer();



Thanks in advance.

Well, about the water, I finally found the answer why it doesn’t show refraction of my scene like TestQuadWater (or any jME sample) does. I didn’t use FogState in my scene. After I added FogState to my scene, the water works perfectly. It shows the refraction of the scene at a certain angle and the color of the reflected scene is also a bit darker (before, it almost showed an exact color which made it looked like a wavy mirror)

So the problem left is how to make the minimap. Can anybody help me?