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
|
package gl4java.utils.textures;
import gl4java.*;
import java.awt.*;
import java.awt.Color.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;
import java.net.*;
/**
* This Class implements basic functions,
* which are used by all TextureLoader implementations !
*
* @see gl4java.utils.textures.TextureTool
* @see gl4java.awt.GLImageCanvas
*/
public abstract class TextureTool
implements GLEnum, GLUEnum
{
protected GLFunc gl;
protected GLUFunc glu;
/**
* just a default type ...
*/
protected byte[] pixel;
protected boolean pixelScaled;
protected int imageWidth;
protected int imageHeight;
protected int textWidth;
protected int textHeight;
protected int glFormat;
protected boolean error;
public String toString()
{
return "Texture "+textWidth+"x"+textHeight+
"[image "+imageWidth+"x"+imageHeight+
"[bpc "+getComponents()+"]"+
"]";
}
protected TextureTool(GLFunc gl, GLUFunc glu)
{
this.gl=gl;
this.glu=glu;
error=false;
pixelScaled = false;
}
public final boolean isOk() { return !error; }
public final int getGLFormat() { return glFormat; }
public int getGLBytesPerComponent() { return 1; }
public int getGLComponentFormat() { return GL_UNSIGNED_BYTE; }
/**
* just a default for byte sized component's
*/
public int getComponents()
{
switch (glFormat)
{
case GL_RGBA:
return 4;
case GL_RGB:
return 3;
case GL_LUMINANCE_ALPHA:
return 2;
case GL_LUMINANCE:
case GL_ALPHA:
case GL_COLOR_INDEX:
return 1;
default:
return 0;
}
}
/**
* Dimension
*/
public final int getImageWidth() { return imageWidth; }
public final int getImageHeight() { return imageHeight; }
public final int getTextureWidth() { return textWidth; }
public final int getTextureHeight() { return textHeight; }
public static final int getMaxTextureSize(GLFunc gl)
{
int[] maxSize=new int[1];
gl.glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxSize);
return maxSize[0];
}
/**
* This method is called directly after loading
* the texture !
* You normally do not need to call this method !
*
* The textWidth/textHeight data is set correctly
* to a power of 2 !
*/
public void setTextureSize()
{
int e_x, e_y, i;
/* achieve the 2**e_x>=imageWidth, 2**e_y>=imageHeight */
e_x=0; textWidth=1;
while (textWidth<imageWidth)
{ textWidth*=2; e_x++; }
e_y=0; textHeight=1;
while (textHeight<imageHeight)
{ textHeight*=2; e_y++; }
int[] format = new int[1];
do {
gl.glTexImage2D(GL_PROXY_TEXTURE_2D, 0,
getComponents(),
textWidth, textHeight,
0,
glFormat,
GL_UNSIGNED_BYTE,
(byte[])null);
glutReportErrors();
gl.glGetTexLevelParameteriv
(GL_PROXY_TEXTURE_2D, 0,
GL_TEXTURE_INTERNAL_FORMAT, format);
glutReportErrors();
//
// if(format[0]!=glFormat)
//
if(format[0]==0)
{
System.out.println("text size too big: "+this.toString()+", "+format[0]+"!="+glFormat);
if(textWidth>textHeight)
{
e_x--; textWidth=1;
for(i=e_x; i>0; i--)
textWidth*=2;
} else {
e_y--; textHeight=1;
for(i=e_y; i>0; i--)
textHeight*=2;
}
}
} while (format[0]==0 && /* format[0]!=glFormat && */
textWidth>1 && textHeight>1);
if(format[0]==0)
{
System.out.println("GL-ERROR: text size cannot be negotiated !\n");
error=true;
}
}
/**
* The image data, with the given
* Dimension and Format !
*/
public final byte[] getTexture() { return pixel; }
/**
* This method can be called,
* if you want to have a normal image-data size
* with the power of two !
*
* The Ascpect-Ratio is dropped !
*
* You can call this method directly after loading a
* texture !
*
* The pixel store mode GL_UNPACK_ALIGNMENT & GL_PACK_ALIGNMENT,
* is set temporary to byte alignment, then back to default (4) !
*
* The pixel store mode GL_UNPACK_ROW_LENGTH & GL_PACK_ROW_LENGTH,
* is set temporary to imageWidth, then back to default (0) !
*
* @see GLUFunc#gluScaleImage
* @see GLFunc#glPixelStorei
*/
public boolean scaleTexture2Pow2()
{
if(pixelScaled)
return true;
int swapbytes[]={0}, lsbfirst[]={0}, rowlength[]={0};
int skiprows[]={0}, skippixels[]={0}, alignment[]={0};
int unswapbytes[]={0}, unlsbfirst[]={0}, unrowlength[]={0};
int unskiprows[]={0}, unskippixels[]={0}, unalignment[]={0};
setTextureSize();
if (textWidth != imageWidth ||
textHeight != imageHeight)
{
int colorBytes;
// speicher fuer scaliertes bild anlegen
byte[] buffer=new byte[textWidth * textHeight *
getComponents()];
/* Save current modes. */
gl.glGetIntegerv(GL_PACK_SWAP_BYTES, swapbytes);
gl.glGetIntegerv(GL_PACK_LSB_FIRST, lsbfirst);
gl.glGetIntegerv(GL_PACK_ROW_LENGTH, rowlength);
gl.glGetIntegerv(GL_PACK_SKIP_ROWS, skiprows);
gl.glGetIntegerv(GL_PACK_SKIP_PIXELS, skippixels);
gl.glGetIntegerv(GL_PACK_ALIGNMENT, alignment);
gl.glGetIntegerv(GL_UNPACK_SWAP_BYTES, unswapbytes);
gl.glGetIntegerv(GL_UNPACK_LSB_FIRST, unlsbfirst);
gl.glGetIntegerv(GL_UNPACK_ROW_LENGTH, unrowlength);
gl.glGetIntegerv(GL_UNPACK_SKIP_ROWS, unskiprows);
gl.glGetIntegerv(GL_UNPACK_SKIP_PIXELS, unskippixels);
gl.glGetIntegerv(GL_UNPACK_ALIGNMENT, unalignment);
gl.glPixelStorei(GL_PACK_SWAP_BYTES, 0);
gl.glPixelStorei(GL_PACK_LSB_FIRST, 1);
gl.glPixelStorei(GL_PACK_ROW_LENGTH, 0);
gl.glPixelStorei(GL_PACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
gl.glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
gl.glPixelStorei(GL_UNPACK_LSB_FIRST, 1);
gl.glPixelStorei(GL_UNPACK_ROW_LENGTH, imageWidth);
gl.glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if( glu.gluScaleImage(glFormat,
imageWidth, imageHeight,
GL_UNSIGNED_BYTE,
pixel,
textWidth, textHeight,
GL_UNSIGNED_BYTE,
buffer)!=0 )
{
// glu failure
error=true;
System.out.println("GL-ERROR: cannot gluScaleImage !\n");
} else {
pixel = buffer;
}
gl.glPixelStorei(GL_PACK_SWAP_BYTES, swapbytes[0]);
gl.glPixelStorei(GL_PACK_LSB_FIRST, lsbfirst[0]);
gl.glPixelStorei(GL_PACK_ROW_LENGTH, rowlength[0]);
gl.glPixelStorei(GL_PACK_SKIP_ROWS, skiprows[0]);
gl.glPixelStorei(GL_PACK_SKIP_PIXELS, skippixels[0]);
gl.glPixelStorei(GL_PACK_ALIGNMENT, alignment[0]);
gl.glPixelStorei(GL_UNPACK_SWAP_BYTES, unswapbytes[0]);
gl.glPixelStorei(GL_UNPACK_LSB_FIRST, unlsbfirst[0]);
gl.glPixelStorei(GL_UNPACK_ROW_LENGTH, unrowlength[0]);
gl.glPixelStorei(GL_UNPACK_SKIP_ROWS, unskiprows[0]);
gl.glPixelStorei(GL_UNPACK_SKIP_PIXELS, unskippixels[0]);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, unalignment[0]);
}
if(!error)
pixelScaled = true;
return pixelScaled;
}
/**
* This method can be called,
* if you want to have an optimal image-data size
* which fits best into the texture-MEMORY !
*
* The Ascpect-Ratio is not changed
* - seen from the texture-MEMORY-ratio
* to the netto-image-MEMORY-ratio !
*
* If you want to render this result with the correct
* apsect-ration,
* you MUST set the vertices in relation to
* the textureWidth and textureHeight !
* Look in the demo: "demos/MiscDemos/GLImageWorld1" !
*
* You can call this method directly after loading a
* texture !
*
* The pixel store mode GL_UNPACK_ALIGNMENT & GL_PACK_ALIGNMENT,
* is set temporary to byte alignment, then back to default (4) !
*
* The pixel store mode GL_UNPACK_ROW_LENGTH & GL_PACK_ROW_LENGTH,
* is set temporary to imageWidth, then back to default (0) !
*
* @see GLUFunc#gluScaleImage
* @see GLFunc#glPixelStorei
*/
public boolean scaleTexture4BestSize()
{
if(pixelScaled)
return true;
setTextureSize();
if (textWidth != imageWidth ||
textHeight != imageHeight)
{
int swapbytes[]={0}, lsbfirst[]={0}, rowlength[]={0};
int skiprows[]={0}, skippixels[]={0}, alignment[]={0};
int unswapbytes[]={0}, unlsbfirst[]={0}, unrowlength[]={0};
int unskiprows[]={0}, unskippixels[]={0}, unalignment[]={0};
int colorBytes;
// speicher fuer scaliertes bild anlegen
byte[] buffer=new byte[textWidth * textHeight *
getComponents()];
int w=textWidth;
int h=textHeight;
double iaspect = (double)imageWidth/
(double)imageHeight;
if(textWidth<textHeight)
h = (int) ((textWidth / iaspect)+0.5);
else
w = (int) ((textHeight * iaspect)+0.5);
/*
System.out.println("scale4Best: size "+
imageWidth+"/"+imageHeight+" -> "+w+"/"+h);
System.out.println("scale4Best: aspect (w/h) "+
iaspect+" -> "+(double)w/(double)h);
*/
/* Save current modes. */
gl.glGetIntegerv(GL_PACK_SWAP_BYTES, swapbytes);
gl.glGetIntegerv(GL_PACK_LSB_FIRST, lsbfirst);
gl.glGetIntegerv(GL_PACK_ROW_LENGTH, rowlength);
gl.glGetIntegerv(GL_PACK_SKIP_ROWS, skiprows);
gl.glGetIntegerv(GL_PACK_SKIP_PIXELS, skippixels);
gl.glGetIntegerv(GL_PACK_ALIGNMENT, alignment);
gl.glGetIntegerv(GL_UNPACK_SWAP_BYTES, unswapbytes);
gl.glGetIntegerv(GL_UNPACK_LSB_FIRST, unlsbfirst);
gl.glGetIntegerv(GL_UNPACK_ROW_LENGTH, unrowlength);
gl.glGetIntegerv(GL_UNPACK_SKIP_ROWS, unskiprows);
gl.glGetIntegerv(GL_UNPACK_SKIP_PIXELS, unskippixels);
gl.glGetIntegerv(GL_UNPACK_ALIGNMENT, unalignment);
gl.glPixelStorei(GL_PACK_SWAP_BYTES, 0);
gl.glPixelStorei(GL_PACK_LSB_FIRST, 1);
gl.glPixelStorei(GL_PACK_ROW_LENGTH, textWidth);
gl.glPixelStorei(GL_PACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
gl.glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
gl.glPixelStorei(GL_UNPACK_LSB_FIRST, 1);
gl.glPixelStorei(GL_UNPACK_ROW_LENGTH, imageWidth);
gl.glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if( glu.gluScaleImage(glFormat,
imageWidth, imageHeight,
GL_UNSIGNED_BYTE,
pixel,
w, h,
GL_UNSIGNED_BYTE,
buffer)!=0 )
{
// glu failure
error=true;
System.out.println("GL-ERROR: cannot gluScaleImage !\n");
} else {
pixel = buffer;
imageWidth=w;
imageHeight=h;
}
gl.glPixelStorei(GL_PACK_SWAP_BYTES, swapbytes[0]);
gl.glPixelStorei(GL_PACK_LSB_FIRST, lsbfirst[0]);
gl.glPixelStorei(GL_PACK_ROW_LENGTH, rowlength[0]);
gl.glPixelStorei(GL_PACK_SKIP_ROWS, skiprows[0]);
gl.glPixelStorei(GL_PACK_SKIP_PIXELS, skippixels[0]);
gl.glPixelStorei(GL_PACK_ALIGNMENT, alignment[0]);
gl.glPixelStorei(GL_UNPACK_SWAP_BYTES, unswapbytes[0]);
gl.glPixelStorei(GL_UNPACK_LSB_FIRST, unlsbfirst[0]);
gl.glPixelStorei(GL_UNPACK_ROW_LENGTH, unrowlength[0]);
gl.glPixelStorei(GL_UNPACK_SKIP_ROWS, unskiprows[0]);
gl.glPixelStorei(GL_UNPACK_SKIP_PIXELS, unskippixels[0]);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, unalignment[0]);
}
if(!error)
pixelScaled = true;
return pixelScaled;
}
/**
* This method loads the image into
* the current bind GL_TEXTURE_2D texture !
*
* Be sure to have the GL-Context being current !
*
* Be sure to have the GL_TEXTURE_2D bind to
* a textureName !
*
* This method calls scaleTexture2Pow2() to
* make the image of the normal texture size := pow2 !
* Then glTexImage2D is called with the texture properties !
*
* The Ascpect-Ratio is dropped !
*
* @see TextureTool#scaleTexture2Pow2
* @see GLFunc#glGenTextures
* @see GLFunc#glBindTexture
* @see GLFunc#glTexImage2D
* @see GLFunc#glPixelStorei
*/
public boolean texImage2DScaled2Pow2()
{
// The Scaled Way
if(!scaleTexture2Pow2())
return false;
gl.glTexImage2D(GL_TEXTURE_2D,
0,
getComponents(),
getTextureWidth(),
getTextureHeight(),
0,
getGLFormat(),
getGLComponentFormat(),
getTexture()); // The Scaled Way
return glutReportErrors();
}
/**
* This method loads the image into
* the current bind GL_TEXTURE_2D texture !
*
* Be sure to have the GL-Context being current !
*
* Be sure to have the GL_TEXTURE_2D bind to
* a textureName !
*
* This method calls scaleTexture4BestSize() to
* make the image of the best fitting size
* relative to the texture-size!
* Then glTexImage2D is called with the texture properties !
*
* The Ascpect-Ratio is not changed !
*
* A fine example exists in "demos/MiscDemos/GLImageViewerWorld" !
*
* @see TextureTool#scaleTexture4BestSize
* @see GLFunc#glGenTextures
* @see GLFunc#glBindTexture
* @see GLFunc#glTexImage2D
* @see GLFunc#glPixelStorei
*/
public boolean texImage2DScaled4BestSize()
{
// The Scaled Way
if(!scaleTexture4BestSize())
return false;
gl.glTexImage2D(GL_TEXTURE_2D,
0,
getComponents(),
getTextureWidth(),
getTextureHeight(),
0,
getGLFormat(),
getGLComponentFormat(),
getTexture()); // The Scaled Way
return glutReportErrors();
}
/**
* This method loads the image into
* the current bind GL_TEXTURE_2D texture !
*
* Be sure to have the GL-Context being current !
*
* Be sure to have the GL_TEXTURE_2D bind to
* a textureName !
*
* This method creates a target texture (glTexImage2D)
* without data,
* and substitutes only the unscaled image data (glTexSubImage2D) !
*
* The benefits of this functions is,
* that the image/texture is not scaled !
* A fine example exists in "demos/MiscDemos/GLImageViewerCanvas" !
*
* The pixel store mode GL_UNPACK_ALIGNMENT,
* is set temporary to byte alignment, then back to default (4) !
*
* The pixel store mode GL_UNPACK_ROW_LENGTH,
* is set temporary to imageWidth, then back to default (0) !
*
* @param clear if true, the texture will be initially loaded with
* a dummy blank (black) array
*
* @see GLFunc#glGenTextures
* @see GLFunc#glBindTexture
* @see GLFunc#glTexImage2D
* @see GLFunc#glTexSubImage2D
* @see GLFunc#glPixelStorei
* @see GLImageCanvas
*/
public boolean texImage2DNonScaled(boolean clear)
{
int swapbytes[]={0}, lsbfirst[]={0}, rowlength[]={0};
int skiprows[]={0}, skippixels[]={0}, alignment[]={0};
int unswapbytes[]={0}, unlsbfirst[]={0}, unrowlength[]={0};
int unskiprows[]={0}, unskippixels[]={0}, unalignment[]={0};
/* Save current modes. */
gl.glGetIntegerv(GL_PACK_SWAP_BYTES, swapbytes);
gl.glGetIntegerv(GL_PACK_LSB_FIRST, lsbfirst);
gl.glGetIntegerv(GL_PACK_ROW_LENGTH, rowlength);
gl.glGetIntegerv(GL_PACK_SKIP_ROWS, skiprows);
gl.glGetIntegerv(GL_PACK_SKIP_PIXELS, skippixels);
gl.glGetIntegerv(GL_PACK_ALIGNMENT, alignment);
gl.glGetIntegerv(GL_UNPACK_SWAP_BYTES, unswapbytes);
gl.glGetIntegerv(GL_UNPACK_LSB_FIRST, unlsbfirst);
gl.glGetIntegerv(GL_UNPACK_ROW_LENGTH, unrowlength);
gl.glGetIntegerv(GL_UNPACK_SKIP_ROWS, unskiprows);
gl.glGetIntegerv(GL_UNPACK_SKIP_PIXELS, unskippixels);
gl.glGetIntegerv(GL_UNPACK_ALIGNMENT, unalignment);
gl.glPixelStorei(GL_PACK_SWAP_BYTES, 0);
gl.glPixelStorei(GL_PACK_LSB_FIRST, 1);
gl.glPixelStorei(GL_PACK_ROW_LENGTH, 0);
gl.glPixelStorei(GL_PACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
gl.glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
gl.glPixelStorei(GL_UNPACK_LSB_FIRST, 1);
gl.glPixelStorei(GL_UNPACK_ROW_LENGTH, imageWidth);
gl.glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
byte[] clrPixel = null;
if(clear)
{
clrPixel=
new byte[textWidth * textHeight * getComponents()];
}
gl.glTexImage2D(GL_TEXTURE_2D,
0,
getComponents(),
getTextureWidth(),
getTextureHeight(),
0,
getGLFormat(),
getGLComponentFormat(),
clrPixel);
// The unscaled way
/*
System.out.println("******* width "+getImageWidth());
System.out.println("******* height "+getImageHeight());
System.out.println("******* format "+getGLFormat());
System.out.println("******* comps "+getGLComponentFormat());
System.out.println("******* text "+getTexture());
System.out.println("******* text.length "+getTexture().length);
*/
gl.glTexSubImage2D(GL_TEXTURE_2D,
0,
0, 0,
getImageWidth(),
getImageHeight(),
getGLFormat(),
getGLComponentFormat(),
getTexture());
// System.out.println("+++++++++");
gl.glPixelStorei(GL_PACK_SWAP_BYTES, swapbytes[0]);
gl.glPixelStorei(GL_PACK_LSB_FIRST, lsbfirst[0]);
gl.glPixelStorei(GL_PACK_ROW_LENGTH, rowlength[0]);
gl.glPixelStorei(GL_PACK_SKIP_ROWS, skiprows[0]);
gl.glPixelStorei(GL_PACK_SKIP_PIXELS, skippixels[0]);
gl.glPixelStorei(GL_PACK_ALIGNMENT, alignment[0]);
gl.glPixelStorei(GL_UNPACK_SWAP_BYTES, unswapbytes[0]);
gl.glPixelStorei(GL_UNPACK_LSB_FIRST, unlsbfirst[0]);
gl.glPixelStorei(GL_UNPACK_ROW_LENGTH, unrowlength[0]);
gl.glPixelStorei(GL_UNPACK_SKIP_ROWS, unskiprows[0]);
gl.glPixelStorei(GL_UNPACK_SKIP_PIXELS, unskippixels[0]);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, unalignment[0]);
return glutReportErrors();
}
protected final boolean glutReportErrors()
{
int error;
while ((error = gl.glGetError()) != GL_NO_ERROR)
__glutWarning("GL error: "+glu.gluErrorString(error));
return error==GL_NO_ERROR;
}
protected static final void __glutWarning(String str)
{
System.out.println("GLUT: Warning in (unamed): "+str+"\n");
}
}
|