direct3d

Why doesn't Direct3D have it's own vertex structure?

I've always wondered the reasoning behind why we must always define D3DVERTEX. Is it because Microsoft wants to allow the opportunity to put this in a class and overload operators, or is there another reason? Thanks ...

Copy Texture to Texture

I've done 2 programs to use Shared Resources, running on SlimDX & DirectX10. One program will display the shared texture on a 3D mesh. The 2nd program will load an image as texture. So far I need to pass the shared handled everytime the texture is update from a new image. Now, is there a way that I can initialize a fixed size shared tex...

How to improve the copy speed from D3D surface back to system memory

I'm using the following codes to copy D3D surface back to system memory, but the performance is bad when call LockRect operation, it spends lot of time of this function. Is there a way to improve it? Thanks in advance. Below is sample codes. D3DDev->GetRenderTargetData(renderTarget, offscreenSurface); // Lock the surface to read pixel...

Looking for code samples for Direct3D tessellation

Dear All: I am trying to learn how to use the Direct3D function D3DXTessellateRectPatch: msdn.microsoft.com/en-us/library/bb205471(v=VS.85).aspx I have found the MSDN documentation quite useful and have been able to implement tessellation of a single rectangle patch. I am now trying to tesselate a mesh that consists of thirty two bicu...

How can I get the effect of colored vertices in WPF 3D?

Those in the know know that the D3DRS_COLORVERTEX Render State, present in every version of Direct3D since at least version 5, is not found in WPF 3D. The question is: How can you approximate colored vertex data, with gouraud shading, using WPF 3D? Optimally, I just want to be able to assign an RGBA color to a vertex. And presumably, I'...

VRML or X3D to Direct3D object convertor

Is there a tool available to convert VRML or X3D file to Direct3D .x object? Or is there a code snippet for the same? ...

How to create a direct3d texture of a web page rendered by MSHTML in C++ ?

Hello all, I have integrated a web page inside my native C++ Application through MSHTML (Microsoft Rendering engine of IE). What I want to do now is to generate a LPDIRECT3DTEXTURE9 (Direct3d texture) of the displayed web page. Is it possible ? Do you know how to ? Thanks in advance for all your answers. ...

Can any .X (DirectX 3D object) be used as progressive mesh?

Hi, I'm learning about Direct3D's progressive mesh. I tried the SDK sample (ProgressiveMesh) and fiddle with the code to replace the default object with some other .X file. The application works sometimes with some .X files but not all, especially when the file size is big and it crashes. Can anyway tell me if any .X object can be use...

direct3D 10 & 11

Is there a big difference (in the way of coding, ...) between the direct3d sdk 10 and 11, like "it was" between direct3d 9 and 10 ? Thank you ...

Direct3D vector output?

Is there any means to interpret Direct3D output as a series of vectors instead of a raster image? I am hoping I could use such a feature to generate a PDF file containing the rendered Direct3D output. Am I being too optimistic? ...

SlimDX: Cannot see Direct3D debug output in Visual Studio 2010

I've installed the June 2010 SDK Enabled the Debug Runtime in the DirectX Control Panel set the Debug Output Level to maximum (More) Enabled unmanaged code debugging. Result: The debug output from Direct3D is missing However if I start the application externally and use dbgview.exe, the output is shown there. What could be the rea...

Release Direct3D resources left behind by forcefully terminated application

I'm working on a Direct3D application and I sometimes need to terminate the application forcefully via the debugger. After the application has been terminated in this way a couple of times, Direct3D reports an "Out of video memory" error when attempting to create a new device. Presently I am working around this by switching my display re...

Set Individual Pixels on Back Buffer

I want to be able to set the individual pixels of the back buffer in my program in an efficient way. This is what I call in my rendering function: void render_frame(void) { d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0); d3ddev->BeginScene(); d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO,...

How do I make d3d use my vertex alpha values?

I'm trying to render a textured quad in d3d, and its not using the alpha values of the VERTICES of the quad the texture is being rendered to. Rather it is using the alpha of the TEXTURE. I want d3d to use the alpha of the VERTICES of the polygon it is placed upon. I have an idea it has to do with SetTextureStageState, but I can't quit...

Power of 2 Textures with Sprite Animation

I want a texture to contain each frame of a sprite's animation. Let's say each frame was 128x128 pixels, and there was 4 frames. Then it could easily fit into one 256x256 texture. If I have for instance 25 frames, then it'd have to fit into one 640x640 texture (128*5=640). However I read that texture dimensions should be powers of 2 for ...

Obtaining minimum and maximum rendered UV values (Direct3D)

I need to calculate the minimum and maximum UV values assigned to the pixels produced when a given object is drawn onscreen from a certain perspective. For example, if I have a UV-mapped cube but only the front face is visible, min(UV) and max(UV) should be set to the minimum and maximum UV coordinates assigned to the pixels of the visib...

Can't get window handle of a D3D application

Hello there, I'm trying to send keys to a minimized/unfocused D3D application using C#. So I borrow FindWindowEx and PostMessage function from the Win32 API. I also used Winspector Spy to determine the class name of the D3D canvas to fill in the 3rd parameter of FindWindowEx function, and the name is "D3D Window". Here's my code: Sy...

Prevent Auto Screen Resolution Restore

In my program the user can switch between full-screen and windowed modes. The full-screen mode potentially changes the screen resolution, and switching to windowed mode changes it back to what it was previously. At the program's termination the operating system automatically restores the screen resolution to it's default if it detects t...

Cost much memory when creating serveral vertex and index buffer

Hi, guys, I met a very weird issue. When I create some very simple VertexBuffer and IndexBuffer in D3D, the memory comsuption reported from TaskManager is huge. I created 60000 index buffer via D3D CreateIndexBuffer method. Each index buffer contains 6 index (int) which represents two triangles. So, one index buffer will occupy 24 bytes...

draw over opengl/D3D with GDI?

I'm wondering if it's possible to draw over an opengl/direct3D surface with GDI? and if so, how might it be done? The reason I ask is because I'm writing a simple app to draw a few things in games. Such things would all be 2D or text such as framerate info, custom crosshair, clock, etc. I know the best way is to hook in and use whateve...