XFillPolygon: Transpent fill with out using a pixmap? - transparency

Because of a driver problems using XFillPolygon with StippleFill and a pixmap is extremly slow. The driver providers are also extremly slow in providing a fix so I need a workaround.
Is there a way to fill a polygon with a transparent color using XFillPolygon with out using a stiple fill and a pix map?
Thanks

After a great amount of research I reached the conclusion that it can not be done through xlib. However it can be done by hardware specific X extensions. So my next step from here is to get a workaround from the hardware provider.

Related

Direct2D versus Direct3D for digital video rendering

I need to render video from multiple IP cameras into several controls within the client application.
On top of the video, I should be able to add some OSD such as timestamp and camera name.
What I'm trying to do has nothing to do with 3D since we're talking about digital video with some text on it.
Which API is more suitable for this purpose? Direct3D or Direct2D?
Performance should also be a consideration here.
It used to be that Direct2D was a poor choice for Windows Phone (if you care about that system) because it wasn't supported, but Win Phone 8.1 has it now, so less of an issue.
My experience with D2D was that it offered fast, high quality 2D rendering, and I would say it is a good choice.
You might want to take a look at this article on Code Project. That looks appropriate for your purposes.
If you are certain you only need MS system support, then you're all set.
Another way to go would be a cross platform system like nanovg, which offers nice 2D rendering and would work on a Mac. Of course, you'd need to figure out how to do the video part on non windows systems.
Regarding D3D, you could certainly do it that way, but my guess would be it would make some things trickier to do. Don't forget you can combine the two as well...

Hardware/Software rasterizer vs Ray-tracing

