Are the points changed when you move the mouse over them (they should appear filled)?
Printable View
yeah, the points works, I can move them around. but the picture itself is not shown at all.
only at start I see picture, once I start moving the dots, the picture disappears and never returns.
but, if I compile and run .exe it works.
@the trick can you add a import .obj or .x demo
hi the trick can you add a example fot loading,resizing,moving,rotating .x or .obj in dx9vb
how to load obj with it
I would like to capture a small region of 40 x 80 pixels of my screen as bmp at 60 fps.
I want to record a certain checkbox slider animation.
Why bmp? I need to be able to perfectly compare the frames to see changes from 1 frame to another to see if anything happened, as I want to discard frames where nothing happened.
I tried that to do that with a screen recorder, but the one which could record at 60 fps would not record in a losless format, so I always got compressed frames which never looked perfectly the same althought (judging with a human eye) nothing happened. This showed me that I really need to use bmp.
Can I do that using your DirectX library in VB6?
Thank you!
Search for a lossless screen recorder, like https://www.wisdom-soft.com/products...enrecorder.htm
And the free CamStudio also support LossLess encoding
Quote:
..
And if all that wasn't enough, CamStudio also comes with its own Lossless Codec that produces crystal clear results with a much smaller filesize compared with other more popular codecs, like Microsoft Video 1.
..
Yes, I found out how to do it with litecam and a losless codec, however I don't want to rely on closed source apps anymore, that was also a reason why I asked here.
But you are using Windows and VB6? :rolleyes:
https://stackoverflow.com/questions/...-using-directx
The example there uses Direct3D 9; I didn't check if The trick's lib has everything needed. Note there's a comment there about partial screen captures with a dead link; here's the archive of it if you need it.
As that thread notes, there's better options if you don't need to support Windows 7. There's a VB6 implementation of Desktop Duplication.
You could try my VB6 Capture any Window with WinRT / Windows.Graphics.Capture project for that. You can set it to capture any region from a window or from the entire monitor.
It does capture all frames as bitmaps as you wanted but the frame rate is way higher than 60 fps so you'd have to employ a timer if you want less frames. Also you'd need to save the frames yourself (with SavePicture or some such) as at the moment they are only displayed in a PictureBox and not encoded in a stream in any way.
@VanGoghGaming: Btw, you could use the class to implement a full-blown screen to GIF/MP4 app by shelling ffmpeg (or not) so that the sample project is full (includes capture frame-rate) and feature-rich (allow captions, mouse movements, etc.)
I don't know anything about ffmpeg but shelling out external applications to do the job for you doesn't sound like a proper thing to do. The project can already capture mouse movements, the property is just set to False by default. The next step in development would indeed be making a video file from the captured frames.
WinRT does seem to have the right tools for the job as explained in this article: Screen capture to video but translating C# into VB6 when all you can rely on is "DispCallFunc" is an extremely tedious process to say the least.
I've spent days on end on this screen capture project which at first was just capturing frames synchronously in a loop and then spent even more days implementing surrogate events to make it asynchronous and get rid of the loop but now the novelty has pretty much worn off. Anyone who wants to take it further is welcome to though.
I've been looking at some possible alternatives tB might be able to do with WinRT... if Python can make use of it through CppWinRT then why not tB?
Because manually translating it into regular COM interfaces... it would be easier to use but holy hell would it take me forever. Looking at all the ones in that screengrab project it'd take weeks of devoting all my free time to it, and that's *counting* all the DirectX/DXGI/WIC stuff I've already got 100% covered.
Trust me, it is the proper thing to do in this case. Everybody uses ffmpeg to produce/transcode video, it's like the gold standard, even youtube is using it.
ScreenToGif has it's own proprietary animated GIF encoder but allows ffmpeg for video *and* animated GIFs -- the difference in output is huge (the difference on GIFs).
cheers,
</wqw>
By "obj", I assume you mean a Wavefront type file, and not a compiler intermediate file. As such, you're really talking about a piece of 3D mesh.
Now, my understanding of Direct3D (whatever version), is, what we're getting is a GPU interface that allows loading 3D mesh into the GPU memory, texturing it, building a back-buffer-frame, and then displaying the whole-frame (with no build-flicker). Beyond that, we've got to do all other manipulations (rotation, translation, scaling) ourselves and then re-load them into the back-buffer to build another frame.
So, to ask how to rotate, translate, & scale in DirectX is not a good question. You should just ask how to rotate, translate, & scale a piece of mesh in memory (regardless of the GPU approach).
Now this requires a good working knowledge of 3D linear algebra (primarily, an understanding of what mesh is, and how to use 3D transformation matrices).
Without getting into texturing, mesh is nothing but a set of 3D vertices with another set of pairs of pointers telling us how those 3D vertices are connected. But, for purposes of transformation (rotate, scale, translate), we can ignore the set of pairs of pointers, as they won't change. We just need to know how to transform each of the vertices in the mesh definition. Translation (moving) is easy. Just add (or subtract) the translation amount from each vertex. Scaling and rotation are a bit more complex, in that we must know the centroid around which to rotate and/or scale. We might just transform from <0,0,0> or we might calculated a vertex average around which to rotate. These are decisions that must be made, but we must have a centroid to scale or rotate.
Once we've got our centroid, we must build a transformation matrix (which can include any/all of scale, rotate, translate), and these transformation matrices are applied in that order (scale first, rotate next, and finally translation). So, to do it in a different order, you must build separate transformation matrices, and do it in steps. Once our transformation matrix is built, we simply subtract the centroid, multiply it (via linear algebra) to each of our mesh vertices, re-add the centroid, and voila. Shove the results back into your Direct3D buffer and build a new frame with it. (And just as a further FYI, we must do this for each mesh-piece in our frame.)
I'm not sure if that helps or not, but it's the answer. The trick does supply a wonderful VB6 library of 3D linear algebra procedures, but you've still got to know 3D linear algebra to know how to use them.
I thought I would give it a try to port that Screen Capture to Video C# project into VB6 but the attempt was rather short lived! :D I got stumped near the beginning on these 3 lines of C# code from the article:
The VB6 equivalent (quite a handful compared to the 3 lines above) looks like this but it blows up on the red line below (which is the equivalent of "new MediaStreamSource(_videoDescriptor)"):Code:var videoProperties = VideoEncodingProperties.CreateUncompressed(MediaEncodingSubtypes.Bgra8, width, height);
_videoDescriptor = new VideoStreamDescriptor(videoProperties);
// Create our MediaStreamSource
_mediaStreamSource = new MediaStreamSource(_videoDescriptor);
I don't have a C# compiler to test if their example crashes in the same way but I really can't figure out what might be the problem. I doubled checked all the IIDs both from the SDK and the MagnumDB website, everything checks out...Code:Private Sub SetupVideoStreamDescriptor()
Dim lpIVideoEncodingPropertiesStatics As Long, lpIVideoEncodingProperties As Long, lpIVideoStreamDescriptorFactory As Long, lpIMediaEncodingSubtypesStatics As Long, hString As Long
If GetActivationFactory(WindowsMediaMediaPropertiesVideoEncodingProperties, pIID(eIVideoEncodingPropertiesStatics), lpIVideoEncodingPropertiesStatics) Then
If GetActivationFactory(WindowsMediaMediaPropertiesMediaEncodingSubtypes, pIID(eIMediaEncodingSubtypesStatics), lpIMediaEncodingSubtypesStatics) Then
If InvokePtr(lpIMediaEncodingSubtypesStatics, IMediaEncodingSubtypesStatics_GetBgra8, VarPtr(hString)) = S_OK Then
If InvokePtr(lpIVideoEncodingPropertiesStatics, IVideoEncodingPropertiesStatics_CreateUncompressed, hString, m_lWidth, m_lHeight, VarPtr(lpIVideoEncodingProperties)) = S_OK Then
hString = WindowsDeleteString(hString)
If GetActivationFactory(WindowsMediaCoreVideoStreamDescriptor, pIID(eIVideoStreamDescriptorFactory), lpIVideoStreamDescriptorFactory) Then
InvokePtr lpIVideoStreamDescriptorFactory, IVideoStreamDescriptorFactory_Create, lpIVideoEncodingProperties, VarPtr(m_lpIVideoStreamDescriptor)
End If
ReleasePtr lpIVideoStreamDescriptorFactory
End If
ReleasePtr lpIVideoEncodingProperties
End If
ReleasePtr lpIMediaEncodingSubtypesStatics
End If
ReleasePtr lpIVideoEncodingPropertiesStatics
End If
End Sub
Private Sub SetupMediaStreamSource()
Dim lpIMediaStreamSourceFactory As Long
If GetActivationFactory(WindowsMediaCoreMediaStreamSource, pIID(eIMediaStreamSourceFactory), lpIMediaStreamSourceFactory) Then
If InvokePtr(lpIMediaStreamSourceFactory, IMediaStreamSourceFactory_CreateFromDescriptor, m_lpIVideoStreamDescriptor, VarPtr(m_lpIMediaStreamSource)) = S_OK Then
End If
ReleasePtr lpIMediaStreamSourceFactory
End If
End Sub
Here's a very small working project outlining the snippet above: Attachment 191294, if anyone would take a look I would appreciate it very much!
You have type error. If you see MediaStreamSource constructor it accepts IMediaStreamDescriptor whereas you pass IVideoStreamDescriptor. You should do something like this:
Code:Private Sub SetupMediaStreamSource()
Dim lpIMediaStreamSourceFactory As Long
Dim lpIMediaStreamDescriptor As Long
If InvokePtr(m_lpIVideoStreamDescriptor, IUnknown_QueryInterface, pIID(eIMediaStreamDescriptor), VarPtr(lpIMediaStreamDescriptor)) >= S_OK Then
If GetActivationFactory(WindowsMediaCoreMediaStreamSource, pIID(eIMediaStreamSourceFactory), lpIMediaStreamSourceFactory) Then
If InvokePtr(lpIMediaStreamSourceFactory, IMediaStreamSourceFactory_CreateFromDescriptor, lpIMediaStreamDescriptor, VarPtr(m_lpIMediaStreamSource)) = S_OK Then
End If
ReleasePtr lpIMediaStreamSourceFactory
End If
ReleasePtr lpIMediaStreamDescriptor
End If
End Sub
You know, that was literally the second thing I've tried and querying "IVideoStreamDescriptor" for "IMediaStreamDescriptor" always returned "80004002, No such interface supported"...
Now that you've mentioned it, I've double checked everything again and it seems I was missing the curly braces around the declaration of the "IMediaStreamDescriptor" IID:
A lot of silly mistakes like this can happen when copy-pasting stuff in a hurry and a fresh pair of eyes can help more than you know. Thanks a lot for your help TheTrick, you rock! :DCode:Private Const IID_IMediaStreamDescriptor As String = "80F16E6E-92F7-451E-97D2-AFD80742DA70"
Private Const IID_IMediaStreamDescriptor As String = "{80F16E6E-92F7-451E-97D2-AFD80742DA70}"
* Note to self: "IIDFromString" has a return value, USE IT! :bigyello:
Code:lRet = IIDFromString(...)
Debug.Assert lRet = S_OK
Alright, it took some time, on and off, but it's finally done: VB6 - Screen Capture to Video
That C# tutorial was choke full of "Await" instructions, await this, await that and then await some more! That asynchronous behavior was a pain to replicate in VB6, more so than hunting IIDs and VTable offsets in the SDK files...
Thanks again TheTrick for getting me on the right track! :)
Bad link. :( <---- Ahhh, it's working now.
And the new Windows 11 screen capture will do videos. But it seems to be fixed at 30Hz framerate, which is a bit slow.