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)

5
votes
1answer
526 views

Zooming into Mouse Position

I'm trying to implement my camera class for a simulation. But I cant figure out how to zoom into my world based on the mouse position. I mean the object under the mouse cursor should remain at the ...
5
votes
3answers
1k views

Multiple render targets and gamma correctness in Direct3D9

Let's say in a deferred renderer when building your G-Buffer you're going to render texture color, normals, depth and whatever else to your multiple render targets at once. Now if you want to have a ...
4
votes
4answers
693 views

Why do most game devs prefer OGL for OS X and D3D for Windows? [closed]

Today I decided to check what Diablo 3 developers used to do graphics: OpenGL or Direct3D? My mind was completely blown: For Windows, they've used D3D and for OS X they've used OGL. I did some ...
4
votes
3answers
4k views

Inverting matrix in HLSL

I've got an object in HLSL and I'm using hardware instancing to render multiple copies. But I've come a bit of a cropper when it comes to the vertex normals. Currently I am not using normal mapping ...
4
votes
3answers
743 views

CUDA 4.1 Particle Update

I'm using CUDA 4.1 to parse in the update of my Particle system that I've made with DirectX 10. So far, my update method for the particle systems is 1 line of code within a for loop that makes each ...
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
533 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
425 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
495 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
934 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
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
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
2answers
155 views

How can I manually construct a right-handed orthographic projection matrix?

I need the formula to create a orthographic projection matrix. I am using GLM math libary and DirectX11. The reason I cannot use GLM to create it is because the NDC spaces are different between DX11 ...
4
votes
4answers
822 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
796 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
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
2answers
809 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
927 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 ...
4
votes
1answer
2k 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
206 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
640 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
259 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
110 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
935 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
105 views

Should I use different input layout for meshes (vertices) with and without normal maps?

I'm writing an DirectX11 game. About 60% of my game models (or "of my vertices") have: Position Texture coordinate Some of them use: Position Texture coordinate Normals And few of them: ...
4
votes
2answers
280 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
1k 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
267 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
434 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
230 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
7k 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
2answers
234 views

Update and render in separate threads

I'm creating a simple 2D game engine and I want to update and render the sprites in different threads, to learn how it is done. I need to synchronise the update thread and the render one. ...
3
votes
1answer
6k 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
1k 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
225 views

How to correctly Dispose a SourceVoice once its finished

i am starting to play a sound with XAudio2 and SourceVoice and once its finished, it should be correctly disposed to not have any leaks. i was expecting it to be something like this: ...
3
votes
2answers
408 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
3answers
665 views

How to check if user has integrated graphics card?

I'm almost done with my Direct3D game. When user starts game first time it will adjust settings (and maximum settings) based on DirectX feature level starting from 9_1 up to 11_1. I have different ...
3
votes
1answer
736 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
17k 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
2k 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
605 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
1k 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 ...