aboutsummaryrefslogtreecommitdiffstats
path: root/docs/gl4javafaq.html
blob: 8115bee8873441d4605c850c5517467ce44561e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="AUTHOR" content="Alban Cousinie">
   <meta name="CLASSIFICATION" content="Jausoft - Sven Goethel Software Development">
   <title>Jausoft - Sven Goethel Software Development</title>
<style>
	<!--
		A:visited { color: #800080 }
		A:link { color: #0000ff }
	-->
	</style>
</head>
<body bgcolor="#E6E6FF" link="#0000FF" vlink="#800080">
<font size=+2>OpenGL<SUP><FONT SIZE="1">TM</FONT></SUP>for Java<SUP><FONT SIZE="1">TM</FONT></SUP> Frequently Asked
Questions (F.A.Q)</font>
<hr>
<p><b><i>Table Of Contents (TOC)</i></b><br><br>

<i>GL4Java general questions : </i><br>
<a href="#what">What is GL4Java ?</a><br>
<a href="#who">Who makes GL4Java ?</a><br>
<a href="#how">How can I learn using GL4Java ?</a><br>
<a href="#pay">Do I have to pay in order to use GL4Java ?</a><br>
<a href="#howcanihelp">How can I help ?</a><br>
<a href="#wherecanigetitfrom">Where can I download and install the beast ?</a><br>
<a href="#appl">What kinda GL4Java applications and applets currently exist ?</a><br>

<br>
<i>JAVA related questions : </i><br>
<a href="#whichjvm">Which Java Virtuell Machine (JVM) should I use ?</a><br>
<a href="#javaslow">But isn't Java slow ?</a><br>
<a href="#ports">What platforms does GL4Java run on ?</a><br>
<a href="#java3d">How does GL4Java compare to Java3D ?</a><br>

<br>
<i>GL4Java installation questions : </i><br>
<a href="#java2installer">How to use the Installer ?</a><br>
<a href="#java2setup">GL4Java Installation Check-List (for Java2) !</a><br>
<a href="#java2installprobs">Please Help - It won't run !</a><br><br>

<a href="#rtfm">What should I read before you reply with RTFM ? Whom should I ask ?</a><br>
<a href="#how2complain">How-To Complain About Non Working GL4Java ?</a><br>

<br>
<i>GL4Java technical questions : </i><br>
<a href="#memoryleak1">Does GL4Java has a memory leak (Part 1) ?</a><br>
<a href="#memoryleak2">Does GL4Java has a memory leak (Part 2) ?</a><br><br>

<a href="#frame">My Canvas renders 1 frame, then stops, what's wrong ?</a><br>
<a href="#weight">GLAnimCanvas vs GLJPanel, which should I choose ?</a><br>
<a href="#model">GLJPanel/GLAnimCanvas subclass model vs GLEventListener model, which should I choose ?</a><br><br>

<a href="#extensions">Extensions - Does GL4Java support extensions ? How do I load them ?</a><br>
<a href="#tesselation">Tesselation - Does GL4Java support tesselation ? How do I use it ?</a><br>
<a href="#offscreen">Offscreen - How Do I Use Offscreen Rendering with GL4Java ? </a><br>
<a href="#fullscreen">Fullscreen - How Do I Use Fullscreen with GL4Java ?</a></b><br>
<a href="#bumpmapping">Bump Mapping - How Do I Use Bump Mapping with GL4Java ?</a></b><br>

<br>

<i>General questions : </i><br>
<a href="#trademarks">Trademarks</a><br>
</p>
<br><br>

<!--TODO NEXT
-->


<a NAME="what"></a>
<p><b><i>What is GL4Java ?</i></b>
<hr><br>
GL4Java is an abbreviation of OpenGL<SUP>TM</SUP> for Java<SUP>TM</SUP>,<br>
read the <a href="#trademarks">trademarks</a> section ;-) <br><br>

GL4Java is an OpenGL binding for Java.<br>
The GL4Java API maps native c++ OpenGL functions
to the Java language and provides fast access
to 3D accelerators from Java.<br><br>

GL4Java maps the complete OpenGL 1.3 and GLU 1.2 API
and implements window handle functions (native and java),
while using the Java-Native-Interface (JNI) of Java or the
JDirect-Interface of MS-JVM. Win32, X-Window, Mac.<BR><BR>

GL4Java has been developed under Open Source Model since 1997
and has become over the years a serious and stable API.<br>
Though, the library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY nor obligation of user support.<br><br>

Have a look at the <a href="http://gl4java.sourceforge.net/docs/overview/index.html">Overview</a> !<br><br>
</p>
<br><br>


<a NAME="who"></a>
<p><b><i>Who makes GL4Java ?</i></b>
<hr>
<br>
GL4Java is mainly developed by Sven Gothel from <A HREF="http://www.jausoft.com" target="_new">Jausoft</A> but many people have
helped/contributed to the development of the project :<br><br>
        <li>Aetius,
        <li>Jean-Yves BRUD,
        <li>Ron Cemer (www.3dstockcharts.com),
        <li>Leo Chan,
        <li>Alban Cousini�,
        <li>DESYS (www.desys.com),
        <li>E3Futura & TeatreSoft,
        <li>Lee Elson (NASA),
        <li>Max Gilead,
        <li>Adam King,
        <li>Atilla Kolac,
        <li>Pontus Lidman (Mathcore),
        <li>Eloi Maduell,
        <li>Moises Ferrer Ramirez
        <li>Tommy Reilly,
        <li>Odell Reynolds (NASA),
        <li>Kenneth B. Russell (SUN Microsystems),
        <li>Ervin Vervaet,
        <li>Leung Yau Wai,
        <li>Gerard Ziemski,
        <li>...
<br><br>
The companies are only listed here, if the support and help is done by them officially.<br>
But if the individuals had to do the whole within ther spare time only,<br>
no company information is provided here !!<br>
<br><br>
Others we missed to list up here, please email the maintainers.
<br><br>
Please check out the <A HREF="thanxs.html">Thanxs Page</a> also !
</p>

<br><br>



<a NAME="how"></a>
<p><b><i>How can I learn using GL4Java ?</i></b>
<hr><br>
Have a look at the <a href="http://gl4java.sourceforge.net/docs/index.html">GL4Java Documents</a> !<br><br>
If you are completely new to OpenGL, you can check out <A HREF="http://nehe.gamedev.net/" target="_new">NeHe's OpenGL Tutorials</A>. It is a good starting point to get a taste of OpenGL.
Several NeHe's tutorials have been ported to GL4Java and can be found <A HREF="http://dev.knowledgeassociates.com/hodglim/nehe/nehe.shtml" target="_new">here</A> (most of them are also included within the demo package)<BR><BR>
Then if you're seriously considering learning OpenGL, we advise you to buy the OpenGL Programming Guide, wich is also commonly refered as the "OpenGL RedBook".<br>
You can find several digital copies of it online, but we don't know if they are authorized by the authors. If you want to check them out, search fo "OpenGL Redbook" in a search engine.<br>
Notice the book has more than 600 pages, so it's REALLY worst buying it if you don't want to burn your eyes on the screen ! :)<br><br>
Then the next and mandatory step (before you ask a basic or stupid question to Sven which will reply by a <a href="#rtfm">RTFM</a> !) is to read the docs and learn the demos provided with GL4Java wich can be found <A HREF="http://www.jausoft.com/Files/Java/1.1.X/GL4Java/archive"> here</A>, 

