Engine improvements: 2D rendering (TGLImage) – customize shader, documentation, getting contents from GPU

Posted on

custom_shader
  1. I wrote a wiki page documenting two approaches for 2D rendering using Castle Game Engine. Advised
    reading for people implementing 2D games 🙂

  2. You can customize the look of TGLImageCore using the TGLImageCore.CustomShader. Or you can customize the look of TCastleImageControl using TCastleImageControl.CustomShader. The demo: examples/images_videos/image_render_custom_shader.lpr.

  3. You can now assign the TCastleImageControl.DrawableImage. This allows you to render TGLImage on GPU using any fancy method, and then use it as a source of TCastleImageControl efficiently.

  4. Remember that you can draw one TGLImage over another, or draw arbitrary (2D or 3D) things into the TGLImage, using fast GPU rendering. The demo how to do this is in examples/images_videos/draw_images_on_gpu.lpr.

  5. You can get the contents of TGLImageCore to TCastleImage (thus getting the memory from GPU to RAM, available to CPU) using the GetContents helper method.

Leave a Reply