directx

Performance of DirectX and Recent Windows Mobile Version

I'm seeing very poor performance while using the managed DirectDraw wrappers for WindowsMobile. Microsoft.WindowsMobile.DirectX.Direct3D I would appear the biggest bottle neck is calling Device.Present() after building up the scene. When using the System.Diagnostics.Stopwatch and running this very trivial exmaple Using Sprites on ...

DirectX.Sound in WPF

I wish to play Tones in WPF from a sound card device (not system speaker). Im disappointed to find that apart from playing a beep or a wav file WPF does not have any native way to play simple sound frequencies. ie play(freq, duration); Looking into using DirectX DirectSound Ive hit a problem on how WPF using windows handles, as Direct X...

Making a custom mesh in C# managed DirectX

I need to make a DirectX 3D mesh at run time using Managed DirectX from C#. I have not been able to locate any information on how to do this. No, I can't use a 3D modeler program to make my objects. They must be precisely sized and shaped, and I don't have ANY of the size or shape information until runtime. No, I can't build up the m...

error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned?

I'm trying to create a vector for D3DXMATRIXA16 like so: vector<D3DXMATRIXA16> matrices; and am getting the error: d:\Program Files\Microsoft Visual Studio 9.0\VC\include\vector(717) : error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned e:\projects\emuntitled\em\emscratch\emshadow.h(...

HLSL Compiler error?

float4x4 matInvViewProj; float4 GetPointPosition(float2 Tex0) { float4 PosImageSpace; PosImageSpace.xy = float2(Tex0*2-1); PosImageSpace.z = tex2D(DepthTextureSampler,Tex0).r; return mul(PosImageSpace,matInvViewProj); } That's a part of my pixelshader. Why is there a compiler error? I'm compiling it in ps_3_0. Without ...

Matrix multiplication - view/projection, world/projection, etc

In HLSL there's a lot of matrix multiplication and while I understand how and where to use them I'm not sure about how they are derived or what their actual goals are. So I was wondering if there was a resource online that explains this, I'm particularly curious about what is the purpose behind multiplying a world matrix by a view matri...

Learning DirectX

I want to learn to do some DirectX 9 and 10 programming in C++. Could anyone suggest me some good books to start with for a beginner in DirectX and at the same time, some reference books for DirectX 9 and 10? I have a background in standard C++ programming and I want to know what are the prerequisites to be able to program with DirectX....

What are all the different HLSL sampler types for?

I'm working with DX9/SM3 at the moment, and the MSDN documentation on HLSL samplers seems to be sorely lacking in explaining how to use the different sampler types. What's worse is they try to cover DX9 and DX10 in a single article, so they jumble together all the keywords: sampler Name = SamplerType { Texture = <texture_variable>; [...

How do I draw simple graphics in C#?

I just want to draw simple 2D objects like circle, line, square etc in C#. How do I do that? Back in the Turbo C++ days I remember initializing some graphics library for doing the same. Do I need to do something similar in .NET? Is it any different for 3D objects? Will things like DirectX make this any easier? Any links to tutorials or s...

Why the buffer size of the output IMediaSample is smaller than one of the input?

I have built the ezrgb24 sample project successfully, which is in the DirectShow SDK. But I encountered a confused problem when I debug it. The following Copy method was called by the Transform method. HRESULT CEZrgb24::Copy(IMediaSample *pSource, IMediaSample *pDest) const { ... // Copy the sample data BYTE *pSourceBuffer...

How to blend color of two sprites with constant alpha in DirectX?

Essentially, what I want to do (in DirectX) is to take two partially-transparent images and blend them together. This works fine with default blending, insofar as they both show up as overlapping, etc. However, the problem is that the opacity goes up markedly where the two intersect. This causes increasing problems as more sprites ove...

DirectX Firefox Plugin rendering artifacts

QUICK ANSWER: For those of you who reach this page via Google looking for a solution to the same problem, try this quick fix (suggested by Goz) - Add D3DCREATE_FPU_PRESERVE to the behavior flags on your CreateDevice() call. That cleared it up for me! I'm creating a DirectX 9-based NPAPI plugin. It seems to be working well ...

Videomemory/DirectX: How to get amount of shared and real memory?

Possible Duplicate: Report Direct3D memory usage I want to know how much video memory a graphic card has. I want to preload textures based on that information. There are many cards which don't have own memory (or very little) and share systems RAM. Those cards sometimes return gigantic numbers (>1GB) but that is misleading becau...

Assertion error in animation library: ID3DXAnimationController::RegisterAnimationOutput: Number of matrices registered is equal to the max number set at creation time.

When I replace the tiny_anim.x animation file with another one in the DirectX multianimation demo I get the following error: Assertion failure! (s:\gfx_sdknovember08\windows\directx\dxg\d3d11\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices D3DX: ID3DXAnimationController::RegisterAnimationOutput:...

DirectX DirectInput C# measure audio input

Hello, C# 2008 SP3 I have developed a softphone and our client would like to have a feature that would test if the microphone is working. I was thinking to have a progress bar that would go up and down based on the nose level. I have done a bit of research on this. But I couldn't find any tutorials on directX DirectInput what would h...

How to implement high speed animation?

I'm trying to write an application (winforms) that can demonstrate how two oscillating colors will result in a third color. For this I need to be able to switch between two colors very fast (at >50 fps). I'm really hoping to do this in managed code. Right now I'm drawing two small rectangular bitmaps with solid colors on top of each ot...

How can I multiply matrix greater than 4 x 4 in the vc++ using directx?

I have to multiply 12x12 matrix with 12x 1 matrix in VC++ directx. Which template library should I use with vs 2005 I want to do matrix multiplication faster too. ...

Adjust brightness/contrast/gamma of scene in DirectX?

In a Direct3D application filled with Sprite objects from D3DX, I would like to be able to globally adjust the brightness and contrast. The contrast is important, if at all possible. I've seen this question here about OpenGL: http://stackoverflow.com/questions/139012/tweak-the-brightness-gamma-of-the-whole-scene-in-opengl But that do...

How to Draw Two Detached Rectangles in DirectX using the D3DPT_TRIANGLESTRIP Primitive Type

I am new to DirectX and I am trying to draw two rectangles in one scene using D3DPT_TRIANGLESTRIP. One Rectangle is no problem but two Rectangles is a whole different ball game. Yes i could draw them using four triangles drawn with the D3DPT_TRIANGLELIST primitive type. My curiosity is on the technic involved using D3DPT_TRIANGLESTRIP. P...

Most basic transformed vertex-drawing with Direct3D

I'm absolutely new to DirectX and I'd like to draw some untransformed primitives with the most basic Direct3D configuration (for learning purposes). I already drew some primitives with transformed vertices, that is vertices with the D3DFVF_XYZRHW flag set. Now I'm trying to get the same output with untransformed vertices, but I don't ge...