problems migrating to Windows 7 64 bits

Started by Achim, January 02, 2010, 10:44:08 AM

Previous topic - Next topic

Achim

Hi, I am moving my application to my new Windows 7 64 bit system and have memory problems when using the HW renderer (sw rendering works fine). I am thinking this may have to do with 32bit libs. The error I am getting is after creating the HW FrameBuffer (which doesn't show anything except the background in the specified color):

Loading Texture...karoXY.jpg
Loading Texture...karoYZ.jpg
Loading Texture...karoXZ.jpg
Loading Texture...karobw.jpg
Loading Texture...envmap-alu.jpg
Java version is: 1.6.0_14
-> support for BufferedImage
Version helper for 1.2+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Using LWJGL's AWTGLCanvas
Adding Lightsource: 0
Driver is: RDPDD/null on NVIDIA Corporation / GeForce GT 220/PCI/SSE2
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
Hardware supports textures up to 8192*8192 in size!
Additional visibility list (2) created with size: 4096
Additional visibility list (3) created with size: 4096
Additional visibility list (4) created with size: 4096
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Direct buffer memory
   at java.nio.Bits.reserveMemory(Bits.java:633)
   at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
   at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
   at com.threed.jpct.GLBase.convertTexture(Unknown Source)
   at com.threed.jpct.GLBase.setRenderTarget(Unknown Source)
   at com.threed.jpct.AWTGLRenderer.executeGL(Unknown Source)
   at com.threed.jpct.AWTJPCTCanvas.paintGL(Unknown Source)
   at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:288)
   at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:317)
   at sun.awt.RepaintArea.updateComponent(RepaintArea.java:239)
   at sun.awt.RepaintArea.paint(RepaintArea.java:216)
   at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:306)
   at java.awt.Component.dispatchEventImpl(Component.java:4706)
   at java.awt.Component.dispatchEvent(Component.java:4460)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

The code runs OK in my old Windows XP environment. Any suggestions of what I could do? (I am using  lwjgl 2.2.1 already)


EgonOlsen

Looks like as if you are using shadow mapping? If yes, what is the size of the shadow map? If not, what else is the render target that you seem to use? The amount of direct memory is somehow derived from the amount of VM memory. So the first option would be to increase that by doing an -Xmx1024m or similar. If that doesn't help, you can specify the amount of direct memory at startup with the parameter -XX:MaxDirectMemorySize=<your size> in the same way you are doing it with -Xmx.

Hope this helps...

EgonOlsen


Achim

no :-(
I am indeed using shadows, but did not have any problems on my old XP installation. I am also experiencing funy behaviour with SW rendering. Swing components used in a sibling panel (both are components of a frame) are flashed briefly at location 0,0 of the panel with the OpneGL buffer....

Achim

EgonOlsen

#4
Is this somehow a remote desktop connection (judging from that strange Drivername "RDPDD")? That's a very strange name for a display adapter and the only thing i can find about this name is the remote desktop. I've no idea if this is related to the problem though.

EgonOlsen

Maybe you could try this little test program:


import java.nio.*;

public class MallocTest {

public static void main(String[] args) {
allocate(256 * 256);
allocate(512 * 512);
allocate(1024 * 1024);
allocate(2048 * 2048);
allocate(4096 * 4096);
allocate(8192 * 8192);
}

private static void allocate(int size) {
int bytes = size << 2;
System.out.println("Allocating " + bytes + " bytes of direct memory!");
try {
ByteBuffer tmp = ByteBuffer.allocateDirect(bytes);
tmp.order(ByteOrder.LITTLE_ENDIAN);
} catch (Throwable t) {
System.out.println("Failed to allocate " + bytes + " bytes!");
return;
}
System.out.println("Succeded to allocate " + bytes + " bytes!");
}
}



Edit: What's the size of your shadow map?

Achim

output:

C:\Oracle\Middleware\jdk160_14_R27.6.5-32\bin\javaw.exe -client -classpath "C:\dev\jpctTests\simpleTest\classes;C:\Program Files (x86)\Java\jpct\lib\jpct\jpct.jar;C:\Program Files (x86)\Java\jpct\lib\lwjgl-2.0\jar\jinput.jar;C:\Program Files (x86)\Java\jpct\lib\lwjgl-2.0\jar\lwjgl.jar;C:\Program Files (x86)\Java\jpct\lib\lwjgl-2.0\jar\lwjgl_test.jar;C:\Program Files (x86)\Java\jpct\lib\lwjgl-2.0\jar\lwjgl_util.jar;C:\Program Files (x86)\Java\jpct\lib\lwjgl-2.0\jar\lwjgl_util_applet.jar" MallocTest
Allocating 262144 bytes of direct memory!
Succeded to allocate 262144 bytes!
Allocating 1048576 bytes of direct memory!
Succeded to allocate 1048576 bytes!
Allocating 4194304 bytes of direct memory!
Succeded to allocate 4194304 bytes!
Allocating 16777216 bytes of direct memory!
Succeded to allocate 16777216 bytes!
Allocating 67108864 bytes of direct memory!
Failed to allocate 67108864 bytes!
Allocating 268435456 bytes of direct memory!
Failed to allocate 268435456 bytes!
Process exited with exit code 0.

with -Xmx1024m :

Allocating 262144 bytes of direct memory!
Succeded to allocate 262144 bytes!
Allocating 1048576 bytes of direct memory!
Succeded to allocate 1048576 bytes!
Allocating 4194304 bytes of direct memory!
Succeded to allocate 4194304 bytes!
Allocating 16777216 bytes of direct memory!
Succeded to allocate 16777216 bytes!
Allocating 67108864 bytes of direct memory!
Succeded to allocate 67108864 bytes!
Allocating 268435456 bytes of direct memory!
Succeded to allocate 268435456 bytes!
Process exited with exit code 0.

I also switched off shadow maps - still the same error ...

EgonOlsen

That makes no sense to me... ??? The test case works as expected and so should the application...

However, i'm wondering why you are using the 32bit version of Java!? Maybe that's the problem? Have you tried with the 64bit version instead? In addition, please try this jar instead of the official one: http://www.jpct.net/download/beta/jpct.jar. If you are setting Config.glVerbose to true, it will print out some more information when uploading the textures. Please give it a try and post the log.

Achim

#8
thanks for your help, Egon.
I am using jdeveloper and installed what I beleived was teh 64bit version - this apparently included the 32bit JDK, however. Now I am traing to find out how one can force jdeveloper to use another, i.e. 64bit JDK (or at least configure the run options for a program to use a difference JVM from the one installed with jdeveloper)
The box demo runs in my current setup, however. I will try the jpcr beta over the weekend.

Update: now running in 64bit JVM. It works now, but very slow (much slower than the SW renderer), and also with shadows. I did System.setProperty("sun.java2d.d3d", "false"); as you suggested some time ago, but this did not have a visible effect.

EgonOlsen

Maybe it's using OpenGL's software fallback? Are you using the drivers that come with Windows 7? If so, please install one from NVidia directly to see if that helps. The MS drivers that come with the OS don't support HW-acceleration for OpenGL. That's of course not because MS wants you to use DirectX instead, it's just because....they want you to use DirectX instead... ;)

Achim

I do have the lates NVIDA driver - version 195.62.
I am not sure though whether that is used automatically for OpenGL (Windows making it more difficult than necessary ?), or whether you would have to change some settings...

EgonOlsen

No, you don't have to do anything else...could you post the complete log that jPCT prints out when running your application?

EgonOlsen

I did some research based on your first log and i think that this "rdpdd"-thing could be the problem. This seems to be the "remote desktop protocol display driver", which is not the one that i want to use. But i'm not sure how to change that nor that i even can do it from outside of LWJGL.

Could you please try to run this little test and post the output?


import java.awt.*;

public class GDTest {
public static void main(String[] args) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.getScreenDevices();
for (GraphicsDevice gd : gds) {
System.out.println(gd.getIDstring());
GraphicsConfiguration[] gcs = gd.getConfigurations();
for (GraphicsConfiguration gc : gcs) {
System.out.println("--> " + gc.toString());
}
}
}
}

