direct3d

Pow implementation for double

社会主义新天地 提交于 2019-12-05 02:04:35
问题 I am developing a code that will be used for motion control and I am having a issue with the pow function. I am using VS2010 as IDE. Here is my issue: I have: double p = 100.0000; double d = 1000.0000; t1 = pow((p/(8.0000*d),1.00/4.000); When evaluating this last function, I don't get the better approximation as result. I am getting a 7 decimal digits correct, and the consequent digits are all trash. I am guessing that pow function only casts any input variable as float and proceds with

Looking for a faster-than-GDI solution for rendering dynamic data plots

这一生的挚爱 提交于 2019-12-04 17:45:55
I've written a simple GDI-based data plotter using C++/CLI but it's not particularly fast (some basic profiling indicates it's the rendering to screen that's the problem). Is there any way to enable hardware acceleration for a UserControl or is there a .net interface for direct3D? ...or are there some other options I could consider. We're using managed code so the solution really needs to be CLI compatible if at all possible. [Edit] In case it helps, I'm rending strips (128 data points) of rectangles which are each 2x2 pixels using Graphics::FillRectangle - maybe there's a better way of doing

Calculating screen texture coordinates in CG/HLSL

蓝咒 提交于 2019-12-04 17:00:38
In OpenGL , sometimes when doing multi-pass rendering and post-processing I need to apply texels to the primitive's assembly fragments which are part of full screen texture composition.That is usually the case when the current pass comes from FBO texture to which the screen quad had been rendered during previous pass.To achieve this I calculate objects UV coordinates in SCREEN SPACE .In GLSL I calculate it like this: vec2 texelSize = 1.0 / vec2(textureSize(TEXTURE, 0)); vec2 screenTexCoords = gl_FragCoord.xy * texelSize; Now I am experimenting with Unity3D which uses CG /HLSL.The docs for

How to select the front triangles of a stl model or a triangular mesh?

牧云@^-^@ 提交于 2019-12-04 16:49:10
There is a stl model(triangular mesh). I want to use a adjustable, rectangular shape to make selections. Like below picture. But I don't want the triangles on the other side are selected. That's to say only the visible triangles in the rectangular can be selected. AFAIK, there is a method to do this. First render each triangle with a specific and unique color. Then, retrieve the color of the pixels in the select rectangular, and convert those colors back to the original identifier. The triangle own the id is selected. I think this method is workable but inefficient. So is there any other

How to enable VSYNC in D3D windowed app?

雨燕双飞 提交于 2019-12-04 13:49:17
So, Im using D3D in a windowed application. I inited D3D with the following parameters: windowed: true; backbufferformat: D3DFMT_X8R8G8B8; presentinterval: D3DPRESENT_INTERVAL_ONE; swapeffect: DISCARD Each time OnPaint is called, I render the image to the backbuffer and present it to front. As far as I know (and so does MSDN say), once I set D3DPRESENT_INTERVAL_ONE , vsync will work. But in this case, the image is teared when dragging horizontally. (It seems there's a line across the image, image below the line shows on the monitor and the above part follows.) Some sites say D3DPRESENT

Detecting full-screen Direct3D applications

瘦欲@ 提交于 2019-12-04 13:26:29
问题 Is there any way to detect - through the Direct3D API - Direct3D applications running in full-screen mode? SHQueryUserNotificationState, which can indicate such applications, is only supported on Vista and up. It also only works when the Explorer shell is running. 回答1: I found how to detect full-screen Direct3D and OpenGL (for example Minecraft) applications. Call IDirectDraw7::TestCooperativeLevel(). This function returns DDERR_EXCLUSIVEMODEALREADYSET if active full-screen Direct3D

How to read vertices from vertex buffer in Direct3d11

泪湿孤枕 提交于 2019-12-04 11:43:09
I have a question regarding vertex buffers. How does one read the vertices from the vertex buffer in D3D11? I want to get a particular vertex's position for calculations, if this approach is wrong, how would one do it? The following code does not (obviously) work. VERTEX* vert; D3D11_MAPPED_SUBRESOURCE ms; devcon->Map(pVBufferSphere, NULL, D3D11_MAP_READ, NULL, &ms); vert = (VERTEX*) ms.pData; devcon->Unmap(pVBufferSphere, NULL); Thanks. Where your code is wrong: You asking GPU to give you an address to its memory( Map() ), Storing this adress ( operator=() ), Then saying: "Thanks, I don't

How do I improve Direct3D streaming texture performance?

北战南征 提交于 2019-12-04 11:23:32
I'm trying to accelerate the drawing of a full-screen texture which changes every frame. On my system, I can get around 1000 FPS using GDI and BitBlt(), but I thought I could improve performance by using Direct3D and dynamic textures. Instead I'm only getting around 250 FPS. I'm running on a Mac Pro with an ATI HD 4870 with current drivers. I've tried using dynamic textures and that gives me a small gain (~15FPS) and I've tried using a texture chain to avoid pipeline stalls and that has no effect. I've looked around quite a bit and there's very little information on using dynamic textures this

Direct3D 11 effect files deprecated?

寵の児 提交于 2019-12-04 10:25:53
问题 I've been playing around with Direct3D 11 a little bit lately and have been frustrated by the lack of documentation on the basics of the API (such as simple geometry rendering). One of the points of confusion brought on by the sparse documentation is the (apparent) move away from the use of effects for shaders. In D3D11 all of the effect (.fx) support has been removed from the D3DX libraries and buried away in a hard to find (sparsely documented, of course) shared source library. None of the

D3D11 screen desktop copy to ID3D11Texture2D

随声附和 提交于 2019-12-03 20:28:56
I am writing a DLL plugin that will read the desktop frame buffer (whole screen) and render it directly into a Texture2D pointer that is passed in. The goal is to keep everything in video memory (and avoid the cost of copying back to system memory and back to video memory). I am able to pass the Texture2D (showing up as a ID3D11Texture2D), but I am having issues grabbing the desktop frame buffer with D3D11. D3D9 offered GetFrontBufferData() but it seems D3D11 solution is to use GetBuffer(). My issue is about getting the IDXGISwapChain. Because I want to read the desktop frame buffer and simply