</P>
<br><br>



<a NAME="pay"></a>
<p><b><i>Do I have to pay in order to use GL4Java ?</i></b>
<hr>
<br>
No. The GL4Java library is free software. You can redistribute it and/or
modify it under the terms of the <A HREF="http://www.gnu.org" target="_new">GNU Library General Public
License</A> as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.<br><br>

Of course, Sven Gothel spends a lot of time developping GL4Java and a generous
donnation to Jausoft would help him continue supporting the development of GL4Java.
</p>
<br><br>


<a NAME="howcanihelp"></a>
<p><b><i>How can I help ?</i></b>
<hr>
<br>

Well, GL4Java is OpenSource'd LGPL licensed and lives from your support !<br>
So, anything you missing within GL4Java may be a good thing to add and maintain.<br>
Just ask the mailinglist <a href="http://sourceforge.net/mail/?group_id=602">Usergroup Mailinglist</a> !<br>

</P>

<br><br>

<a NAME="wherecanigetitfrom"></a>
<p><b><i>Where can I download and install the beast ?</i></b>
<hr>
<br>
Well, you can use the last release:
    <a href="http://www.jausoft.com/gl4java/">GL4Java Homepage</a><br>
Press the download/installation button, which leads you to the specific page !<br>
There you will find all links for automatic and manual installation,<br>
and the directories from which you can download the sources, demo's, docs and binaries:<br>
        <li> <a href="http://www.jausoft.com/Files/Java/1.1.X/GL4Java/archive">latest source, docs, demos</a>
        <li> <a href="http://www.jausoft.com/Files/Java/1.1.X/GL4Java/binpkg">latest binaries</a><br><br>
Take your time, don't hurry ;-) !<br><br>

<a href="#java2setup">Here</a> you can find instructions for the manual installation,<br>
and a checklist for the automatic installation via the installer !</a> 
<br><br>

If you wan't to check out the very latest GL4Java <i>on the edge</i> development release,<br>
please go to <a href="http://gl4java.sourceforge.net">GL4Java @ SOURCEFORGE</a> !<br>

<br><br>

<a NAME="appl"></a>
<p><b><i>What kinda GL4Java applications and applets currently exist ?</i></b>
<hr>
<br>
<li><a href="http://www.jausoft.com/products/gl4java/gl4java_apps.html">Applications</a><br>
<li><a href="http://www.jausoft.com/products/gl4java/gl4java_demos.html">Demos</a><br>

<br>and just search the web for GL4Java ;-)<br>

<br><br>


<a NAME="whichjvm"></a>
<p><b><i>Which Java Virtuell Machine (JVM) should I use ?<i></b>
<hr>
<br>
Since GL4Java Version 2.8.2.0, we do support JVM 1.4's NIO Buffers,<br>
therefore, you should use the high performance JVM 1.4 !<br>

If this version is not avaiable for you,<br>
please use the latest, e.g. 1.3.1, 1.3.0, ...<br><br>

If you like to use Java Applet's within your WWW Browser,<br>
you better your the Java2-Plugin, e.g. a Java2 JRE (Java Runtime Environment) !<br>
This is the best way to achive a high performance Java VM for your Applets <br><br>

