D3DXLoadTextureFromFile

A386b5a02cc45ac0d1908a5ae21468fc
0
f1engineer 101 Aug 10, 2007 at 14:24

Hello all

I use D3DXLoadTextureFromFile function. Everything work fine, but with a problem:
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?

8 Replies

Please log in or register to post a reply.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Aug 10, 2007 at 14:45

I fail to see how D3DXLoadTextureFromFile would reduce rendering performance. Are you loading a texture every frame or something?

A386b5a02cc45ac0d1908a5ae21468fc
0
f1engineer 101 Aug 13, 2007 at 06:25

Hi friends
Sorry for the late answer.

  1. I create vertex buffers:
    • Allocate memory place and initialize all the vectors of vertex buffers. This function is called one time when create the graphical objects.
  • After it with created vertex buffers I call PrepareMatrices member function that move and rotate all the objects.

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.

regards
Kamen

A386b5a02cc45ac0d1908a5ae21468fc
0
f1engineer 101 Aug 13, 2007 at 07:18

I understand what You mean

  1. I create vertex buffers:
  • Allocate memory place and initialize all the vectors of vertex buffers. This function is called one time when create the graphical objects.

  • 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.

regards
Kamen

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 104 Aug 14, 2007 at 16:19

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 completely
different.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Aug 14, 2007 at 19:58

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.

A386b5a02cc45ac0d1908a5ae21468fc
0
f1engineer 101 Aug 15, 2007 at 10:32

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.

6d6e06654a85934959c1a98813731360
0
njdewit 101 Aug 16, 2007 at 12:46

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 rendering).

A386b5a02cc45ac0d1908a5ae21468fc
0
f1engineer 101 Aug 17, 2007 at 13:30

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.

Best regards
Kamen