I saw the presentation at the High-Perf Graphics "High-Performance Software Rasterization on GPUs" and I was very impressed of the work/analysis/comparison..
http://www.highperformancegraphics.org/previous/www_2011/media/Papers/HPG2011_Papers_Laine.pdf
http://research.nvidia.com/sites/default/files/publications/laine2011hpg_paper.pdf
My background was Cuda, then I started learning OpenGL two years ago to develop the 3d interface of EMM-Check, a field-of-view-analyze program to check if a vehicle is going to fulfill a specific standard or not. essentially you load a vehicle (or different parts), then you can move it completely or separately, add mirrors/cameras, analyze the point of view and shadows for the point of view of the driver, etc..
We are dealing with some transparent elements (mainly the field of views, but also vehicle themselves might be), therefore I wrote some rough algorithm to sort on fly the elements to be rendered (at primitive level, a kind of Painter's algorithm) but of course there are cases in which it easily fails, although for most of cases is enough..
For this reason I started googling, I found many techniques, like (dual) depth peeling, A/R/K/F-buffer, ecc ecc
But it looks like all of them suffer at high resolution and/or large number of triangles..
Since we also deal with millions of triangles (up to 10 more or less), I was looking for something else and I ended up to software renderers, compared to the hw ones, they offer free programmability but they are slower..
So I wonder if it might be possible to implement something hybrid, that is using the hardware renderer for the opaque elements and the software one (cuda/opencl) for the transparent elements and then combining the two results..
Or maybe a simple (no complex visual effect required, just position, color, simple light and properly transparency) ray-tracing algorithm in cuda/opencl might be much simpler from this point of view and give us also a lot of freedom/flexibility in the future?
I did not find anything on the net regarding this... maybe is there any particular obstacle?
I would like to know every single think/tips/idea/suggestion that you have regarding this
Ps: I also found "Single Pass Depth Peeling via CUDA Rasterizer" by Liu, but the solution from the first paper seems fair faster
http://webstaff.itn.liu.se/~jonun/web/teaching/2009-TNCG13/Siggraph09/content/talks/062-liu.pdf
I might suggest that you look at OpenRL, which will let you have hardware-accelerated raytracing?

D3D9 Application not working w/ Intel HD Graphics

I've inherited an application that uses D3D9 to display graphics full screen on monitor #2. The application works properly on a desktop machine with a GeForce 9500 GT. When I attempt to get the application running on a laptop equipped with onboard Intel HD Graphics, all of the graphics are not displayed. One of the vertex buffers is drawn but the rest are black.
I'm not very familiar with D3D, so I'm not sure where to begin debugging this problem. I've been doing some searching but haven't been able to turn anything up.
Update:
Drawing simple vertex buffers with only 2 triangles works, but anything more complex doesn't.
My gut feeling is likely the supported shader models for the given GPU.
Generally it is good practice to query the gfx card to see what it can support.
There is also a chance it could be specific D3D API functionality - you see this more so with switching between say GeForce & ATI(AMD), but of course also possible with Intel being its own vendor; but I would start by querying supported shaders.
For D3D9 you use IDirect3D9::GetDeviceCaps to query the gfx device.
links:
Post here: https://gamedev.stackexchange.com/questions/22705/how-can-i-check-for-shader-model-3-support
http://msdn.microsoft.com/en-us/library/bb509626%28VS.85%29.aspx
DirectX also offer functionality to create features for a given device level:
http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876%28v=vs.85%29.aspx
Solution #1:
Check every error code for every D3D9 call. Use DXGetErrorString9 and DXGetErrorDescription9 to get human-readable translation of error code. See DirectX documentation for more info. When you finally encounter a call that returns something other thant D3D_OK, investigate DirectX documentation for the call.
Solution #2:
Install debug DirectX drivers (should be included with DirectX SDK), examine debug messages process outputs while being run (messages are being printed using OutputDebugMessage, so you'll only see then in debugger/IDE). With high debug settings, you'll see every single problem in your app.

What is the most efficent way to screen capture? Screen capturing using DirectX?

I've known about screen capture using Device Contexts and GDI, since windows XP. Is there a better way (i.e. DirectX?) now that the desktop is mostly Direct3D.
How can I screen capture using DirectX?
I want to know the most efficent way to user-mode screen capture. For a tech support program that needs frequent screen scrapes.
UPDATE: I don't want to resort to using kernel mode drivers.
I am unsure this will actually be faster than the algorithms you have in mind, but one way to do it would be to copy your buffer out using GetRenderTargetData.
GetRenderTargetData
Based upon vcsjones answer (above). See CodeProject http://www.codeproject.com/KB/dialog/screencap.aspx#And%20The%20DirectX%20way%20of%20doing%20it%20
An alternative method is using Spazzarama's application, which uses DirectX (based on SlimDx) and Easyhook to inject your capture dll into a running application's DirextX pipeline.

XNA Antialias question!

I've got problems with XNA and antialiasing. I can activate it using
graphics.PreferMultiSampling = true;
graphics.ApplyChanges();
however - it's only 2x antialiasing. Even if I set
graphics.GraphicsDevice.PresentationParameters.MultiSampleType = MultiSampleType.SixteenSamples;
it stays only 2x antialiasing. If i go to my graphics driver settings (NVIDIA GeForce 9800 GT) and set Antialiastype from Application decides to 16x, then I get nice and clean antialiasing. But if it's set on 'Application decides' i don't get more than 2x
Anyone an idea why?
Thanks!
I would try following these instructions on MSDN. In this thread at the XNA forums, Shawn Hargreaves tells another person (who is using code similar to yours) that this isn't the way to setup multisampling. He indicates that it's supposed to be specified in the parameters when you create the device. The MSDN article shows which event to handle to set up antialiasing at the proper time. This thread also basically indicates the same thing: that you should perform this type of setup in the event handler.
Also, I believe the MSDN example checks for 4XAA and 2XAA, so you may have to change the code to support 16XAA. While looking into this though, I saw this quote in the first XNA thread I linked:
Also, I know of no GPU that supports 16 sub-samples for multisampling. For example the mode names "16x" that you see on Nvidia's 8000 and 9000 series actually uses 4 samples, with a quality level of "2" IIRC. The most those GPU's support is 8 sub-samples, which corresponds to the "8xQ" and "16xQ" settings.
So, I don't know exactly what settings you'll have to use to get 16XAA; you may have to play around with it a bit.

Resources