LWJGL 2.3 Released

Started by Matzon, February 21, 2010, 20:41:29

Previous topic - Next topic

Estraven

Hi,
I have trouble with this new release :

>> new: Removed support for indirect buffers as arguments to AL/GL functions

I used to declare non direct buffers, so I had to adapt my code. It now works using small textures, shader loading and so on.

However, when I load big textures (4096*4096 pixels) I get OutOfMemory exception.
I never had this problem with non direct buffers. My application used to load several such textures.

I tried to initiate the JVM using -XX:MaxDirectMemorySize=1024m and -Xmx1024m, but it's still occuring...
damn ! a 4096*4096 ARGB texture is only 64MB.
Any idea what's happening ? Can I initialise a 64MB buffer using "BufferUtils.createByteBuffer(67108864);" ?

By the way, i'm running windows Vista 32bit (Pro) and the lastest version of Java JDK.

Thanks,
Estraven




princec

Tried -Dsun.nio.MaxDirectMemorySize ?

Cas :)

Estraven

Hi,

It doesn't change anything. I tried on another computer (similar hardware : nvidia GTX 285 on Win Vista 32 - drivers 196.21)
On this other computer, no OutOfMemory, but all 4096x4096 texture aren't loaded. each channel equal to 0 on : ARGB (checked through GLSL shaders)
2048x2048 textures load and display ok...

Finally, on the same computer (GTX 285) but Win 7 - 64bits, it renders ok....

Everything work well on every computers/OS on LWJGL 2.2 and using non direct buffers.
Any other ideas ? I'm quite desperate here...

Thanks,
Estraven

EDIT :

It seems like VM arguments   "-Dsun.nio.MaxDirectMemorySize=1024m -Xmx1024m"  are responsible.
On my 32bit OS, I only have 1500MB free, thus, only  "-Dsun.nio.MaxDirectMemorySize=1024m -Xmx512m" works.
On my 64bit OS, (4GB instead of 3GB) I have 2.3GB of free RAM, thus "-Dsun.nio.MaxDirectMemorySize=1024m -Xmx1024m" is working...
I made the assumption that is was "maximum" size, but was I wrong ?

Anyway, it works again.

Thanks for the good work on LWJGL !

Estraven.



delt0r

It sounds like a lot. Are you "reusing" the direct bufferers, or are you just allocating new ones for everything. I basically have a small set of direct bufferers that i reuse to send stuff to lwjgl and have not needed to know anything about -Dsun.nio.MaxDirectMemorySize despite using many 100s of megs of textures and vertex data.
If you want a plot read a book and leave Hollywood out of it.

Estraven

I agree, it's a lot of memory... So I spent the past hours to understand what was happening.

I was only reusing small buffers  :-[ (like texture/vbo/shader ID generation)
I changed my texture loading code. Now I use a single buffer, reallocating it only when the current one is too small to fit the texture (and calling System.gc() to free the previous one).
Indeed, now it works without specifying any  MaxDirectMemorySize ...  8)

In fact, here's what happened :
in some cases, I have a lot of non-graphical stuff in memory, so i do need -Xmx512m.
As I was using non-direct buffer, they were allocated within the JVM memory and everything was ok. (even using a huge set of buffers, disallocated automatically by the Garbage Collector.)
But when I switched to Direct Buffer, my code was really wrong !

Thanks for all the answers. It works just fine now !  :)

Estraven.







Socke

Can someone update the basic Wiki?

I have

QuoteException in thread "main" java.lang.IllegalStateException: Function is not supported
   at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:64)
   at org.lwjgl.opengl.GL11.glBegin(GL11.java:692)
   at Main.main(Main.java:62)

on

Quote// render using OpenGL
           GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(0,0,pos);
                GL11.glVertex3f(1,0,pos);
                GL11.glVertex3f(1,1,pos);
                GL11.glVertex3f(0,1,pos);
           GL11.glEnd();

With ATI Radeon 5770 on Vista 64.

Matzon



Matzon

as expected the wiki pages work fine ... are you sure you're copying it correctly?
have you created the display prior to making opengl calls?

princec

That's the missing compatibility context bug... Wiki page should maybe be updated to check for its availability. But I think Spasi's fixed the issue in LWJGL itself (as no GL drivers currently don't actually expose GL1.x methods in reality, it was a bug).

Cas :)

spasi

Socke, you're either using ContextAttribs somehow or you're running an LWJGL build older than 2.3. With the default Display.create you shouldn't be having this problem with 2.3.

Socke

You are right. I have reinstall all and now it starts.

Does this look right?