Remind that the browsers build-in JVM's are allmost old and maybe unsupported .. ! <br><br>

</p><br><br>


<a NAME="javaslow"></a>
<p><b><i>But isn't Java slow ?</i></b>
<hr>
<br>
No. Check out the <a href="../demos/index.html" target="_new">demos</a> !<br><br>
Java has been arround for more than 6 years now and the speed of execution of the language has
been improved dramaticaly. The latest implementation of Java 2.0 (JDK 1.4) is running especially fast.
Since programing with GL4Java relies mostly on hardware acceleration, the speed of execution of the
Java language doesn't matter much unless you use huge and unoptimized algorithms.<br><br>
It is heard that using Java as an Applet in a browser build-in Java Virtual Machine (JVM) reduces the performance considerably though, because the display often goes thrue the browser's window API rather than directly to your Operating System display API.
This is especially true with Netscape 6.0 wich cuts down the Java performance by a factor of 2 (using the java plugin !) compared to the AppletViewer.<br><br>
There are several papers about optimizing the speed of Java on the Internet :<br><br>
<A HREF="http://developer.java.sun.com/developer/technicalArticles/Programming/PerfTuning/" target="_new">Tuning JavaTM I/O Performance</A> on java.sun.com<br>
<A HREF="http://developer.java.sun.com/developer/technicalArticles/Programming/Performance/" target="_new">Thirteen Great Ways to Increase Java Performance</A> on java.sun.com<br>
<A HREF="http://www.gamasutra.com/features/19990618/dirty_java_01.htm" target="_new">Dirty Java: Optimizing Pure Java</A> on Gamasutra
</p><br><br>


<a NAME="ports"></a>
<p><b><i>What platforms does GL4Java run on ?</i></b>
<hr>
<br>
GL4Java runs on GNU/Linux, Win32, Mac OS 9.x, Mac OS X and any Unix/X11/OpenGL.<br><br>

We do support precompiled native binaries It should run on any Unix/X11/OpenGL machine, but we sometimes don't have precompiled binaries for those.<br>
E.g. we had it run also on Solaris, Irix and AIX. But since nobody does create binaries and maintains<br>
those machines, we cannot provide you with precompiled native libraries.<br>
</p><br><br>


<a NAME="java3d"></a>
<p><b><i>How does GL4Java compare to Java3D ?</i></b>
<hr>
<br>
GL4Java is an OpenGL binding and provides nothing else than access to OpenGL/GLU commands.<br>
GUI managment and toolkits like GLUT, texture managment, etc. are also provided.<br>
For the near future hopefully we can support a higher level scenegraph (SG) API like VRML or 3DS.<br><br>

Java3D is a multipurpose closed source scene graph API relying on DirectX and OpenGL.<br>
Java3D provides parsers for loading objects, functions to manipulate scene objects, such as texturing, morphing and so on...
Because of Java3D's multipurpose nature, it contains many functionalities and thus contains an important amount of code,
wich many parts of it remain unused because they aren't in the field of your purpose.
This makes the API heavy and long to load. But then the display speed performs reasonnably.
On the other hand Java 3D is much easier to use because it is a high level API.
For example if you want to do a morph in Java3D, you create a morph node, load your geometry targets inside it, and set the morph amount between the targets.<br><br>

Using plain OpenGL for a 3D morphing, you have to go thru every vertex of your geometry and compute their x,y,z position yourself.
Using plain OpenGL you have to code your own file parser and display your object, polygon per polygon, all this with your little hands !
This is an important work and it takes time. More, OpenGL is very specific and thus it's quite hard to learn, often requiring a good knowledge of math.
But in the end you have coded only what you needed and your program is very small and fully optimized (this requires you use OpenGL intelligently, though).<br><br>

So if you need to have your project coded very quickly, if performance is not a top priority criteria and if you feel desesparate when doing math,
use an avaiable well functional SCENEGRAPH environment, e.g. Java3D.
If performance is critical (such as for games), if you have plenty of time, and you feel your shoulders are strong enough to face the big and malicious OpenGL monster, use plain OpenGL !<br><br>

CONCLUSION:<br>
If you don't want to do plain OpenGL use a SCENEGRAPH environment! <br>
If there is none yet avaiable for GL4Java,<br>
<b>create some</b>, make it avaiable under the terms of the LGPL !<br>
GL4Java is OpenSource and lives from your support and contributions.<br>
GL4Java provides you with it's source code and adding functionality is welcome.<br>
Look at the <a href="http://gl4java.sourceforge.net/docs/overview/benefits.html">benefits</a> !<br><br>


</p><br><br>

<a NAME="extensions"></a>
<p><b><i>Does GL4Java support extensions ? How do I load them ?</i></b>
<hr>
<br>

Yes, GL4Java supports numerous extensions. In order to list wich extensions are supported, just do a <br>
>java gl4java.GLContext -info<br>
OR press the gl4java button on a demo, e.g. 
<a href="../demos/MiscDemos/gears.html" target="_new">gears</a>.<br><br>

The extensions and the regular OpenGL 1.3 functions are dynamically loaded, so you don't have to worry about loading them. 
They are here, and you just have to use them !<br><br>

