3 votes

Dealing with back to front drawing with alpha blending and z buffer for a list of 2d quads

A smart bubble/insertion sort is faster than quick sort when the array is already mostly sorted (reused on the next frame). To speed up the copy of data rather than copying entire vertex values use ...
user avatar
3 votes
Accepted

Transform texture coordinates when using shader

I just stumbled back on this question, so I figure I should supply an answer. :) The shader code I wrote in the question is almost right. I forgot that to convert a point with these transformations, ...
user avatar
3 votes

DirectX poor Sprite Performance

Sprites in Direct3D are just textured triangles (or rather two triangles forming a quadrilateral). As such, the performance hit is because each time you change the source texture it has to flush the ...
user avatar
3 votes

Which DirectX Version to use for a low poly game?

You generally want to use the latest version that is compatible with your target platform. For most people that means DirectX11, since DirectX12 is not supported on versions of Windows (i.e. Windows 7)...
user avatar
  • 1,997
2 votes

How do I sample a Depth/Stencil Texture in HLSL?

There are two main ways to do this. First way is to do exactly what you're trying to avoid doing, and use a render target. This is the way used by the Shadow Mapping sample for D3D9 in the old ...
user avatar
2 votes

How to apply two pixel shaders in one go

You would have to render the results of the first to a texture, then read the texture in the second shader and output the results to the screen.
user avatar
  • 870
2 votes
Accepted

Why is my DX9 render target restricted to 512×512?

The problem was inside present parameters - I forgot to set backbuffer's width and height. ...
user avatar
  • 1,404
2 votes
Accepted

16-byte aligned matrix in DirectX9 and D3DX with Havok Physics 2012

The main thing to remember is that _declspec(align(16)) only affects the struct/class layout, is respected for local or global variables, but has no affect on heap ...
user avatar
2 votes
Accepted

Most efficient way to optimize based on gpu type?

Why not actually perform some frames of rendering and time it. If it is below your target speed turn off some features and try again. Keep doing this until performance is within your target. To hide ...
user avatar
  • 3,022
2 votes

Most efficient way to optimize based on gpu type?

Direct3D 9 and prior optimization is quite challenging. You have to handle the 'sea of caps' where specific hardware and drivers can remove almost any caps bit and expect apps to handle it when in ...
user avatar
2 votes

Direct3D9: How to switch from one full-screen monitor to another?

This is not actually possible. When you create the D3D device, it binds to the graphics adapter, which can't be changed on the fly.
user avatar
  • 6,399
2 votes
Accepted

Direct3D9: How to switch from one full-screen monitor to another?

Your statement in the question is correct. The recommended approach is that you recreate the d3d device object, you should already have an adapter reference and your creation settings from the first ...
user avatar
  • 1,673
2 votes
Accepted

Texture being stretched when using D3DTADDRESS_CLAMP

What are the texture coordinates that you're using for those vertices? With D3DTADDRESS_CLAMP, they must be in the [0;1] range, anything else will be clamped to [0;...
user avatar
  • 3,578
2 votes
Accepted

Simple 3D OBB-Collision (DirectX9, C++)

Unfortunately the correct answer IS to use a complex algorithm. The two common approaches are the Separating Axis Test (SAT) or Gilbert–Johnson–Keerthi Algorithm (GJK). I would favour SAT in this case....
user avatar
  • 3,022
2 votes

Simple 3D OBB-Collision (DirectX9, C++)

A C++ code implementation of the separating axis theorem for simple collision detection between two 3D OBB would be this: ...
user avatar
  • 121
2 votes

Need help converting LPDIRECT3DTEXTURE9 to openGl libgdx Pixmap

LPDIRECT3DTEXTURE9 is a texture object. OpenGL, by comparison to Direct3D, is weakly-typed, so there is no class or struct that is equivalent; instead texture objects are represented by unsigned ...
user avatar
2 votes

HLSL defined render states

This article is specific to using HLSL with the Effects Framework; it's not general to HLSL. The Effects Framework is a high-level software wrapper over the Direct3D 9 (in this case) API. It has no ...
user avatar
1 vote
Accepted

How to set a struct as a Direct3D9 vertex shader constant?

D3D9 doesn't support constant buffers but all uniforms are placed into one global "constant buffer". You can set multiple float4 constants at once with IDirect3DDevice9::SetPixelShaderConstantF() by ...
user avatar
  • 870
1 vote

Grab depth buffer with unlockable D3DFORMAT

You can read the depth buffer in a pixel shader if you use one of the special formats described at http://aras-p.info/texts/D3D9GPUHacks.html. They are somewhat GPU vendor specific, but you can ...
user avatar
  • 6,576
1 vote

FindNextValidTechnique fails

I didn't get FindNextValidTechnique to work and I resorted to ValidateTechnique instead. I used the base method ...
user avatar
  • 367
1 vote
Accepted

How can I implement triple buffering using Direct3D 9?

How do I know which buffer to draw to? You don't. Direct3D will automatically manage this for you and correctly rotate the back buffers at Present time.
user avatar
1 vote

How can I manually syncronize render calls with a monitor's refresh rate in Direct3D 9?

...
user avatar
  • 3,624
1 vote

How to draw an ellipse with DirectX 9?

There are multiple approaches: Cut-out texture Create a fully transparent texture. Fill the texture with the ellipse shape on the CPU. Render the texture with alpha blend. You only need one texture ...
user avatar
  • 386
1 vote
Accepted

How to retrieve vertex information from ID3DXMesh

You can look at the legacy DirectX SDK Direct3D 9 sample Pick or the Direct3D 10 sample Pick10. Generally you don't actually want to use the same geometry to render as you do for doing collision ...
user avatar
1 vote
Accepted

Can I use my directx 9 code to visual studio 2013 that already has directx11?

VS 2013 Express for Desktop, VS 2013 Pro+, or VS 2013 Community include the full Windows 8.1 SDK. This includes the system headers for Direct3D 9 (d3d9*.h) as has been the case since Windows SDK 6.0. ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible