DirectX is a set of multimedia APIs from Microsoft aimed primarily at game developers. Popular APIs within the DirectX collection include Direct3D, XInput, and XAudio.

learn more… | top users | synonyms (1)

4
votes
1answer
1k views

What is instancing, and how can I update my graphics code to do it?

This question directly follows on from this one: How can I implement a renderer that can draw many kinds of primitives? I have a small amount of drawing code structured in the following way: A mesh ...
4
votes
1answer
451 views

Simplex Noise flat land and hills

I'm using the simplex noise to create Minecraft like terrain. I can only achieve hills like this. Does anyone know how to use simplex to make more dynamic landscapes?
4
votes
1answer
356 views

What happens to data between vertex shader and pixel shader?

Short version: What can happen to the output of a vertex shader that leads to no(or very few) pixels being drawn, especially in relation to a perspective matrix. Long version: My problem refers to ...
4
votes
4answers
443 views

Game programming and quantity of timers

I've made a simple 2D game engine using C# and DirectX and it's fully functional for the demo I made to test it. I have a Timer object that uses QueryPerformanceCounter and I don't know what's the ...
4
votes
3answers
762 views

How do I Fallback to Older DirectX Versions?

I had a feeling that it would be easier to tackle this problem before I got too deep into development (unless, of course if that's a bad idea/the hard way, please inform me...). I'm creating my game ...
4
votes
2answers
2k views

How does one write to another process's OpenGL/DirectX context?

I want to write a short of chat client that display the messages in-game (OpenGL/DirectX), but I really don't know how to handle this. It is easy to write my client in my graphic context... but what ...
4
votes
2answers
4k views

2D graphics with Direct3D

I'm trying to work with 2D graphics using Direct3D 9, but am not sure where to start. Right now I'm using a texture as the "draw buffer", and drawing that texture to screen. For the simplest things, ...
4
votes
4answers
730 views

Face-Click Detection ( like in Minecraft )

I am working on a box-based game engine like minecraft and I was wondering how to detect the "clicked face" when placing blocks. I have created this engine in C++ ( DirectX / D3D ), C# ( XNA ) and ...
4
votes
3answers
3k views

How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile

I know that in OpenGL I can do something like this glReadBuffer( GL_FRONT ); glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer ); And its pretty fast, I get the raw bitmap in ...
4
votes
1answer
657 views

Bitwise operators in DX9 ps_2_0 shader

I've got the following code in a shader: // v & y are both uints nPixel = v; nPixel << 8; nPixel |= y; and this gives me the following error in compilation: shader.fx(80,10): error ...
4
votes
2answers
746 views

Ara matrices calculated on the GPU or on the CPU? Would built-in matrix functions be faster than my custom ones?

If I add a math library (for example containing a Matrix class) and use it in my program drawing with OpenGL, will my be work slower than if I used standard OpenGL functions for matrix calculations? ...
4
votes
3answers
2k views

Loading and using an HLSL shader?

I've been looking everywhere and all I can find are tutorials on writing the shaders. None of them showed me how to incorporate them into my scene. So essentially: Given an hlsl shader, if I were to ...
4
votes
1answer
1k views

In HLSL pixel shader , why is SV_POSITION different to other semantics?

In my HLSL pixel shader, SV_POSITION seems to have different values to any other semantic I use. I don't understand why this is. Can you please explain it? For example, I am using a triangle with the ...
4
votes
1answer
192 views

ID3D Query Where should I put them?

I'm currently trying to time different parts of my rendering to see how long it takes. I've got the queries working and I'm getting some results. My question is where should I actually start and end ...
4
votes
2answers
587 views

Material vs Material Pass

I am trying to figure out the difference between a "Material" and a "Material Pass" (in theory). Is it basically that a Material will have multiple "Material Pass"'es, along with a name. Then the ...
4
votes
1answer
3k views

Is DXUT deprecated?

I'm starting on a new project and was thinking of using DXUT. On the Microsoft site though, this page says the content has moved to this page. And on that second page, which is an overview of ...
4
votes
1answer
244 views

What is the purpose of mesh optimization functions?

