SLD2 - 绘制一个纹理的多个实例的最快方法

时间:2023-02-01 11:36:22

I would like to draw multiple instances (like 100000) of the same texture at the same time (rotatable and on different positions). Currently I'm using SDL_RenderCopyEx (using a shared SDL_Texture* for that) and I'm wondering if I'm using the correct function for that purpose. Is there a faster way, as I'm down at 18 FPS. Thanks.

我想同时绘制相同纹理的多个实例(如100000)(可旋转和在不同位置)。目前我正在使用SDL_RenderCopyEx(使用共享的SDL_Texture *),我想知道我是否正在使用正确的功能。有没有更快的方式,因为我的速度低于18 FPS。谢谢。

1 个解决方案

#1


1  

As i remember SDL2 doesn´t provide any function to make instanced rendering, so you have to iterate through your objects and draw them 1 by one (and thats why are your FPS falling down)

我记得SDL2没有提供任何实现渲染的功能,所以你必须遍历你的对象并逐个绘制它们(这就是为什么你的FPS掉落)

Also i don´t understand why did u add an opengl tag here, but when we talk about opengl, i recommend you checking instanced rendering http://learnopengl.com/#!Advanced-OpenGL/Instancing

另外我不明白为什么你在这里添加一个opengl标签,但是当我们谈论opengl时,我建议你检查实例渲染http://learnopengl.com/#!Advanced-OpenGL/Instancing

#1


1  

As i remember SDL2 doesn´t provide any function to make instanced rendering, so you have to iterate through your objects and draw them 1 by one (and thats why are your FPS falling down)

我记得SDL2没有提供任何实现渲染的功能,所以你必须遍历你的对象并逐个绘制它们(这就是为什么你的FPS掉落)

Also i don´t understand why did u add an opengl tag here, but when we talk about opengl, i recommend you checking instanced rendering http://learnopengl.com/#!Advanced-OpenGL/Instancing

另外我不明白为什么你在这里添加一个opengl标签,但是当我们谈论opengl时,我建议你检查实例渲染http://learnopengl.com/#!Advanced-OpenGL/Instancing