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

Author Topic: [Solved] Any recent (possibly) breaking changes?  (Read 3022 times)

0 Members and 1 Guest are viewing this topic.

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
[Solved] Any recent (possibly) breaking changes?
« on: June 24, 2012, 01:02:12 pm »
I was quite busy lately and didn't have time to touch GWEN.Net code but it seems some recent SFML change broke my rendering completely. SFML 2 rc version from May 9th was working fine, now all my textures appear black. I didn't have time to investigate in depth yet, but textures are loaded fine and appear to be of correct sizes. Maybe some change in the .NET wrapper?

I'm using single texture for the controls skin. When drawing a rectangle I add it to the cache and then flush it with
m_Target.Draw(m_VertexCache, 0, m_CacheSize, PrimitiveType.Quads, m_RenderState);

I'll debug it more thoroughly tomorrow but maybe someone has hints what might be the cause. :)

Edit: I see there was a change to Transform (class->struct). I'm not using it directly anywhere though.

Edit: Problem solved: I didn't have properly initialized RenderState's blend mode. It somehow worked before but stopped now ;)

[attachment deleted by admin]
« Last Edit: June 25, 2012, 11:30:29 am by omeg »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [Solved] Any recent (possibly) breaking changes?
« Reply #1 on: June 26, 2012, 09:09:25 pm »
Quote
I didn't have properly initialized RenderState's blend mode.
To what? By default it should be BlendMode.Alpha; if not, it's a bug.
Laurent Gomila - SFML developer

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
Re: [Solved] Any recent (possibly) breaking changes?
« Reply #2 on: June 29, 2012, 10:31:08 am »
Well, I didn't have the variable initialized at all (no "new m_RenderState") and was just assigning textures to it. Weird that the compiler didn't complain, I guess it's a struct but still. Structs are bitwise zeroed at the start if not explicitly constructed, so that's probably why. You may add a default constructor that sets the blend mode to avoid such bugs I guess.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [Solved] Any recent (possibly) breaking changes?
« Reply #3 on: June 29, 2012, 10:49:49 am »
Quote
You may add a default constructor that sets the blend mode to avoid such bugs I guess.
I'd love to, but structs cannot have a default constructor in C#. You have no choice but to accept the "everything at zero" behaviour that the framework imposes, even if it makes no sense (like in the Transform struct).
Laurent Gomila - SFML developer