I remember there is a specific function in Direct3D which optimizes a mesh or a 3D object in some way. What is the purpose of this function? How does it reorganize vertices to make it better?
4
votes
1answer
109 views

Capturing a programs performance

I'm trying to capture the performance of the GPU, CPU, FPS and memory usage on a program I'm currently working with and want to avoid having to write my own performance capture stuff. Does anyone know ...
4
votes
1answer
2k views

How do I create a CPU read/write buffer in SlimDX (what are the legal combinations of Usage and CPUAccess flags)?

Currently, I create a vertex buffer in SlimDX like so: SlimDX.Direct3D11.BufferDescription Description = new SlimDX.Direct3D11.BufferDescription(); Description.BindFlags = ...
4
votes
1answer
1k views

SRV from UAV on the same texture in directx

I'm programming gpgpu raymarching (volumetric raytracing) in directx11. I succesfully perform compute shader and save raymarched volume data to texture. Then i want to use same texture as SRV in ...
4
votes
2answers
884 views

Real time reflections

I just had a quick look at the new Crysis 2 DX11 update, and was quite surprised by some of the new features, especially the real time reflections on moving models. From what I could gather, there are ...
4
votes
2answers
2k views

DirectX Overlay

I have been a code in full convertion mods for the source engine, but now im mostly coding C# applications. That provide utilties for games, during this proccess i have often wanted the ability to do ...
4
votes
2answers
211 views

Is Batching Geometry Every Frame Always Slower Than Individual Draw Calls

I'm currently have an application that has ~10k draw calls. I implemented a batching scheme where I group all objects that share material, vertex format, etc and pre-transform them by their world ...
4
votes
2answers
835 views

ConsumeStructuredBuffer, what am I doing wrong?

I'm trying to implement the 3rd exercise in chapter 12 of Introduction to 3D Game Programming with DirectX 11, that is: Implement a Compute Shader to calculate the length of 64 vectors. Previous ...
4
votes
1answer
2k views

Non axis aligned bounding box collision and physics

Exactly how much more expensive, and while we're at it, difficult, is it to have non-axis aligned bounding boxes in your framework? I realise that it very much depends on what you're trying to do, so ...
4
votes
2answers
3k views

How Often do you change Vertex/Index/etc Buffers?

So im still learning but I think i've got a grasp of most things DX11 (Well....beginner things) And I REALLY do apologize for all the questions.....but I'd rather understand EVERYTHING before I move ...
4
votes
2answers
236 views

Open World Object Management

I'm currently creating a system that essentially creates a world at run-time based on a seed I choose. In this system, I made it so that there are certain "chunks" that divide up different sections of ...
4
votes
1answer
357 views

Applying an outline effect to primitives