EgonOlsen

#13
In addition, you could try if the native OpenGL support shows the same effect. You could either use one of the examples for that or download the terrain demo from here: http://www.jpct.net/download/misc/terrain.zip (i hope that 64bit lwjgl stuff is already included there...). It prints out the frame rate to the console. On a current system with a lowly graphics card like yours, i would expect it to produce 50-70fps at the starting position without moving the mouse.
I'm also interested if this renderer still says RDPDD as driver/card name.

Edit: A member of the lwjgl forum suggest to try to start with these parameters:


-Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false


I highly doubt that this will do any good, but you never know...

Achim

will try the things you suggested above. In the meantime, here the log of the startup with the new jpct beta:
C:\Oracle\Middleware\jdk1.6.0_17\bin\javaw.exe -server -classpath C:\dev\TensegrityDesign\ClientAppOpenGL\classes;C:\dev\TensegrityDesign\jdom\build\jdom.jar;C:\dev\TensegrityDesign\jpct\lib\lwjgl-2.2.1\jar\lwjgl_util.jar;C:\dev\TensegrityDesign\jpct\lib\lwjgl-2.2.1\jar\lwjgl.jar;C:\dev\TensegrityDesign\jpct\lib\lwjgl-2.2.1\jar\jinput.jar;C:\dev\TensegrityDesign\jpct\lib\lwjgl-2.2.1\jar\lwjgl_util_applet.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-antlr.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-apache-bcel.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-apache-bsf.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-apache-log4j.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-apache-oro.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-apache-regexp.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-apache-resolver.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-commons-logging.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-commons-net.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-jai.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-javamail.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-jdepend.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-jmf.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-jsch.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-junit.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-launcher.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-netrexx.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-nodeps.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-starteam.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-stylebook.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-swing.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-trax.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant-weblogic.jar;C:\Oracle\Middleware\jdeveloper\ant\lib\ant.jar;C:\dev\TensegrityDesign\jpct\lib\lwjgl-2.2.1\native\windows;C:\dev\TensegrityDesign\jpct\lib\jpct_beta\jpct.jar -Djava.library.path=C:\dev\TensegrityDesign\jpct\lib\lwjgl-2.2.1\native\windows\ Tensegrity3DApplet -Xmx1024m
Loading Texture...karoXY.jpg
Loading Texture...karoYZ.jpg
Loading Texture...karoXZ.jpg
Loading Texture...karobw.jpg
Loading Texture...envmap-alu.jpg
Java version is: 1.6.0_17
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Using LWJGL's AWTGLCanvas
Adding Lightsource: 0
Driver is: RDPDD/6.1.7600.16385 on NVIDIA Corporation / GeForce GT 220/PCI/SSE2
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
Hardware supports textures up to 8192*8192 in size!
Additional visibility list (2) created with size: 4096
Software renderer disposed
Additional visibility list (3) created with size: 4096
Additional visibility list (4) created with size: 4096
Allocating 268435456 bytes of direct memory!
Allocating 268435456 bytes of direct memory!
Allocating 262144 bytes of direct memory!
Caching 262144 bytes of direct memory!

then my output messages start