omf2097 / openomf

One Must Fall 2097 Remake
http://www.openomf.org
MIT License
362 stars 35 forks source link

OpenGL #468

Closed katajakasa closed 2 days ago

katajakasa commented 1 year ago

WIP, do not merge.

Plan:

  1. Dump sprites to an RG8 texture atlas (R = color, G = alpha)
  2. Dump vertices and texture coords to a VBO
  3. Dump palettes and remappings to UBO(s) (or possibly consider 1D textures later for gotta go faster ?)
  4. Create an R8 texture and bind it to FBO, set FBO as target.
  5. Draw all objects. Shader should do any palette trickery now.
  6. Switch back to default FBO, and bind the previous render target texture.
  7. Ram the textuer through RGBA conversion with current palette.
  8. Run any upscaler shaders we want also (scalehqx, vhs, scanline, etc).
  9. Profit!

Notes:

It might make sense to split the rendering into three, as the news caster guy wants images from arenas without the text and UI crap. So perhaps first render all game objects, then snatch any screenshots, and then draw the UI crap.

Cleanup TODO:

turol commented 1 year ago

Prefer libepoxy over libglew. It supports GL ES too and starts up faster.

katajakasa commented 1 year ago

Prefer libepoxy over libglew. It supports GL ES too and starts up faster.

Interesting, I will take a look. Glew is a total pain to maintain.

turol commented 1 year ago

Reading from UBO with a varying offset might be a slow path. Use a texture instead. Either GL_TEXTURE_1D or a 2d texture with width or height of 1.

Using discard in shader is potentially a slow path. Prefer outputting fully transparent color instead.

katajakasa commented 1 year ago

Reading from UBO with a varying offset might be a slow path. Use a texture instead. Either GL_TEXTURE_1D or a 2d texture with width or height of 1.

Using discard in shader is potentially a slow path. Prefer outputting fully transparent color instead.

Interesting. I added these on my future to-do list.

turol commented 1 year ago

You probably want this: https://www.reddit.com/r/gamedev/comments/2j17wk/a_slightly_faster_bufferless_vertex_shader_trick/

katajakasa commented 1 year ago

You probably want this: https://www.reddit.com/r/gamedev/comments/2j17wk/a_slightly_faster_bufferless_vertex_shader_trick/

Lol. On to the list it goes.

katajakasa commented 2 days ago

Further work items are now here: https://github.com/omf2097/openomf/issues/612