I am trying to draw an outline on a collection of quads in Direct3D. I have three intersecting quads on the same plane in the following configuration: (The different colors here are just to ...
4
votes
1answer
220 views

Is it possible to programmatically prevent a game from pausing when its window loses focus? [closed]

I'm playing Skyrim in windowed mode and I am trying to create a bot for this game for personal use. I would like to have the bot play the game in the background, while I do other things, the only ...
3
votes
6answers
1k views

What is the easiest and shortest way to draw a 2d line in c/c++?

I am fairly new to c/c++ but I do have experiance with directx and opengl with java and c#. My goal is to create a 2d game in c with under 2 pages of code. Most of what I have seen requires 3 pages of ...
3
votes
7answers
6k views

GUI for DirectX

I'm looking for a GUI library built on top of DirectX- preferably 9, but I can also do 11. I've looked at stuff like DXUT, but it's way too much for me- I'm only needing some UI controls which I would ...
3
votes
1answer
5k views

How do I integrate bullet physics into my game?

I downloaded the release file found here, but I'm just not sure where to start. In my game I have a number of oblongs and a sphere, I want all of these to collide with one another. (They all have ...
3
votes
5answers
948 views

How do I convert DirectX's .X from binary encoding to text encoding and back

As far as I know, .X format can be text encoded and binary-encoded. I basically want to look into the model I'm playing with, get a better understanding of .X, possibly make some changes in it and ...
3
votes
2answers
406 views

Render only some of graphics?

In XNA I am building my own textbox, and listbox. For the textbox, I want it to render all text it can, and then cut off at the end of the textbox. But I don't want it to cut whole letters. I want it ...
3
votes
1answer
648 views

Spherical to Cartesian Coordinates

Well I'm reading the Frank's Luna DirectX10 book and, while I'm trying to understand the first demo, I found something that's not very clear at least for me. In the updateScene method, when I press A, ...
3
votes
4answers
15k views

Starting programming in 3D with C++ [closed]

EDIT: There aren't sufficient enough tutorials for what I'm trying to do in Python, so I'm going to take my time and slowly build up my skills in C++. It's hard to trip and not land in a book of C++ ...
3
votes
2answers
1k views

Does Monogame on Windows Desktop use OpenGL or DirectX by default?

if i use monogame 3.0 beta on windows desktop, does it use the directx renderer (sharpdx) or the opengl renderer by default? if it uses directx is there away to make sharpdx call directly? thanks!
3
votes
2answers
558 views

Why does the D3DXCOLOR structure not work as I expect?

I looked up some R G B values for certain colours, such as "Indian red" for example, which has the RGB values (238, 64, 4). If I use those values into a D3DXCOLOR structure like this: D3DXCOLOR(238, ...
3
votes
2answers
995 views

Creating Font Textures in Direct3d without D3DX

Update: The completed solution using Nathan Reed's answer is posted in my answer below A few open source programs I've seen that render installed fonts do something like this... Create a texture for ...
3
votes
2answers
2k views

How can I draw multiple lines connected via “nodes” with SlimDX?

I currently read out XML data with the following scheme: Position x,y,z I try to add one new Vertex for each position node and add it to a Vertex array. Then I try to render this list of vertices so ...
3
votes
2answers
4k views

Mapping a Vertex Buffer in DirectX11

I have a VertexBuffer that I am remapping on a per frame base for a bunch of quads that are constantly updated, sharing the same material\index buffer but have different width/heights. However, ...
3
votes
3answers
891 views

Model format for small game

I'm writing my own small-time game from scratch, and now I'm looking to start creating models. I've been wondering- what is the best model format to use? Given that I will be writing the model loading ...
3
votes
3answers
799 views

What do you need to know in C++ before starting to program with DirectX

I was wondering what do you need to know in C++ before starting to program with DirectX? I have only been programming in C++ (more for 2D games using SDL and learning the basics) for just over a ...
3
votes
3answers
360 views

When to return a reference and when to return a copy?

I was looking at the d3dx math .h and noticed that a difference between the "+" and "+=" operators: D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); D3DXVECTOR3 operator + ( CONST ...
3
votes
2answers
191 views

Is there any reason why there isn't a cross-platform implementation of DirectX?

Similar to how Mono can compile C# to various platforms, why isn't there an API that conforms to DirectX's specifications but can produce binaries for all platforms? I understand that there is OpenGL ...
3
votes
1answer
1k views

Teamviewer doesn't show my game screen

I've been building a 3D engine from scratch using C# and I've tried to show the result to a friend of mine using Teamviewer. When my demo game starts he doesn't see it. He can only see the last active ...
3
votes
1answer
342 views

Vertex Buffer Sharing between DirectX11 and Directx9

In my d3d9 engine i want to take benifit of compute shader of d3d11. So firstly I created a vertex buffer in d3d11 with D3D11_BIND_UNORDERED_ACCESS and then tried to create the d3d9 vertex buffer ...
3
votes
1answer
364 views

Matrix in constant buffer on the GPU contains NaNs but not on the CPU

I've got a shader with the following constant buffer: cbuffer ShaderParameters { matrix inverseViewProjectionMatrix; float4 cameraPosition; }; When using Visual Studio 2012's graphic ...
3
votes
1answer
216 views

What happens to a D3D11 application when Windows hibernates?

In D3D9 there was the concept of a "device reset". When a device reset occurred textures created with D3DPOOL_DEFAULT had to be recreated, but textures created with D3DPOOL_MANAGED didn't, because, ...
3
votes
2answers
282 views

Having the same texture data in different ID3D11Texture2D

Sorry if this has been answered elsewhere - I'm rather new to DX. My question concerns conservation of resources - specifically textures in VRAM. I assume that upon returning from a call to ...