Giter Club home page Giter Club logo

Comments (7)

leadedge avatar leadedge commented on September 16, 2024

Texture formats are limited by the GL/DX interop extension. The specifications do not specifically describe DirectX formats other than an example using D3DFMT_A8R8G8B8, so I tried every format possible by trial and error. This is a while back now but the results for 8 bit formats are documented in "SpoutSDK.h". Final supported formats are documented in "SpoutGLDXinterop.cpp". On the OpenGL side the format has to match, so GL_RGBA is used throughout.

from spout2.

leadedge avatar leadedge commented on September 16, 2024

I should add that SendImage supports OpenGL RGBA, BGRA, RGB, and BGR if that is any help.

from spout2.

avilleret avatar avilleret commented on September 16, 2024

I think there should be a way to send grayscale texture, because converting frame at 1280x1024@240fps is annoying :-)

Moreover when I send this texture as a regular colorful texture, I receive some data on the other side but they are taken as a color image and thus wrongly unpack.

So one workaround I see to the DX limitation (if it still exists) is to send grayscale texture as color texture but add some meta data to say the receiver this is a grayscale image and it should process it differently.

I don't know how metada (resolution for instance) are passed to the receiver nor if there is such a communication channel with SPout

from spout2.

leadedge avatar leadedge commented on September 16, 2024

From tests I have made, the GL/DX interop does not support luminance format. The only way is to convert using OpenGL methods and I have thought more about this.

In your case, you need to send image pixels and not a luminance texture. So if you create an rgba texture you should be able to fill it with the luminance image data using glTexSubImage2D .

glBindTexture(GL_TEXTURE_2D, rgbaTexID);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, (GLvoid *)pixels);
glBindTexture(GL_TEXTURE_2D, 0);

Then use SendTexture with the RGBA texture.

If that works, SendImage could be modified to accept GL_LUMINANCE. I am committed to other work at the moment, so can't investigate this right away but will put it on the list.

from spout2.

leadedge avatar leadedge commented on September 16, 2024

Also you might need to add -

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);



glPixelStorei(GL_UNPACK_ALIGNMENT, 4);

from spout2.

avilleret avatar avilleret commented on September 16, 2024

thanks a lot, it works !

from spout2.

leadedge avatar leadedge commented on September 16, 2024

OK. I will look at what is involved to add it to the SendImage function. Meanwhile I will close this as resolved.

from spout2.

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.