Giter VIP home page Giter VIP logo

check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Graphics::Capture::IDirect3D11CaptureFramePoolStatics)->Create(*(void**)(&device), static_cast<int32_t>(pixelFormat), numberOfBuffers, impl::bind_in(size), &result)); about win32capturesample HOT 4 CLOSED

rlewkowicz avatar rlewkowicz commented on August 16, 2024
check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Graphics::Capture::IDirect3D11CaptureFramePoolStatics)->Create(*(void**)(&device), static_cast(pixelFormat), numberOfBuffers, impl::bind_in(size), &result));

from win32capturesample.

Comments (4)

robmikh avatar robmikh commented on August 16, 2024

Unfortunately, I'm unable to reproduce the issue. Your code works fine for me, assuming your version of CreateD3DDevice returns a valid IDirect3DDevice. I've modified that part to use robmikh.common:

#include <robmikh.common/d3dHelpers.h>
#include <robmikh.common/direct3d11.interop.h>

namespace util
{
    using namespace robmikh::common::uwp;
}

// ...

auto d3dDevice = util::CreateD3DDevice();
auto device = CreateDirect3DDevice(d3dDevice.as<IDXGIDevice>().get());

// ...

auto framePool = winrt::Direct3D11CaptureFramePool::Create(device, pixelFormat, 2, itemSize);

Do you have a complete minimal repro on GitHub I could look at? I'm assuming the Win32CaptureSample works on the same machine?

from win32capturesample.

rlewkowicz avatar rlewkowicz commented on August 16, 2024

I'm so burned out on this. I'll try to put something together. The problem with your libs is that as a console app, it doesn't compile.

It complains about a whole lot of stuff being undefined. I wanted to put together a main.cpp, without a million header files, that is a very simple start to finish all in one example.

I even tried to build this: https://github.com/microsoft/PowerToys/tree/main/src/modules/MeasureTool/MeasureToolCore via pulling files into my env. I meticulously got intellij to at least not complain. But it wont compile.

What a nightmare. Somehow that project has it use c++ 20, but then core complains about things that got deprecated in 17. It could be that I'm trying to build a console app, but who knows! It's a slog of convoluted examples, none of which represent a simple configuration of its parts. I can't even get to the need or concept of multi threading, because I can't deconstruct these examples into their core parts in any fashion.

Just even trying trying to read code and understand what namespace something comes from. What namespace is iinspectable in, windows foundation of course. How do I know that, chatgpt told me. You wouldn't know that looking here:
https://learn.microsoft.com/en-us/windows/win32/api/inspectable/nn-inspectable-iinspectable

It hallucinates stuff half the time so you get lucky here and there but heaven forbid the actual docs tell you the namespace. I'm sure I could go dig in header files too, but where are those. Again, all over the place!

I am not an ace dev, I get that. But this is the absolute worst developer experience of any language and system I've had in my life.

from win32capturesample.

robmikh avatar robmikh commented on August 16, 2024

I'm not sure what you mean by they don't work in a console app. I have several console apps that use them. If you're trying to use an API without linking the appropriate lib or including the appropriate header, I'm not sure what to tell you.

You're free to ask questions, but adding superfluous rants about other projects you come across isn't helpful.

from win32capturesample.

robmikh avatar robmikh commented on August 16, 2024

Here's a console app that takes a screenshot of the primary monitor using Windows.Graphics.Capture and feeds that image into OpenCV. I'm not familiar with OpenCV, so I used the contours2 demo. You can find the repo here: https://github.com/robmikh/WGCOpenCVInterop

Because I use Visual Studio, I used vcpkg to generate a Nuget package containing the necessary binaries, libs, and headers needed for using OpenCV. There are more details in the README, but you can also replace the Nuget package with whatever way you're used to consuming OpenCV. Additionally I used the header-only library WIL for an RAII wrapper around an event, but feel free to remove that and use your own implementation.

from win32capturesample.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.