Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture-based rendering #440

Closed
cxong opened this issue Jul 18, 2016 · 2 comments
Closed

Texture-based rendering #440

cxong opened this issue Jul 18, 2016 · 2 comments

Comments

@cxong
Copy link
Owner

cxong commented Jul 18, 2016

After the SDL2 port #169, we can move to a more efficient rendering method, by rendering entire textures instead of software rendering into a surface. This should make the game much more efficient, especially on high resolutions.

I've already tested separating the menu background into a different texture and it works well. Contrary to what the SDL2 migration guide implies, rendering multiple textures, where one of them is a software-updated one, is perfectly fine.

Other advantages include:

  • More efficient tile map / font rendering, by rendering the same tiles repeatedly using SDL_RenderCopy
  • Replace BlitMasked, BlitTint et al with the more efficient SDL_SetTextureColorMod
  • Semi-transparent textures, for better looking effects like muzzle flashes, explosion flames, text animations etc. Can also do glow effects, for rocket launcher, maybe some pseudo-lighting effects.
  • Can efficiently scale the game graphics, to implement dynamic zoom (but may look bad because of the pixel graphics)

Some considerations:

  • May need to introduce texture atlases to fully take advantage of tile map rendering. This conflicts a bit with the custom graphics functionality; C-Dogs may need to include its own texture packer.
  • Need to re-implement brightness with a lower-quality alternative. There's SDL_SetWindowBrightness but from testing it affects the entire display (and can be overridden by apps like flux), and also cannot set brightness above 100%. The alternative, to overlay everything with a semi-transparent white texture, isn't going to look as good.
@cxong cxong added this to the Wishlist milestone Jul 18, 2016
@cxong cxong removed the enhancement label Nov 30, 2016
@cxong cxong mentioned this issue May 17, 2017
@cxong cxong modified the milestones: 0.6.6, Backlog May 17, 2017
cxong added a commit that referenced this issue May 20, 2017
cxong added a commit that referenced this issue May 22, 2017
@cxong cxong modified the milestones: 0.6.6, Backlog Jul 11, 2017
@cxong cxong modified the milestones: Backlog, 0.6.7 May 2, 2018
@cxong
Copy link
Owner Author

cxong commented May 2, 2018

Most of this work has actually been done via #500 ; need to check if this can be closed off

Seems like there is a possible rendering bug in macOS, especially with two windows.

@cxong
Copy link
Owner Author

cxong commented May 5, 2018

This has been mostly implemented (still need to do the HUD), however it's apparent that performance is worse, at least at low resolutions. I suspect it's due to texture switching, so this task should be put on hold for now.

@cxong cxong modified the milestones: Grenade Button, Backlog May 5, 2018
@cxong cxong removed this from the Backlog milestone Aug 7, 2019
@cxong cxong added this to the New GUI and Special Effects milestone Oct 28, 2019
@cxong cxong closed this as completed Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant