简体   繁体   English

SDL2 2D 纹理分配/池化

[英]SDL2 2D texture allocation/pooling

I have two questions regarding SDL2's hardware-accelerated texture rendering:我有两个关于 SDL2 的硬件加速纹理渲染的问题:

  1. When using SDL_Createtexture(...) , are textures automatically pooled/transferred between system RAM and VRAM when VRAM is at a premium?使用SDL_Createtexture(...) ,当 VRAM 非常SDL_Createtexture(...) ,纹理是否会在系统 RAM 和 VRAM 之间自动池化/传输? In order to ensure I don't inundate VRAM, I was considering loading textures into surfaces and converting them to textures as and when required (it's unlikely that all textures will fit into VRAM at once).为了确保我不会淹没 VRAM,我正在考虑将纹理加载到表面并在需要时将它们转换为纹理(不太可能所有纹理一次都适合 VRAM)。
  2. When minimizing a fullscreen application and/or changing screen resolutions, will SDL_Texture instances need to be recreated?在最小化全屏应用程序和/或更改屏幕分辨率时,是否需要重新创建SDL_Texture实例?

No, you don't need to recreate your SDL_Texture instances after minimize a window or change its resolutions.不,您不需要在最小化窗口或更改其分辨率后重新创建SDL_Texture实例。 Maybe you only need to redraw things in the screen after change its resolutions, but not after minimize it.也许您只需要在更改分辨率后重新绘制屏幕中的内容,而不是在最小化它之后。

Also, I recommend you to look at these SDL2 tutorials: https://lazyfoo.net/tutorials/SDL/index.php另外,我建议您查看这些 SDL2 教程: https ://lazyfoo.net/tutorials/SDL/index.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM