directx-9

SlimDX/DirectX9/C# - How to access pixel-data in a Texture

一笑奈何 提交于 2019-12-19 03:13:36
问题 This is my first question ever on StackOverflow, hurray! I can honestly say I use StackOverflow on daily basis for both my work and personal programming mysteries. 99,9% of the time I actually find the answer I need on here too, which is great! My current problem actually stumped me a little as I can't seem to find anything which actually works. I've already read several posts on GameDev.net and found other resources around the net but can't sort it out. I am in the process of porting a small

How do I render a fullscreen frame with a different resolution than my display?

蓝咒 提交于 2019-12-13 04:22:12
问题 I am in the process of teaching myself DirectX development while going through all the tutorials on http://directxtutorial.com/. I have run into a problem that I believe is related to me having multiple monitors. My display is 1920 x 1080. When my code runs in its current state my primary monitor becomes black with the cursor in the middle. When I set my SCREEN defines at the top of my code to 1920 x 1080 my program runs fine and displays my sprite with the navy background. When I leave the

Why can't I initialize WNDCLASSEX wc?

余生颓废 提交于 2019-12-13 03:12:04
问题 I declare the attribute WNDCLASSEX wc in my header file like so: private: HWND hWnd; LPDIRECT3D9 g_pD3D; // Used to create the D3DDevice LPDIRECT3DDEVICE9 g_pd3dDevice; // Our rendering device WNDCLASSEX wc; And I want to initialize it in my Init() function, like so: void RAT_RendererDX9::Init(RAT_WindowManager* argWMan) { wMan = argWMan; // Register the window class wc = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0, 0, GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, "D3D Tutorial", NULL }

IDirect3DDevice9::EndScene hook sometimes get NULL in the parameter IDirect3DDevice9

删除回忆录丶 提交于 2019-12-12 02:26:54
问题 I made a trampoline hook for the function IDirect3DDevice9::EndScene. The codecave I modified the start if the EndScene function to jump to is this: __declspec(naked) HRESULT EndScene_Hook(IDirect3DDevice9* device) { ScreenCapture::Capture(device); __asm { PUSH 0x14 MOV EAX, 0x718E6478 JMP address } } The problem is that sometimes device is NULL, why is that? if I add a small condition like this: if(device != NULL) ScreenCapture::Capture(device); Everything works as intended with no errors.

2 x “LNK2019: unresolved external symbol” errors when compiling

陌路散爱 提交于 2019-12-12 01:44:35
问题 I get the below two linking errors when I try to compile in VS 2010. I have ensured that my include & library settings are correct in the project properties > VC ++ Directories & also checked to make sure that Project > Linker > Input has d3d9.lib & d3dx9.lib in it which it does. I've also tried adding #pragma comment for the two above libraries in D3DGraphics.h but to no avail :( The compile errors.... 1>D3DGraphics.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4

Per vertex pre-computated lighting in DirectX9 using fixed function rendering pipeline

感情迁移 提交于 2019-12-11 14:06:47
问题 I'm making a DirectX 9 C++ application using the fixed function pipeline, given pre-computated lighting for each vertex, (Regardless of normals/etc) how can I apply this to the final image? I'm currently using textured primitives and I'm trying to change colour as a whole (over the entire primitive -- rather than using a gradient) and I have to precalculate lighting because of the the number of lights and the application being designed to get decent framerates even on low-end machines. (IE

ID3DXSprite depth sorting

时光怂恿深爱的人放手 提交于 2019-12-11 13:57:01
问题 I have two sprites A and B. A - opaque, Z = 1. B - half-transparent, Z = 0. Draw call order A -> B. According to MSDN I should use flag D3DXSPRITE_SORT_DEPTH_BACKTOFRONT when drawing transparent sprites of varying depths. Problem is it works vice versa - only with flag D3DXSPRITE_SORT_DEPTH_FRONTTOBACK . Please explain how depth sorting works in ID3DXSprite and where is Z value growing (I assume from 0 to 1, 1 being most remote from screen). 回答1: If you use D3DXSPRITE_SORT_DEPTH_FRONTTOBACK ,

Very high CPU usage directx 9

谁说胖子不能爱 提交于 2019-12-11 05:58:56
问题 I'm going to use DirectX, so I'm using directxtutorial.com tutorial. When I run my game, it has very high cpu usage. It takes all power of the first core of my processor. I have Celeron e3400. I think it's much more than I need to run my game without anything. Sorry for that bunch of code. I have no idea what could be wrong. Here is my code: #include <windows.h> #include <windowsx.h> #include <d3d9.h> #pragma (lib, "d3d9.lib") #define Width_X 1024 #define Height_Y 768 LPDIRECT3D9 d3d;

Capture and draw a screenshot using directX

被刻印的时光 ゝ 提交于 2019-12-11 05:14:48
问题 I am trying to get DirectX (DX9) to grab a screenshot of the desktop and immediately draw it back out (in smaller dimensions) to my form. I have DirectX working to the capacity that the device is created along with a few surfaces and I can render them to screen. I am using one surface F3F3Surf9_SS to get the desktop Screenshot. Here is my declaration and initialization of varaibles F3D3Surf9_SS : IDirect3DSurface9; //Surface SS F3D3Surf9_A : IDirect3DSurface9; //Surface A F3D3Surf9_B :

Unable to capture data from Back Buffer (DirectX9)

一曲冷凌霜 提交于 2019-12-10 11:20:53
问题 I am trying to find the fastest method to take the screenshot. So far I've figured out that either GDI, or DirectX can be used. Using GDI I am able to capture the screen in 35ms, while using DirectX Front buffer it takes 73ms average. I want even faster method than this. For this purpose capturing Back Buffer in DirectX seems to be a good method. I am using the following code to do the same: D3DDISPLAYMODE ddm; D3DPRESENT_PARAMETERS d3dpp; if((g_pD3D=Direct3DCreate9(D3D_SDK_VERSION))==NULL) {