Skip to content

Commit c72b73e

Browse files
TehLeoNehon
authored andcommitted
Added Texture Formats R16F, R32F, RG16F, RG32F. (#839)
1 parent c49a0dc commit c72b73e

File tree

2 files changed

+189
-24
lines changed

2 files changed

+189
-24
lines changed

jme3-core/src/main/java/com/jme3/renderer/opengl/GLImageFormats.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ public static GLImageFormat[][] getFormatsForCaps(EnumSet<Caps> caps) {
196196
format(formatToGL, Format.Luminance32F, GLExt.GL_LUMINANCE32F_ARB, GL.GL_LUMINANCE, GL.GL_FLOAT);
197197
format(formatToGL, Format.Luminance16FAlpha16F, GLExt.GL_LUMINANCE_ALPHA16F_ARB, GL.GL_LUMINANCE_ALPHA, halfFloatFormat);
198198
}
199+
format(formatToGL, Format.R16F, GL3.GL_R16F, GL3.GL_RED, halfFloatFormat);
200+
format(formatToGL, Format.R32F, GL3.GL_R32F, GL3.GL_RED, GL.GL_FLOAT);
201+
format(formatToGL, Format.RG16F, GL3.GL_RG16F, GL3.GL_RG, halfFloatFormat);
202+
format(formatToGL, Format.RG32F, GL3.GL_RG32F, GL3.GL_RG, GL.GL_FLOAT);
199203
format(formatToGL, Format.RGB16F, GLExt.GL_RGB16F_ARB, GL.GL_RGB, halfFloatFormat);
200204
format(formatToGL, Format.RGB32F, GLExt.GL_RGB32F_ARB, GL.GL_RGB, GL.GL_FLOAT);
201205
format(formatToGL, Format.RGBA16F, GLExt.GL_RGBA16F_ARB, GL.GL_RGBA, halfFloatFormat);

jme3-core/src/main/java/com/jme3/texture/Image.java

Lines changed: 185 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public enum Format {
258258
* half-precision floating point red, green, and blue.
259259
*
260260
* Requires {@link Caps#FloatTexture}.
261+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
261262
*/
262263
RGB16F(48,true),
263264

@@ -272,6 +273,7 @@ public enum Format {
272273
* single-precision floating point red, green, and blue.
273274
*
274275
* Requires {@link Caps#FloatTexture}.
276+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
275277
*/
276278
RGB32F(96,true),
277279

@@ -300,31 +302,190 @@ public enum Format {
300302
* Requires {@link Caps#TextureCompressionETC1}.
301303
*/
302304
ETC1(4, false, true, false),
303-
304-
R8I(8),
305-
R8UI(8),
306-
R16I(16),
307-
R16UI(16),
308-
R32I(32),
309-
R32UI(32),
310-
RG8I(16),
311-
RG8UI(16),
312-
RG16I(32),
313-
RG16UI(32),
314-
RG32I(64),
315-
RG32UI(64),
316-
RGB8I(24),
317-
RGB8UI(24),
318-
RGB16I(48),
319-
RGB16UI(48),
320-
RGB32I(96),
321-
RGB32UI(96),
305+
306+
/**
307+
* 8 bit signed int red.
308+
*
309+
* Requires {@link Caps#IntegerTexture}.
310+
*/
311+
R8I(8),
312+
/**
313+
* 8 bit unsigned int red.
314+
*
315+
* Requires {@link Caps#IntegerTexture}.
316+
*/
317+
R8UI(8),
318+
/**
319+
* 16 bit signed int red.
320+
*
321+
* Requires {@link Caps#IntegerTexture}.
322+
*/
323+
R16I(16),
324+
/**
325+
* 16 bit unsigned int red.
326+
*
327+
* Requires {@link Caps#IntegerTexture}.
328+
*/
329+
R16UI(16),
330+
/**
331+
* 32 bit signed int red.
332+
*
333+
* Requires {@link Caps#IntegerTexture}.
334+
*/
335+
R32I(32),
336+
/**
337+
* 32 bit unsigned int red.
338+
*
339+
* Requires {@link Caps#IntegerTexture}.
340+
*/
341+
R32UI(32),
342+
343+
344+
/**
345+
* 8 bit signed int red and green.
346+
*
347+
* Requires {@link Caps#IntegerTexture}.
348+
*/
349+
RG8I(16),
350+
/**
351+
* 8 bit unsigned int red and green.
352+
*
353+
* Requires {@link Caps#IntegerTexture}.
354+
*/
355+
RG8UI(16),
356+
/**
357+
* 16 bit signed int red and green.
358+
*
359+
* Requires {@link Caps#IntegerTexture}.
360+
*/
361+
RG16I(32),
362+
/**
363+
* 16 bit unsigned int red and green.
364+
*
365+
* Requires {@link Caps#IntegerTexture}.
366+
*/
367+
RG16UI(32),
368+
/**
369+
* 32 bit signed int red and green.
370+
*
371+
* Requires {@link Caps#IntegerTexture}.
372+
*/
373+
RG32I(64),
374+
/**
375+
* 32 bit unsigned int red and green.
376+
*
377+
* Requires {@link Caps#IntegerTexture}.
378+
*/
379+
RG32UI(64),
380+
381+
/**
382+
* 8 bit signed int red, green and blue.
383+
*
384+
* Requires {@link Caps#IntegerTexture} to be supported for textures.
385+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
386+
*/
387+
RGB8I(24),
388+
/**
389+
* 8 bit unsigned int red, green and blue.
390+
*
391+
* Requires {@link Caps#IntegerTexture} to be supported for textures.
392+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
393+
*/
394+
RGB8UI(24),
395+
/**
396+
* 16 bit signed int red, green and blue.
397+
*
398+
* Requires {@link Caps#IntegerTexture} to be supported for textures.
399+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
400+
*/
401+
RGB16I(48),
402+
/**
403+
* 16 bit unsigned int red, green and blue.
404+
*
405+
* Requires {@link Caps#IntegerTexture} to be supported for textures.
406+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
407+
*/
408+
RGB16UI(48),
409+
/**
410+
* 32 bit signed int red, green and blue.
411+
*
412+
* Requires {@link Caps#IntegerTexture} to be supported for textures.
413+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
414+
*/
415+
RGB32I(96),
416+
/**
417+
* 32 bit unsigned int red, green and blue.
418+
*
419+
* Requires {@link Caps#IntegerTexture} to be supported for textures.
420+
* May be supported for renderbuffers, but the OpenGL specification does not require it.
421+
*/
422+
RGB32UI(96),
423+
424+
425+
/**
426+
* 8 bit signed int red, green, blue and alpha.
427+
*
428+
* Requires {@link Caps#IntegerTexture}.
429+
*/
322430
RGBA8I(32),
323-
RGBA8UI(32),
324-
RGBA16I(64),
325-
RGBA16UI(64),
326-
RGBA32I(128),
327-
RGBA32UI(128)
431+
/**
432+
* 8 bit unsigned int red, green, blue and alpha.
433+
*
434+
* Requires {@link Caps#IntegerTexture}.
435+
*/
436+
RGBA8UI(32),
437+
/**
438+
* 16 bit signed int red, green, blue and alpha.
439+
*
440+
* Requires {@link Caps#IntegerTexture}.
441+
*/
442+
RGBA16I(64),
443+
/**
444+
* 16 bit unsigned int red, green, blue and alpha.
445+
*
446+
* Requires {@link Caps#IntegerTexture}.
447+
*/
448+
RGBA16UI(64),
449+
/**
450+
* 32 bit signed int red, green, blue and alpha.
451+
*
452+
* Requires {@link Caps#IntegerTexture}.
453+
*/
454+
RGBA32I(128),
455+
/**
456+
* 32 bit unsigned int red, green, blue and alpha.
457+
*
458+
* Requires {@link Caps#IntegerTexture}.
459+
*/
460+
RGBA32UI(128),
461+
462+
/**
463+
* half-precision floating point red.
464+
*
465+
* Requires {@link Caps#FloatTexture}.
466+
*/
467+
R16F(16,true),
468+
469+
/**
470+
* single-precision floating point red.
471+
*
472+
* Requires {@link Caps#FloatTexture}.
473+
*/
474+
R32F(32,true),
475+
476+
/**
477+
* half-precision floating point red and green.
478+
*
479+
* Requires {@link Caps#FloatTexture}.
480+
*/
481+
RG16F(32,true),
482+
483+
/**
484+
* single-precision floating point red and green.
485+
*
486+
* Requires {@link Caps#FloatTexture}.
487+
*/
488+
RG32F(64,true),
328489
;
329490

330491
private int bpp;

0 commit comments

Comments
 (0)