Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Bink video & SFML  (Read 3547 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Bink video & SFML
« on: May 17, 2013, 04:49:07 pm »
Hi

Does anyone here have any experience with the Bink video API from RAD Game Tools?

I've done the code and when I play a video back directly to the window (getting the handle to the window) it works fine. When I try and send the pixel data to an sf::Texture, nothing happens - no garbage, just no data whatsoever.

Bink video fills a buffer with data in a format you can specify. I assumed, for OpenGL, this is GL_RGBA format.

Hope someone has some ideas...I have spent all day on this :(

Thanks
Ed
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bink video & SFML
« Reply #1 on: May 17, 2013, 05:42:53 pm »
Have you tried to replace your video data with green pixels (for example), to find out if it's the decoding process that fails or the upload/display with a sf::Texture?
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Bink video & SFML
« Reply #2 on: May 17, 2013, 06:02:55 pm »
Yes I have, and SFML works fine. When you want to grab the pixel data from Bink, you have to lock the buffer, get the data, then unlock the buffer. Fine.

Problem is, once the buffer is unlocked, the pointer to the frame data is set to 0. So when the texture is updated, you see nothing (as 0 = transparent!).

If you try to do an sf::Texture update before the buffer is unlocked, it doesn't work either.

Bink is used by the biggest names in the games industry.....so I would think it is 100% OK. It must be me misunderstanding things..........but I have no idea what.

Ed
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bink video & SFML
« Reply #3 on: May 17, 2013, 06:13:11 pm »
If the code is not too complicated, maybe you can show the most relevant parts.

Otherwise, I don't know how to help more, since the SFML part is working fine.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Bink video & SFML
« Reply #4 on: May 17, 2013, 07:39:23 pm »
After more testing, I think the problem is related to the video being in BGRA format, and OpenGL wanting RGBA format.

Is there any way to change this? Converting the color space of every video will be a nightmare :S
SFML 2.1

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Bink video & SFML
« Reply #5 on: May 17, 2013, 08:09:48 pm »
If it's really right values in wrong channels you can switch it with glsl easily(fragment shader, one input texture that is set to sf::Shader::CurrentTexture, swizzle the input pixel, done). But why would bink load it like that instead of 'normal' way? Are you sure it's not configurable or something to allow loading normally?
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bink video & SFML
« Reply #6 on: May 17, 2013, 09:08:18 pm »
Quote
But why would bink load it like that instead of 'normal' way?
BGRA is actually more normal than RGBA for OpenGL and graphics cards. But please don't ask why SFML uses RGBA ;)
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Bink video & SFML
« Reply #7 on: May 18, 2013, 08:25:44 pm »
After some emails between myself and RAD Game Tools, it turns out that the way I'd hoped to do things (you know, the nice and simple way, grab a frame of data, and display it) can't be done with the Bink 2D API I was using.

I need to use the 3D API instead :(
SFML 2.1

 

anything