You can query, if the function exists, while calling e.g.:<br>
boolean t = GLContext.gljTextGLProc("VertexArrayRangeNV", true /* verbose */);<br>
that's it !<br>
Then you can savely call VertexArrayRangeNV(), this works for all supported OpenGL methods !<br>
If you call the GL4Java wrapper method for an unimplemented OpenGL function, nothing will happen - it is safe !<br><br>
Check out the <a href="../demos/NVidia/VertexArrayRange.java" target="_new">NVidia Demo</a> !<br><br>
</p><br><br>

<a NAME="tesselation"></a>
<p><b><i>Does GL4Java support tesselation ? How do I use it ?</i></b>
<hr>
<br>

Since GL4Java 2.2.0, tesselation is supported !<br><br>

Please look in the sources and/or javadoc<br>
of: <br>
<pre>
	gl4java.GLUTFunc
</pre>
<br>

There exist also many demos:
<br><br>
	<li><a href="../demos/MiscDemos/tess.html" target="_new">demos/MiscDemos/tess</a>
	  /  	<a href="../demos/MiscDemos/tess.java" target="_new">(source)</a>
	<li><a href="../demos/MiscDemos/tessdemo.html" target="_new">demos/MiscDemos/tessdemo</a>
	 /  	<a href="../demos/MiscDemos/tessdemo.java" target="_new">(source)</a>
	<li><a href="../demos/MiscDemos/tesswind.html" target="_new">demos/MiscDemos/tesswind</a>
	 /  	<a href="../demos/MiscDemos/tesswind.java" target="_new">(source)</a>
<br><br>

DETAILS<br><br>

The native callback manager of GL4Java seeks the<br> 
callback function with:
<br><br>
	<li>callback method-type (the "which" argument of the Callback function)
	<li>the current gl-context
<br><br>

Because the callback manager functions do not know the<br> 
tessellator/nurbs/quadratics id,<br>
only ONE callback-method for one gl-context and "which"-method<br>
is supported !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br>

<pre>

Jean-Yves BRUD asked:

> What is the meaning of parameter signature ?
> If my callback method name is myVertexCallBack (for a GLU_TESS_VERTEX
> callback),
> what is the value of the signature parameter ?

public void  gluTessCallback(     long tobj, int which,
			          Object methodClassInstance, 
			          String methodName, 
				  String signature,
				  int voidArrayLen1,
				  int voidArrayLen2,
				  int voidArrayLen3,
				  int voidArrayLen4,
				  int voidArrayLen5
				  );


Example (tessdemo.java line 337):
	glu.gluTessCallback ( tobj, GLU_TESS_VERTEX, gl,
			      "glVertex2fv", "([F)V",
			      2, 0, 0, 0, 0);

The signature "([F)V" is the original java style signature of the
argument-list, your callback method takes (here: glVertex2fv) !

	void glVertex2fv( const GLfloat v[2] ) 

	(...) := within the brackets are function arguments signature part
	[F    := float array
	V     := void - 
                 the signature part after the brackets 
		 means the return value

Read SUN's Java Documentation for Java-Callback methods:
         http://java.sun.com/docs/books/tutorial/native1.1/implementing/method.html

Here you can find the mapping of function arguments to its corresponding
string signature representation !

Jean-Yves BRUD asked:

>
> What is the meaning of the 5 parameters: voidArrayLen1, voidArrayLen2,
> voidArrayLen3,
> voidArrayLen4, voidArrayLen5, and what value do I need to put ?
>

public void  gluTessCallback(     long tobj, int which,
			          Object methodClassInstance, 
			          String methodName, 
				  String signature,
				  int voidArrayLen1,
				  int voidArrayLen2,
				  int voidArrayLen3,
				  int voidArrayLen4,
				  int voidArrayLen5
				  );

The maximum number of arrays within the argumentlist of 
a GLU Callback function for Tesselation is 5 !

So, the arguments voidArrayLen[1-5] refines the expected
size of the arrays, 
which are passed into and from the java callback funtion.

	OpenGL-Machine <-> GL4Java-Callback-Handler <-> Java-Callback-Method

E.g. (tessdemo.java):
         glu.gluTessCallback ( tobj, GLU_TESS_COMBINE, this,
                                "combine_callback", "([D[D[F[F)V",
                                2, 0, 0, 2, 0);

        public void combine_callback( double coords[/*3*/],
                               double vertex_data[/*4xn(=0)*/],
                               float weight[/*4*/], float[/*m(=2)*/] data )
        {
           data[0] = (float) coords[0];
           data[1] = (float) coords[1];
        }

You can see, we do use the arrays "data" and "coords" with a size of 2 !
You are not allowed to use nonsense sizes, because this can hurt your
application with a segementation fault !
(Well the GL4Java Callback functions checks
 the array sizes to OpenGL's maximum, .. but be kind of ..)

The OpenGL machine calls GL4Java's callback function,
which dispatches the call (incl. data) to your java callback function !

</pre>

</p><br><br>

<a NAME="offscreen"></a>
<p><b><i>How Do I Use Offscreen Rendering with GL4Java ?  </i></b>
<hr>
<br>
You can just use it, the way GLJPanel use it for swing integration !<br><br>
Since 2.8, I have added a gl4java.awt.GLOffScreenDrawable !<br><br>
Here is a little offscreen PNG gl-image renderer, using gl4java.awt.GLOffScreenDrawable:
<br><br>
<li><a href="../demos/MiscDemos/gearsOffScreen2Tga.java" target="_new">demos/MiscDemos/gearsOffScreen2Tga.java (source)</a>
<li><a href="../demos/MiscDemos/gearsOffScreenDrawImage.html" target="_new">demos/MiscDemos/gearsOffScreenDrawImage.html</a>
    /  <a href="../demos/MiscDemos/gearsOffScreenDrawImage.java" target="_new">(source)</a>
<br><br>

</p><br><br>

<a NAME="fullscreen"></a>
<p><b><i>How Do I Use Fullscreen with GL4Java ?  </i></b>
<hr>
<br>
Well, for the pre JDK 1.4 aera, i only can recommend the stupid way<br>
of increasing the window size to screen size like in the<br> 
<a href="../demos/RonsDemos/FullScreenGears.java" target="_new">demos/RonsDemos/FullScreenGears.java</a>
demo !<br><br>

For the JDK 1.4 machines, we just can use the standard JDK 1.4<br>
fullscreen mode like this:<br><br>
<li><a href="../demos/MiscDemos/gearsFullScreen.java" target="_new">demos/MiscDemos/gearsFullScreen.java (source)</a>
<br><br>

</p><br><br>

<a NAME="bumpmapping"></a>
<p><b><i>How Do I Use Bump Mapping with GL4Java ? </i></b>
<hr>
<br>
I do not know ? ;-) <br><br>
Somebody should fill this .. please !<br><br>

</p><br><br>

<a NAME="java2installer"></a>
<p><b><i>How to use the Installer ?</i></b>
<hr>
<br>
For any installation, you should be able to access the web via http,<br>
therefore you have to setup your firewall/proxy well ;-)<br><br>

The Automatic Web Installation, may determine your browser via javascript,<br>
but to be sure, you better use the force ;-)<br>
Just click, e.g. for a default Java2 Browser, the related force-link !<br><br>

Be sure to setup your Java2 policy file, for a Java2 installation.<br>
A default Java2 policy file addition is provided on the installation page.<br>

The Installer can also be downloaded and can be run as a standalone application !<br>
The Installer then fetches all needed archives from the web, if not allready downloaded,<br>
and installes them properly !<br><br>

</p><br><br>

<a NAME="java2setup"></a>
<p><b><i>GL4Java Installation Check-List (for Java2) !</i></b>
<hr>
<br>
First of all, we do use the follwing names here:<br><br>
<pre>
	JAVA_HOME
</pre><br>
JAVA_HOME refers to the directory where the runtime software is installed (which is the top-level directory of the JRE or the jre directory in the Java 2 SDK).
<br>
Here are some examples of you JAVA_HOME locations:<br><br>
<pre>
WIN32 JDK:	C:\jdk1.3.1\jre
WIN32 JRE:	C:\Program Files\JavaSoft\JRE\1.3.1
UNIX  JDK:	/usr/lib/jdk1.3.1/jre
</pre>
<br><br>
<pre>
	DIRECTORY SEPERATOR /
</pre><br>
<em>/</em> is our directory seperator. so if you are unlucky and using win32 ;-),
you have to use the backslash <em>\</em>, otherwise on any unix flavor,
you are fine with the straight slash.
<br><br>

<br>
For the Window's world, I have learned on my win98se machine,<br>
that you better use the JRE as your default Java2 JRE,<br>
for the Java2 plugin within your browsers.<br>
<br>
Don't ask me why, but i never ever got the gl4java applets to run<br>
if using the JDK directory in the Java2 Plugin setup.<br>
<br>
Well, the good thing is, using the JRE Path, is the default ;-)<br>

<br><br>

<br>
First check that you have all the .jar files in the correct locations :<br>
<br>
<pre>
JAVA_HOME/lib/ext/gl4java.jar
JAVA_HOME/lib/ext/gl4java-glutfonts.jar
JAVA_HOME/lib/ext/gl4java-glffonts.jar
JAVA_HOME/lib/ext/png.jar
</pre>
<br>
<br>
Then make sure you have installed the gl4java native dynamic libraries in the right directories :<br>
<br>
the following 5 native dynamic libraries are required:<br><br>
<pre>
	WINDOWS:
	========
	JAVA_HOME/bin/GL4JavaGljMSJDirect.dll
	JAVA_HOME/bin/GL4JavaJauGljJNI.dll
	JAVA_HOME/bin/GL4JavaJauGljJNI12.dll
	JAVA_HOME/bin/GL4JavaJauGljJNI13.dll
	JAVA_HOME/bin/GL4JavaJauGljJNI14.dll

	UNIX X86:
	========
	JAVA_HOME/lib/i386/GL4JavaGljMSJDirect.so
	JAVA_HOME/lib/i386/GL4JavaJauGljJNI.so
	JAVA_HOME/lib/i386/GL4JavaJauGljJNI12.so
	JAVA_HOME/lib/i386/GL4JavaJauGljJNI13.so
	JAVA_HOME/lib/i386/GL4JavaJauGljJNI14.so

	UNIX PPC:
	========
	JAVA_HOME/lib/ppc/GL4JavaGljMSJDirect.so
	JAVA_HOME/lib/ppc/GL4JavaJauGljJNI.so
	JAVA_HOME/lib/ppc/GL4JavaJauGljJNI12.so
	JAVA_HOME/lib/ppc/GL4JavaJauGljJNI13.so
	JAVA_HOME/lib/ppc/GL4JavaJauGljJNI14.so
