Multitexturing

I would like to see an example of how to use multitexturing.
I tried

GL.glActiveTextureARB ( GL.GL_TEXTURE0_ARB ); 
GL.glEnable ( GL.GL_TEXTURE_2D ); 

GL.glActiveTextureARB ( GL.GL_TEXTURE1_ARB ); 
GL.glEnable ( GL.GL_TEXTURE_2D ); 

(worked well enough in my C++ applications).
This only gives a bunch of jvm errors.
Any ideas?

Are you using 1.5beta and an older version of LWJGL? I had problems with this setup (all kinds of weird VM crashes like the one you mention). I don’t know what was wrong really, everything works with the latest version from cvs.

No I’m using java 1.4.2 and lwjgl 0.8

Maybe there are some other lwgl methods I have to run before this will work?

perhaps post the VM errors?

Apearantly the problem only occurs when I enable vertex arrays afterwards.

GL.glClientActiveTextureARB (
GL.GL_TEXTURE0_ARB );
GL.glEnableClientState (
GL.GL_TEXTURE_COORD_ARRAY );

GL.glClientActiveTextureARB (
GL.GL_TEXTURE1_ARB );
GL.glEnableClientState (
GL.GL_TEXTURE_COORD_ARRAY );

When I get my program to work I’'ll be putting this online for the other newbies :slight_smile:

Log:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x6918592E
Function=atiPPHSN+0xE96E
Library=C:\WINNT\system32\atioglxx.dll

Current Java thread:
at org.lwjgl.opengl.CoreGL11.glDrawArrays(Native Method)
at PSO3DTESTS.test3.render(test3.java:235)
at PSO3DTESTS.test3.main(test3.java:64)

Dynamic libraries:
0x00400000 - 0x00406000 C:\WINNT\system32\java.exe
0x77F50000 - 0x77FF7000 C:\WINNT\System32\ntdll.dll
0x77E60000 - 0x77F46000 C:\WINNT\system32\kernel32.dll
0x77DD0000 - 0x77E5D000 C:\WINNT\system32\ADVAPI32.dll
0x78000000 - 0x78086000 C:\WINNT\system32\RPCRT4.dll
0x77C10000 - 0x77C63000 C:\WINNT\system32\MSVCRT.dll
0x08000000 - 0x08138000 C:\Program Files\Java\j2re1.4.2_04\bin\client\jvm.dll
0x77D40000 - 0x77DCC000 C:\WINNT\system32\USER32.dll
0x77C70000 - 0x77CB0000 C:\WINNT\system32\GDI32.dll
0x76B40000 - 0x76B6C000 C:\WINNT\system32\WINMM.dll
0x76390000 - 0x763AC000 C:\WINNT\System32\IMM32.DLL
0x629C0000 - 0x629C8000 C:\WINNT\system32\LPK.DLL
0x72FA0000 - 0x72FFA000 C:\WINNT\system32\USP10.dll
0x10000000 - 0x10007000 C:\Program Files\Java\j2re1.4.2_04\bin\hpi.dll
0x003A0000 - 0x003AE000 C:\Program Files\Java\j2re1.4.2_04\bin\verify.dll
0x003B0000 - 0x003C9000 C:\Program Files\Java\j2re1.4.2_04\bin\java.dll
0x003D0000 - 0x003DD000 C:\Program Files\Java\j2re1.4.2_04\bin\zip.dll
0x02C60000 - 0x02CA4000 C:\projects\java\3D\PSO3D\lwjgl.dll
0x72280000 - 0x722A8000 C:\WINNT\system32\DINPUT.dll
0x5ED00000 - 0x5EDC6000 C:\WINNT\system32\OPENGL32.dll
0x68B20000 - 0x68B3E000 C:\WINNT\system32\GLU32.dll
0x51000000 - 0x51047000 C:\WINNT\system32\DDRAW.dll
0x73BC0000 - 0x73BC6000 C:\WINNT\system32\DCIMAN32.dll
0x77C00000 - 0x77C07000 C:\WINNT\system32\VERSION.dll
0x74720000 - 0x74764000 C:\WINNT\System32\MSCTF.dll
0x04D20000 - 0x04D4B000 C:\WINNT\System32\msctfime.ime
0x771B0000 - 0x772D1000 C:\WINNT\System32\ole32.dll
0x746F0000 - 0x74716000 C:\WINNT\System32\Msimtf.dll
0x688F0000 - 0x688F9000 C:\WINNT\system32\HID.DLL
0x76670000 - 0x76757000 C:\WINNT\system32\SETUPAPI.DLL
0x69000000 - 0x69361000 C:\WINNT\system32\atioglxx.dll
0x073D0000 - 0x074DF000 C:\Program Files\Java\j2re1.4.2_04\bin\awt.dll
0x73000000 - 0x73023000 C:\WINNT\system32\WINSPOOL.DRV
0x074F0000 - 0x07540000 C:\Program Files\Java\j2re1.4.2_04\bin\fontmanager.dll
0x5C000000 - 0x5C0C8000 C:\WINNT\system32\D3DIM700.DLL
0x07610000 - 0x0762E000 C:\Program Files\Java\j2re1.4.2_04\bin\jpeg.dll
0x76C90000 - 0x76CB2000 C:\WINNT\system32\imagehlp.dll
0x6D510000 - 0x6D58D000 C:\WINNT\system32\DBGHELP.dll
0x76BF0000 - 0x76BFB000 C:\WINNT\system32\PSAPI.DLL

Heap at VM Abort:
Heap
def new generation total 576K, used 215K [0x10010000, 0x100b0000, 0x104f0000)
eden space 512K, 41% used [0x10010000, 0x10044be8, 0x10090000)
from space 64K, 7% used [0x100a0000, 0x100a1290, 0x100b0000)
to space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000)
tenured generation total 1408K, used 981K [0x104f0000, 0x10650000, 0x14010000)
the space 1408K, 69% used [0x104f0000, 0x105e5768, 0x105e5800, 0x10650000)
compacting perm gen total 4096K, used 2857K [0x14010000, 0x14410000, 0x18010000)
the space 4096K, 69% used [0x14010000, 0x142da4b0, 0x142da600, 0x14410000)

Local Time = Tue Apr 13 11:51:03 2004
Elapsed Time = 0

The exception above was detected in native code outside the VM

Java VM: Java HotSpot™ Client VM (1.4.2_04-b05 mixed mode)

Did you remember to set up a texture coordinate array for the second unit too (glTexCoordPointer should be called once per enabled tex unit)?

  • elias

Yes that’s it!
I was only trying to activate these features, without using them.
Now I 've assigned a texturecoordinatebuffer to both of the texture units, and it’s working well.

thanks!