Recent

Author Topic: [SOLVED] so confusing about texture and surface  (Read 2288 times)

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
[SOLVED] so confusing about texture and surface
« on: October 01, 2016, 01:30:30 am »
I don't know what is better using SDL2:

1 case:
Surface variable created;
Surface loads image from disk;
Texture variable created;
Texture created from surface;
Texture Copied to Renderer;

2 case:
Texture variable created;
Texture loads image from disk;
Texture Copied to Renderer;

I see much people uses surface meanwhile i don't understand his utility.. please help what is better? I know to implement all of this two but i only want to know what of these two should i do.
If i do only texture, i will not be able to blit.. help
« Last Edit: October 01, 2016, 05:56:17 pm by Manu12x »
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: so confusing about texture and surface
« Reply #1 on: October 01, 2016, 02:17:04 am »
I already write this in another of your posts.

Textures use Hardware. Surfaces use Software.

Hardware is best.

Thaddy

  • Hero Member
  • *****
  • Posts: 14210
  • Probably until I exterminate Putin.
Re: so confusing about texture and surface
« Reply #2 on: October 01, 2016, 09:21:23 am »
Although that is the effective case, a better explanation is that a texture is applied to a surface. In this case most of the time directly on a hardware surface without going through a software abstraction of "surface".
Specialize a type, not a var.

 

TinyPortal © 2005-2018