|
Luc,
Thanks for the link. A colleague of mine has actually been writing the code, I haven't seen too much of it. I know he's tried captureing the DirectX frames as BMps, then using Windows Media Encoder to merge them into a WMV, but the frame rate has never been quite right. He might not have seen the IWMEncVideoSource2 type, which looks like exactly what we need. Hopefully the performance will be decent on it.
Thanks,
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
I have a set of products that were written in C++ and use GDI+ to render the graphics. This approach works well enough on my 7 year old P4 running Windows XP, i.e. the graphics are rendered quickly without any problems. But now some of my customers are moving to Windows 7. They are experiencing tremendous lags in graphics rendering with my software.
Could someone clue me in as to some possible reasons this is happening? I'm puzzled as to why my old computer is actually faster at rendering graphics with GDI+ than a newer computer running Windows 7.
|
|
|
|
|
A out of date graphics driver for the Win 7 machine can cause software rendering to kick in and thus be much slower.
|
|
|
|
|
Check out this link...
http://blogs.msdn.com/directx/archive/2009/09/29/comparing-direct2d-and-gdi.aspx[^]
Specifically.. the first reader comment:
"For whatever reason GDI+ slows so down in Windows 7, it is not understandable....
Reply:
"Husker, the problem with GDI+ that you describe is related to new support for device bitmaps in Win7, and there's a workaround.
In Vista, Microsoft stopped using XP Driver Model (XPDM) display drivers in scenarios in which the Desktop Window Manager (DWM) is running. Because of this, it meant that all GDI operations – which used to be hardware accelerated by XPDM drivers – became software-only (meaning, not hardware accelerated). Applications render via GDI to a software buffer, which is then blt’d via the DWM.
In Windows 7, Microsoft modified the use of GDI in a couple important ways. First, the GDI back buffer maintained by DWM was moved from system memory into hardware aperature memory. This improves blt speed. Second, WDDM 1.1 drivers can hardware-accelerate a certain number of limited GDI operations (eg. solid color fill, etc). So, as long as you have a WDDM 1.1 driver, GDI is sort-of “reaccelerated”. The degree to which WDDM 1.1 cards can hardware accelerate depends on fill rate, etc.
There’s a bug in GDI+ (which you’re describing above) that causes it to do readback from the hardware in a certain number of scenarios. The best way to use GDI+ in Windows 7 is to render with GDI+ to a DIB section and then blt the final result. You might want to give that a try before doing anything else.
Tom
|
|
|
|
|
Also this article has some insights on the W7 and GDI/GDI+/2D rendering.
|
|
|
|
|
Hello there,
I have following four column data with me..
Latitude, Longitude, U (velocity along x) and V (velocity along y)
Now using these data, I got to display vector plots where the velocities u and v are shown using arrows..
I am able to get the magnitude to be displayed... Now the problem is that i am not able to show the direction.. ( direction in terms of arrow) In other words how do i display an arrow at the head part of that vector.??
Second thing is that i have another set of data
Latitude, Longitude, and Depth..
Using these data, i need to display line contours.. Any slight initiation to solve this problem will be grateful...
Thanks in advance
|
|
|
|
|
One thing at a time. Let's look at the vectors first.
Each vector arrow will consist of two elements - a line and an arrowhead. The length of the line should be related to the magnitude of the vector, and it should be rotated to match the angle implied by the two cartesian components (U and V). The lines should probably be scaled so that the longest one stretches completely across it's 'cell' in the vector field, without reaching into adjoining cells.
The arrowhead is a little trickier. You need to work out the dimensions for the basic triangular shape you'll want, with it pointing, for instance, stright up. The shape will be defined by the locations of the three corners, relative to the center of the arrowhead. Then modify your arrowhead code so it'll take an angle as a parameter, and will render the arrowhead rotated to that angle. (Hint- if you define the arrowhead by it's corners, you should be able to apply the rotation to the corners and then draw the triangle.
That should get you started, anyway.
|
|
|
|
|
For a C# windows application I am working on, I am trying to draw actual poker cards. I haven't been able to figure out how to draw text upside down. (As such a number and suit will appear in the opposite corner upside down of the card) I have no problems with drawing a string normally. I was wondering if someone could point me in the right direction?
I did some searching on the net, but I haven't been able to get clear cut results. From what I found, I'm thinking a matrix is what is needed to be used, but I'm not quite sure how this would work.
My second question which is somewhat unrelated to the problem and isn't priority right now: Is it possible to draw an entire card and draw that card to a specifc location? I ask this because it might be easier to develop a card at a (0,0) point and place where it needs to be.
Thank You.
|
|
|
|
|
Hi,
1.
yes you can get there with a transformation matrix. The easier way is by calling TranslateTransform and RotateTransform. I suggest you first translate over (w/2, h/2) so the center of the card becomes (0,0), and the borders are at -w/2, +w/2, -h/2, +h/2.
Then draw everything from there; the upside-down parts just take a single RotateTransform over 180 degrees.
Remark: each transformation is added to the existing ones, so either do the upside-down parts (with RotateTransform) last, or have them followed by another rotation to undo the previous one for everything you will paint later on in the Paint handler.
Hint: it is quite easy to make a sign mistake, which will lead to everything being drawn outside the visible area, therefore I typically start of by drawing small things in a big area, and when things look about right, I set the normal sizes.
2.
To draw several cards on a playground, you could draw a single card into a card-size bitmap using Graphics.FromImage; then use such bitmapped cards as images to be painted anywhere on your Form, your Panel, or another much larger bitmap.
Alternatively you could precede a card drawing method by yet another translation (and even a rotation) to paint each card at its dedicated location and rotation on a playground.
3.
I would be inclines to come up with a single static method DrawCard, taking the following parameters:
- Graphics
- Card Location
- Card Size
- Card Orientation
- Card Value (52 plus backside, Joker, ...)
And then you could build a DrawHand on top of that, etc.
4.
Have a look at Graphics.ResetTransform, it may help you to reset things in between cards.
|
|
|
|
|
And since playing cards usually have symmetry (unless you're planning on the Tijuana type ), you could draw half the card and complete the rest with two flips, one horizontal and one vertical, and a translation of the first half. The backs usually have even more symmetry and you could get away with drawing a quarter and flipping and translating to fill in the rest. The efficiency of doing so, of course, depends on the intricacy of the patterns you're using.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
WaveK89 wrote: I am trying to draw actual poker cards.
If you want to use a ready made library there is some good information here[^].
|
|
|
|
|
Hi All,
The task which is given to me is that i have to show a cylinder in 3D.Then when i click on any part of the cylinder and drag the mouse i should be able to deform the cylinder and when i leave the mouse the object should be in the last deformed state.I am planning to use directx for this.
Any inputs from you will be very helpful for me.
Thanking you in Advance,
Regards,
Ashwath.
|
|
|
|
|
|
So how committed are you to using DirectX? I could help if you were implementing this in OpenGL, but not DX.
|
|
|
|
|
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Ok, so I have been trawling the web to try and find an answer to this, but to no avail.
Basically, I have a DirectShow filter (well 2) which will allow me to configure a Hauppage WinTV USB adapter (though I doubt the specific filter is 100% relevant to answer the question) to use PAL (I) and to set the source as Composite In. So far, I have found ways to display a filter's property page, and to change the settings of a DMO filter, but not enumerate and change the properties of a non DMO source filter.
The reason for needing to do this is that both filter options seem to reset with Windows, meaning that our source becomes NTSC and Tuner In, rather than Pal-I and Composite In. The filters are classed as a Video Capture Source (WinTV HVR-900H Capture) and a WDM Streaming Crossbar Device (WinTV HVR-900H Crossbar), but the ability to change any property of any filter sans a GUI will be a step in the right direction
I am using a .Net wrapper to play with the filter graph through c#, but have limited knowledge of COM interop (thus the wrapper). Any answers in C++ are fine and dandy also, then I'll worry about how to convert them to C#, just in need of an example really.
What's the easiest method to go about this?
|
|
|
|
|
Please don't spam the forums - ask your question once only in the appropriate forum.
|
|
|
|
|
Sorry, I thought as it was, in fact, relevant to the places I put it, that was acceptable. Was more through my frustration of trawling the web to no avail. Suprised no one else has asked this question before?
|
|
|
|
|
RobstaHendricks wrote: I thought as it was, in fact, relevant to the places I put it, that was acceptable.
No, it just means people get somewhat annoyed at reading the same question multiple times. Check this[^] out for the gudelines on how to use the forums correctly.
|
|
|
|
|
Yep, read that and it said only not to put a link to your post in an inappropriate forum:
"9.Please do not post links to your question in one forum from another, unrelated forum (such as the lounge)."
I understand what you are saying though, but didn't know which of the forums to post in. I'll take note for next time.
Any how, did you know which filter graph builder I should use to import the settings from the GRF file? I expect I'll figure which method to use from there.
|
|
|
|
|
Sorry, I don't know the answer to your query, just hope someone else with the relevant knowledge sees the post.
|
|
|
|
|
Hello,
I am using color picking method to select a primitive in my application.. At present it is picking only single object.. I just wanted to clarify few doubts..
It is working fine when i click on a single object.. I mean if there are two objects lying on the same pixel.. And if i click that pixel, then i get only one object.. How can i get both the objects, using this method..?? Is it possible..??
Thanks in advance
|
|
|
|
|
If you use the standard picking mechanism instead of color picking, you will get hit records for all objects within the selection volume, not just the first object in the Z-order. The standard mechanism is more cumbersome, but the trade-off is that it can be faster.
|
|
|
|
|
But I'm using VBOs.. And SELECT render mode doesnt work there i guess..?? Am i right..??
|
|
|
|
|
gourishsio wrote: And SELECT render mode doesnt work there i guess..?? Am i right..??
I haven't tried it, but I don't see why not. The location of the vertex data isn't really relevant. Once you've created your VBO, you still render it with glDrawArrays (or an equivalent sequence). What may complicate the issue is the fact that you'll have to break up the rendering of the object into a number of steps. Each sub-block that you want to uniquely identify in the hit test will need it's own 'name', and that name will have to be passed to glLoadName before the relevant piece of geometry is rendered. But AFAIK it should work with data stored in a VBO.
|
|
|
|
|