gui rendering
what is the best method for rendering gui components in d3d9? I am trying using textures to render it in billboard fashion using squares but using odd sized textures seems to be trouble.
Use only power-of-two textures, and put your gui graphics into pow2 texture atlasses. The easiest way to render GUI is by using ID3DXSprite9 interface - it takes care of batching for you. However, it's difficult to get it to work along side vertex and pixel shaders (because you need to figure out what projection matrix it uses in order to correctly transform verts in the vertex shader), so it may be less suitable for anything besides GUI rendering. Certain effects, such as per-vertex color blend/alpha blend, are impossible to achieve directly with D3DXSprite.
If you don't need any special effects for the GUI just paste all your odd sized textures into one power of two sized texture then when using D3DXSprite you can specify which parts of the texture go where.
So far the problems I see are all caused by texture magnification or minification. I think I will just see if there is a way to alpha blend directly to the backbuffer from a surface.
You can just set the mag/min filters to point, in which case extra pixels surrounding edges will not get sampled. This will also cause a pixellated look.
Why do you think alpha blending to the backbuffer will solve any of your problems?
Why do you think alpha blending to the backbuffer will solve any of your problems?
actually found my issue with the quad the bottom left uv was wrong. So I am using quads and 1/tan(fov/2) to find the distance where the screen is +-aspect ratio in x and +-1 in height to make screen coordinate translation easy. I am using textures that are nearest power of 2 and let the unused space be transparent. Its working nicely actually finally I have a vector based GUI that I wanted so I can easily create custom controls like I do with a regular windows app.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement