LWJGL Forum

Programming => OpenGL => Topic started by: TilmannZ on February 23, 2010, 00:19:42

Title: Texture problems after refactoring to use direct buffers in lwjgl 2.3.0
Post by: TilmannZ on February 23, 2010, 00:19:42
Yesterday I installed the new ATI 10.2 driver (up from 9.12) and promptly ran into the problem that you guys already fixed in 2.3.
It turned out I also had to migrate all usage of Byte/Float/Double/IntBuffers to use direct buffers.

Now the problem is that no objects are displayed anymore. I still see the ground and sky (with texture) and shadows of objects.
But objects themselves are gone, instead I see occasional large (25%-75% of the display) black or grey triangles flickering randomly.
One difference between ground/sky/shadow and object display is that I use
      GL11.glPushMatrix();
      GL11.glMultMatrix (matrixD);   //matrixD being a DoubleBuffer
or
      GL11.glPushMatrix();
      GL11.glMultMatrix (matrixF);   //matrixF being a FloatBuffer
which are not used in ground/sky display.

I've been checking again and again and again, but I'm sure my refactoring from normal to direct buffers is correct.

Is it possible that some other change has been introduced between 2.2.1 and 2.3?
I don't mean necessarily a bug in lwjgl 2.3; chances are that I was doing something incorrect before the refactoring, and now a change in the 2.3 made lwjgl refuse to work with my previously incorrect code.
Any ideas what might be going on?

I only use lwjgl for demonstration purpose, therefore I'm not very experienced and was never concerned with performance either.



I'm on 64bit SUSE Linux, using an 10.2 ATI driver on HD 3850.

Tilmann
===========
www.ode4j.org
Title: Re: Texture problems after refactoring to use direct buffers in lwjgl 2.3.0
Post by: Rene on February 23, 2010, 01:58:48
You could try to revert to the previous version of lwjgl and use your current code to check of you made a mistake while porting your code.
Title: Re: Texture problems after refactoring to use direct buffers in lwjgl 2.3.0
Post by: Matzon on February 23, 2010, 08:18:55
please make sure to flip your buffers. .wrap did that for you with the old indirect buffers.
Title: Re: Texture problems after refactoring to use direct buffers in lwjgl 2.3.0
Post by: princec on February 23, 2010, 17:48:52
It sounds to me like you've forgotten to call order(ByteOrder.nativeOrder()) on all those direct bytebuffers.

Cas :)
Title: Re: Texture problems after refactoring to use direct buffers in lwjgl 2.3.0
Post by: TilmannZ on February 23, 2010, 18:04:42
Indeed (as I saw also in another Thread) I had forgotten to set the byte order.

ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());

I then chose to use org.lwjgl.BufferUtils which is indeed quite helpful.

Thanks to all,
Tilmann

===========
www.ode4j.org