LWJGL enabling point sprites crashing

Hi,
by enabling these 2 parameters my program crashes about half the time(producing a huge error log), the other half it works perfectly.
Does anyone know why this could be?

GL11.glEnable(ARBPointSprite.GL_POINT_SPRITE_ARB);
GL11.glTexEnvf(ARBPointSprite.GL_POINT_SPRITE_ARB,ARBPointSprite.GL_COORD_REPLACE_ARB, GL11.GL_TRUE);

Thanks,
roland

Hi

Which graphics card do you use? Are you sure this extension is supported on your hardware? Maybe it is simply a driver bug and then it has nothing to do with LWJGL.

Its strange how it works sometimes though…

Primary Adapter
Graphics Card Manufacturer Powered by ATI
Graphics Chipset ATI Mobility Radeon HD 5650
Device ID 68C1
Vendor 1002

Subsystem ID 144A
Subsystem Vendor ID 103C

Graphics Bus Capability PCI Express 2.0
Maximum Bus Setting PCI Express 2.0 x16

BIOS Version 012.019.000.013
BIOS Part Number BR38421.001
BIOS Date 2010/09/07

Memory Size 1024 MB
Memory Type DDR3

Core Clock in MHz 550 MHz
Memory Clock in MHz 800 MHz
Total Memory Bandwidth in GByte/s 25.6 GByte/s

Probably a driver bug, but you might be doing something wrong. Seems like AMD strikes again…
What’s the error?

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x69368f20, pid=1164, tid=6928

JRE version: 6.0_29-b11

Java VM: Java HotSpot™ Client VM (20.4-b02 mixed mode, sharing windows-x86 )

Problematic frame:

C [atioglxx.dll+0x338f20]

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

--------------- T H R E A D ---------------

Current thread (0x0228a000): JavaThread “main” [_thread_in_native, id=6928, stack(0x00240000,0x00290000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x085d7c38

Registers:
EAX=0x052b0640, EBX=0x00000001, ECX=0x0093ff6c, EDX=0x00000000
ESP=0x0028fa14, EBP=0x07c972ec, ESI=0x07c972b8, EDI=0x0028fa28
EIP=0x69368f20, EFLAGS=0x00010246

Top of Stack: (sp=0x0028fa14)
0x0028fa14: 07c972b8 07c972ec 00000000 00000020
0x0028fa24: 3f800000 41a00000 00000018 085aead0
0x0028fa34: 0028fa54 00000000 00000000 693688d5
0x0028fa44: 693688e2 41200000 00000000 07c972ec
0x0028fa54: 00000000 00000007 00000000 00000000
0x0028fa64: 07c972b8 6936820f 00000020 07c972b8
0x0028fa74: 69e89180 00000007 693f47ad 00000000
0x0028fa84: 07c972b8 00000001 00000007 6945d9ce

Instructions: (pc=0x69368f20)
0x69368f00: 24 14 52 6a 01 51 ff d0 f6 45 2c 21 0f 84 5d 01
0x69368f10: 00 00 80 fb 01 75 7b 8b 4d 48 69 c9 94 00 00 00
0x69368f20: 80 bc 31 14 0a 00 00 00 74 68 d9 ee 8b 4e 30 d9
0x69368f30: 54 24 18 8d 7c 24 18 d9 e8 d9 54 24 1c d9 5c 24

Register to memory mapping:

EAX=0x052b0640 is an unknown value
EBX=0x00000001 is an unknown value
ECX=0x0093ff6c is an unknown value
EDX=0x00000000 is an unknown value
ESP=0x0028fa14 is pointing into the stack for thread: 0x0228a000
EBP=0x07c972ec is an unknown value
ESI=0x07c972b8 is an unknown value
EDI=0x0028fa28 is pointing into the stack for thread: 0x0228a000

Stack: [0x00240000,0x00290000], sp=0x0028fa14, free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [atioglxx.dll+0x338f20] atiPPHSN+0x8d530

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.opengl.GL11.nglBindTexture(IIJ)V+0
j org.lwjgl.opengl.GL11.glBindTexture(II)V+16
j map.MapObject.Draw()V+130
j map.Map.Draw()V+196
j Game.Draw()V+10
j Main.()V+99
j Main.main([Ljava/lang/String;)V+3
v ~StubRoutines::call_stub

looks like i could be doing something wrong… although I don’t know what.

You’re binding a texture! OMG! CALL THE POLICE!
Almost certain it’s a driver bug. Check what you call glBindTexture() with?

haha ;D
It’s just a particle image I load on startup.

GL11.glBindTexture(GL11.GL_TEXTURE_2D,m_particleImage.getTextureID());

Also: when it does work, the texture seems to take a while to load (Like the game is running, and my particles are drawing as untextured squares for about 2 seconds and then they switch to the texture they should be using ???

Do you use textures whose size isn’t a power of 2?

This sounds like something else is up. You’re not trying to load that texture in a different thread are you?

Cas :slight_smile:

thanks for the replies everyone.
I’m using a 64x64 texture, and my game is single threaded. I load the particle texture in a create method with all my other textures (and they work fine), so I think it’s something strange with enabling point sprites

I believe there’s a bug with certain versions of the ATI drivers that make point sprite crash when used to render lines or triangle meshes (e.g. non-point).
The solution is to enable point sprite only when rendering point meshes and disable it afterwards.
Reference:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java#2494

Thank you for the tip Momoko_Fan.

Thanks Momoko_Fan!

That fixed it ;D