I use D3DXLoadTextureFromFile function. Everything work fine, but with a
When loading textures in such way, rendering of the vertex buffers
become very slow.
It is not very nice when catch the object and begin drag it.
Are there any ways to improve performance of rendering?
Please log in or register to post a reply.
I fail to see how D3DXLoadTextureFromFile would reduce rendering
performance. Are you loading a texture every frame or something?
Sorry for the late answer.
I do not load each time textures form file during all the interactions
with the objects.
I’m sorry that I do not post any code here. I shall do it tomorrow.
I understand what You mean
Allocate memory place and initialize all the vectors of vertex
buffers. This function is called one time when create the graphical
After it with created vertex buffers I call PrepareMatrices member
function that move and rotate all the objects.
But at this point I call each time SetTexture for each vertex buffer. My
be it is a problem because i call this function in each mouse position.
Is it possible to call m_pD3DDevice->SetTexture(…) only when
creating vertex buffers? If it is possible the problem is solved.
did you create the vertex buffers and textures in write only mode?
thats all i can think of.
you can set texture ten thousand times and it wouldnt slow you down.
you can prepare your matrices ten thousand, no slow down.
your texture has nothing to do with your geometry buffers, they are
Are you using mipmapping? Because if you aren’t, and it is a large
texture with only a small projection on the screen, you’ll get massive
texture cache misses which will slow things down dramatically.
I replace SetTexture at the place where I create vertex buffers and this
solve the problem. My be if I use another mapping parameter it will
solve the problem in different way, but for now everything is fine and
I’m able to continue development.
Are you rendering directly when a mouse movement event comes in? This is
what I, possibly, get from what you’re saying. You might consider just
updating the position and rendering your object(s) once every frame
using that information (decoupling movement registration and the
Thanks for the answer.
The problem was not in moving by mouse position. I make movement by
Translate methods of direct X. The problem was that I call SetTexture
every time when the mouse position is changed, instead to call this
function once when create texture and set it to vertex buffer.