</pre>
<br>
Some JDK ore JRE's have different locations,
e.g. IBM's JDK for Linux, they do use e.g.:
<pre>
	JAVA_HOME/bin
</pre>
for the dynamic libraries !
<br><br>
You just can search for the libraries, which directory is our destination:
<pre>libjava.so (unix)</pre>
<pre>java.dll (win32)</pre><br>
<br>

Then you may want to install the native libraries<br>
to you system's default library path also.<br>
Here are several possible default locations.<br><br>
<pre>
	WINDOWS VARIANTS:
	=================
	C:/WIN98/SYSTEM 
	C:/WIN95/SYSTEM 
	C:/WINNT/SYSTEM32 

	UNIX FLAVORS
	============
	/usr/lib
</pre>
<br>
Be sure, that if you do have installed GL4Java in any of the described directories,<br>
install the same version on all such locations.<br>
<br><br>
Because of Java2 PrivilegedAction's restriction,<br>
you should have installed the libraries under the above JAVA_HOME directory,<br>
to being able to use GL4Java for Java Applet's!<br>
<br>
Finally check out the java.policy files located in :<br><br>
<pre>
	JAVA_HOME/lib/security/java.policy
</pre><br>
You should have (by default) :<br><br>
<pre>
grant codeBase "file:${java.home}/lib/ext/*" {
	permission java.security.AllPermission;
};
</pre><br>
<br>
The following issue might be obsolete regarding the GL4Java 2.8 release !<br>
Some have problems using standalone GL4Java applications,<br>
because they wouldn't fint jawt.dll and wouldn't load gl4java dependent dlls.<br>
In this case you have 2 choices:<br>
<li> Make sure you have your PATH variable set correctly (don't forget to replace "\jdk1.x\" by your own jdk directory):
<code> PATH = your_path_variables;c:\jdk1.x\jre\bin;C:\jdk1.x\bin</code><br>
<li> just start the java application from <code>c:\jdk1.x\jre\bin\java</code><br>
<br>

You should be up and running now ! That is what I call a seamless installation ! ;)<br><br>
</p><br><br>


<a NAME="java2installprobs"></a>
<p><b><i>Please Help - It won't run !</i></b>
<hr>
<br>
<i>Q: I just get a java.lang.RuntimePermission exception !</i><br><br>
Just be sure, you have installed GL4Java properly within the<br> 
<pre>
JAVA_HOME/lib/ext/gl4java.jar
</pre>
directory, see the <a href="#java2setup">setup notes</a><br>
Otherwise, you have to add the gl4java.jar archive to your java2 security policy file !<br><br>

<i>Q: I just get the error: java.lang.UnsatisfiedLinkError: loadJAWT0</i><br><br>
Your gl4java.jar archive does not match the native libraries ..<br>
you have installed !<br>
loadJAWT0 is a new native lib funtion intro. in 2.8.2 ..<br><br>
Just remove all gl4java*.jar and all GL4Java*.dll (or GL4Java*.so* for Unices) files !<br>
Then re-install the latest version - thats it ;-)<br>


</p><br><br>


<a NAME="rtfm"></a>
<p><b><i>What should I read before you reply with RTFM ? Whom should I ask ?<br>
(RTFM = Unix abbreviation for `Read The Fucking Manual')</i></b>
<hr>
<br>
Read the <a href="http://gl4java.sourceforge.net/docs/overview/index.html">Overview</a> !<br>
and there you will find the JavaDoc GL4Java API and other stuff.<br><br>

Download or browse the latest source, docs and demos via CVS <a href="http://sourceforge.net/projects/gl4java">GL4Java @ SOURCEFORGE</a><br>
and read the README files, the docs and the demos !<br><br>

You can also browser them from here: <a href="http://www.jausoft.com/Files/Java/1.1.X/GL4Java">latest release</a>,<br>
download them from here: <a href="http://www.jausoft.com/Files/Java/1.1.X/GL4Java/archive">latest source, docs, demos</a>,<br>
but this source might be outdated, since this is not the development release !<br><br>

Just ask the mailinglist <a href="http://sourceforge.net/mail/?group_id=602">Usergroup Mailinglist</a>! <br>

<br><br>


<a NAME="how2complain"></a>
<p><b><i>How-To Complain About Non Working GL4Java ?</i></b>
<hr>
<br>
Please Read The Following Issues First:<br><br>

<LI><a href="#rtfm">What should I read before you reply with RTFM ? Whom should I ask ?</a></LI>
<LI><a href="#java2installer">How to use the Installer ?</a></LI>
<LI><a href="#java2setup">GL4Java Installation Check-List (for Java2) !</a></LI>
<LI><a href="#java2installprobs">Please Help - It won't run !</a></LI>

<br>

Please retest with:<br>
       <LI>The latest Java Virtual Machine (JVM)</LI>
       <LI>The latest GL4Java Version</LI>

<br>

If this won't help, please send the follwing information to the mailinglist:<br><br>
       <LI>Operating System</LI>
       <LI>Java VM Vendor and Version (in detail)</LI>
       <LI>GL4Java Version (in detail)</LI>
       <LI>OpenGL (gfx-card and driver) Vendor and Version (in detail)</LI>

<br>

IF possible, the following output within a seperated compressed (e.g. zip, or gzip) textfile:<br>
<pre>
	java gl4java.GLContext -infotxt
</pre>

<br>

If you feel, that the above GL4Java self-test info is correct,<br>
please add the output of the demo/MiscDemos/gears.java demo,<br>
within a compressed file also (zip or bzip2).<br><br>

Be polite ;-)<br><br>

Be patient ;-)<br><br>

<br><br>

<a NAME="memoryleak1"></a>
<p><b><i>Does GL4Java has a memory leak (Part 1) ?</i></b>
<hr>
<br>
Because many complained about a possible memory leak within GL4Java,<br>
I have double checked GL4Java's native ressource managment<br>
(with it's verbose printouts ..), and everything seems ok ! <br>
;-)<br><br>

(MY) Win98se machine looks like the only platform with this bug.<br><br>

So, because Win98xx is a kinda dead thing ;-),<br>
and i really do not use it regulary (just to offer you thie win32 binaries),<br>
we may can forget this issue .. ?!?!<br><br>

Tip for Win98 users:<br>
        DONT use Win98, WinME or WinXP ;-)<br>
        Use WinNT, Win2k - or better: switch to a rock solid machine !<br><br>

Well it is not recommended to use a WinXP machine,<br>
since you do not have a special http, smb, or whatever<br>
content checking firewall, which is able to disallow M$<br>
to spy you personality and you machine itself !<br><br>

don't hesitate, go for it, use at least GNU/Linux ;-)<br><br>

... but this might be offthread ..<br><br>

<PRE>

TEST RESULTS 1.) win98se, 2) winnt, 3.) linux-ppc, 4.) linux-x86
------------------------------------------------------------------

( All test ran with an NVidia gfx card and its proprietary driver,
  except the linux-ppc one (ATI (DRI driver)) !
)

win98se + jdk 1.3.1 + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
summary: after each run 2MB of memory are "lost" !

---------------

win98se + jdk 1.3.1_01 + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (MB)
        0               167.5 !!!!!!!!!
        1               173.3 !!!!!!!!!
        2               175.4 !!!!!!!!!
        3               177.3 !!!!!!!!!
        4               179.1 !!!!!!!!!

----------------

winnt 4.0 + 500MByte + jdk 1.3.1 + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (kb)
        0               75404
        1               76028
        2               76028
        3               76028
        4               76028

----------------

winnt 4.0 + 500MByte + jdk 1.3.1_01+ gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (kb)
        0               68980
        1               69788
        2               69784
        3               69784
        4               69776

----------------

winnt 4.0 + 500MByte + jdk 1.4.0b3 + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (kb)
        0               70612
        1               71660
        2               71656
        3               71656
        4               71656

test: "java gl4java.GLContext VertexArrayRange" (demos/NVidia)
        test loop       memory used (kb)
        0               70592
        1               70784
        2               70784
        3               70700
        4               70632

------------

linux 2.4.12 ppc + 256 MB + jdk 1.3.0 (blackdown fcs) + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (MB)
        0               199
        1               199
        2               199
        3               198
        4               198

------------

linux 2.4.11 x86 + 650 MB + jdk 1.3.1 (blackdown fcs) + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (MB)
        0               616
        1               608
        2               608
        3               607
        4               607

------------

linux 2.4.11 x86 + 650 MB + jdk 1.4.0b3 (sun) + gl4java 2.8.1.0
test: "java gl4java.GLContext -infotxt"
        test loop       memory used (MB)
        0               616
        1               604
        2               603
        3               604
        4               604

test: "java gl4java.GLContext VertexArrayRange" (demos/NVidia)
        test loop       memory used (MB)
        0               612
        1               593
        2               592
        3               593
        4               593

</PRE>
</p>
<br><br><br>

<a NAME="memoryleak2"></a>
<p><b><i>Does GL4Java has a memory leak (Part 2) ?</i></b>
<hr>
<br>

<PRE>
I would like to report a bug in using GL4Java 2.8.2.0, it leaks memory 
very fast (4k/sec) on PC. I noticed that because I run the exact same 
java program on Mac OS X without any leaks. You can also try the Swing 
demo called winOlympicCvs applet, everytime you click on the window you 
will lose 4k on your Task Manager. Any ideas what may go wrong? Thanks!

-Aaron
</PRE>

<br>

I have tested this issue, but could not reproduce his results,<br>
the memory leak !<br><br>

So I guess, it is all about the buggy OS or/and the drivers ... ! <br><br>
Here are my results:<br>
<br>

<PRE>
My System:

WinNT 4.0,  4.00.1381
Quadro2 MXR/EX NVidia OpenGL 4.00.1381.2311
523 636 kByte Ram
Java 1.3.1_01
Memory meassured with the TASKMANAGER !

Test1: "java gl4java.GLContext -infotxt"
4 Runs
1.) 165552
2.) 165556
3.) 165556
4.) 165556

Test2: "appletviewer glOlympicCvsApplet.html"
2 Clicks After Animations Stops, and 3 just before
1.)165564
2.)195368
3.)195376
4.)195372
5.)195372

Well, looks like no memory leak at all .. hmm..
</PRE>
<br><br><br>


<a NAME="weight"></a>
<p><b><i>GLAnimCanvas vs GLJPanel, which should I choose ?</i></b>
<hr>
<br>
The GLJPanel implementation currently renders to an off-screen buffer and copies the pixels to the lightweight
component. This leads to slowdowns over GLAnimCanvas because the rendering is not hardware-accelerated and because of the copying
overhead.<br><br>
It is possible that the implementation could be changed to walk the lightweight component hierarchy to find the bounds of
the GLJPanel within its parent heavyweight component and clip the OpenGL rendering region to fit (if the GLJPanel itself isn't
overlapped by another lightweight component), which should speed it up significantly, though this kind of code is tricky to write.
<br><br>
But you can use heavyweight components within a swing layout also : these are hardware accelerated but they keep their heavyweight restrictions (no overlapping...)<br>
have a look at GL4Java/demos/testTextPPM1.java, where swing/awt is mixed ..

<br><br><br>


<a NAME="model"></a>
<p><b><i>GLJPanel/GLAnimCanvas subclass model vs GLEventListener model, which should I choose ?</i></b>
<hr>
<br>
The subclass model is the old mechanism which was used with GL4Java untill now.<br> 
It consists in designing a class inherited from GLAnimCanvas or GLJPanel and overload its init() and display() methods to put your custom code.<br><br>
It's recommended to use the new GLEventListener model, even if you're a beginner.<br><br>
The listener model allows you to switch easyly between different GLEventListener's init()/display()/etc.. methods without having to destroy your canvas and create a new one.<br><br>
With the new model, you have to implement an GLEventListener, which is your 
selfmade application specific renderer.<br>
Then you just can attach your GLEventListener (
<a href="../demos/MiscDemos/gearRenderer.java" target="_new">gearRenderer (source)</a>
) to any GLDrawable, e.g.:<br><br>
<li><a href="../demos/MiscDemos/gearsOffScr2Tga.java" target="_new">gearRenderer attached at an offscreen GLDrawable (source)</a>
<li><a href="../demos/MiscDemos/gears.java" target="_new">gearRenderer attached at an direct GLDrawable (source)</a>
<br><br>

The GLEventListener is the newly implemented listener mechanism which avoids subclassing.<br> 
It offers higher performance, especially for GLAnimCanvas, because in certain circumstances OpenGL context<br>
switches can be avoided. (The details of this are hidden from the programmer.)<br><br>

To use this new mechanism as shown in the 
<a href="../demos/MiscDemos/gears.java" target="_new">gears demo (source)</a>:<br>
<pre>
  - Create a gl4java.GLCapabilities object indicating the use of
    RGBA mode, etc.
  - Pass this capabilities object to gl4java.drawable.GLDrawableFactory.getFactory().
  - Call addGLEventListener on the resulting GLDrawable to set up your listener, which should implement at least init() and display().
</pre>
<br><br>

For highest performance animations:<br>
<pre>
  - Call GLDrawableFactory.createGLAnimCanvas()
  - Call setUseRepaint(false), setUseFpsSleep(false), and setUseYield(false) on the resulting GLAnimCanvas
</pre>
<br><br>

In one of the NVidia demos ported to Java, adding the optimized context handling increased the speed
of the demo by 20%. Performance gain is not obvious in every case though, it depends on where the bottleneck
is in your application.<br><br>

Another simple exemple of using the listener model can be found in the demos :<br>
<li><a href="../demos/MiscDemos/TriangleRotate.java" target="_new">demos/MiscDemos/TriangleRotate.java (source)</a>
<br><br>


<a NAME="trademarks"></a>
<b><i><a href="http://www.jausoft.com/gl4java/">
OpenGL<SUP><FONT SIZE="1">TM</FONT></SUP>for Java<SUP><FONT SIZE="1">TM</FONT></SUP></a> / Trademarks</i></b>
<hr>
<ul>
<li>Linux is a trademark of Linus Torvald</li>
<li>OpenGL is a registered trademark of SGI.</li>
<li>Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems,Inc.
in the United States and other countries.</li>
<li>Solaris is trademark of Sun Microsystems,Inc.</li>
<li>Windows and Windows NT are registered trademarks of Microsoft Corporation.</li>
<li>IRIX is a registerd trademark of SGI in the United States and other countries.</li>
<li>Mac is a registered trademark of Apple Computer, Inc.</li>
<li>Netscape is a trademark of Netscape Communications Corp.</li>
<li>The names of products and corporations are trademarks or registered trademarks of respective corporation.</li>
</ul>

GL4Java was the former project name of
OpenGL<SUP><FONT SIZE="-2">TM</FONT></SUP>
for Java<SUP><FONT SIZE="-2">TM</FONT></SUP><br><br>
GL4Java has no relationship with the Java trademark registered
by Sun Microsystems, Inc.<br><br>


<hr WIDTH="100%">
<font size=-1>This FAQ is maintained by <A HREF="mailto:acousinie@wanadoo.fr">Alban Cousini�</A> and <A HREF="mailto:sgoethel@jausoft.com">Sven Goethel</A>.<br>
Last Updated on 4th February 2002</font>
</body>
</html>