Search code examples
javaopengllwjglfloatbuffer

FloatBuffer and 3D graphics


I have been looking for a beginners explanation of what a floatBuffer is and how it relates to 3D programming (specifically for use in the LWJGL for java). It seems I have to use it allot for lighting and billboarding and things but I dont fully understand its purpose or what it is, Can someone offer an explanation ?


Solution

  • A floating point image format, used for texture samplers or framebuffers, uses floating point values instead of integers to represent each pixels value. Integers (and fixed point values) have a fixed range of values they can represent, with constant precision. Floating point values however "balance" between value range and precision and can support larger value ranges than integers or fixed point values.

    The application is for example HDR rendering. Say you got a scene with very dim and very brightly lit parts. With a fixed point format you must choose between either poor fidelity, or oversaturated bright areas, or underexposed dark areas. Using a floating point format you can represent the whole scene and apply a tonemapping only at the output to the display to set exposure levels and represented value range.