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

Author Topic: How to build JSFML  (Read 35340 times)

0 Members and 1 Guest are viewing this topic.

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: How to build JSFML
« Reply #45 on: September 19, 2012, 03:51:04 pm »
Linux now requires the LD_LIBRARY_PATH variable to contain a path to the SFML libs, because the JVM will use that one to find libraries. I guess it's not any worse than the -XstartOnFirstThread that's required on Mac.

I will update the wiki about this soon.
JSFML - The Java binding to SFML.

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: How to build JSFML
« Reply #46 on: October 17, 2012, 07:50:11 pm »
Quote
Add a link to the SFML download page? :P
If you download a game from somewhere, you expect to hit its executable and it runs. You don't expect that you have to download sources and compile another package first and set several environment variables. Maybe everyday Linux users do expect that, I don't know, but IMO it just plain sucks.

So, with all the dependency and version crap, I can't do anything to provide out-of-the-box functionality on "Linux" whatsoever. The only chance that I see is to make it work for the most common distributions. The best candidate I see is Ubuntu. I tested this out-of-the-box feature on Ubuntu and Linux Mint and it worked perfectly. For other distributions, people will have to resort to the LD_LIBRARY_PAH variable. It sucks, but apparently, there's no other way.
JSFML - The Java binding to SFML.

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: How to build JSFML
« Reply #47 on: October 19, 2012, 08:39:11 am »
libGLEW seems to maintain binary compatibility, stressing "binary".
Creating a soft link from libGLEW.so.1.6 to libGLEW.so.1.5 yields no problems whatsoever. I'm not sure how good an approach like this is, but it seems to work out fine.
JSFML - The Java binding to SFML.

kryx

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: How to build JSFML
« Reply #48 on: October 08, 2014, 08:08:31 am »
Hi,

I'm trying recompiling the news source of sfml at master into jsfml. But this seems don't work.

When I compiling, I receive the error:

JSFML-master\src\cpp/JNI/org_jsfml_graphics_SFMLNativeDrawer.cpp(25) : error C2440: 'cast de type' : impossible de convertir de 'jint' en 'sf::BlendMode'
     [exec]         Aucun constructeur n'a pu prendre le type de source, ou la résolution de la surcharge du constructeur était ambiguë
     [exec] JSFML-master\src\cpp/JNI/org_jsfml_graphics_SFMLNativeDrawer.cpp(42) : error C2440: 'cast de type' : impossible de convertir de 'jint' en 'sf::BlendMode'
     [exec]        Aucun constructeur n'a pu prendre le type de source, ou la résolution de la surcharge du constructeur était ambiguë

In fact, BlendMode.h seems to be different in sfml 2.1 and sfml-master. But I need this rebuild in my project because this is a bug in jsfml actually that don't clear properly the renderTexture on some plateforms.

Someone can maybe help me to write the good BlendMode class in java to do a nice compiling for the new sfml sources?

Thanks a lot

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: How to build JSFML
« Reply #49 on: October 08, 2014, 09:35:51 am »
As far as I know, JSFML's master branch is not in sync with SFML's master branch. You have to use SFML 2.1 with JSFML. I think Patrick said he'll update JSFML when SFML 2.2 is released.

BTW, this is reaaally some necromancy you did there.
SFML / OS X developer

kryx

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: How to build JSFML
« Reply #50 on: October 08, 2014, 09:47:17 am »
I know and I understand why you don't follow the sfml-master.

But I really need this changes (it's a primary major bug) and I need to rebuild all the sources. It's done in c++, but I need only the BlendMode.java (if I have understood) to compile in jsfml

in c++, the class BlendMode evolve from:

enum BlendMode
{
    BlendAlpha,    ///< Pixel = Source * Source.a + Dest * (1 - Source.a)
    BlendAdd,      ///< Pixel = Source + Dest
    BlendMultiply, ///< Pixel = Source * Dest
    BlendNone      ///< Pixel = Source
};

to

struct SFML_GRAPHICS_API BlendMode
{

    enum Factor
    {
        Zero,             ///< (0, 0, 0, 0)
        One,              ///< (1, 1, 1, 1)
        SrcColor,         ///< (src.r, src.g, src.b, src.a)
        OneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
        DstColor,         ///< (dst.r, dst.g, dst.b, dst.a)
        OneMinusDstColor, ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
        SrcAlpha,         ///< (src.a, src.a, src.a, src.a)
        OneMinusSrcAlpha, ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
        DstAlpha,         ///< (dst.a, dst.a, dst.a, dst.a)
        OneMinusDstAlpha  ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
    };

    enum Equation
    {
        Add,     ///< Pixel = Src * SrcFactor + Dst * DstFactor
        Subtract ///< Pixel = Src * SrcFactor - Dst * DstFactor
    };

    BlendMode();


    BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation = Add);


    BlendMode(Factor colorSourceFactor, Factor colorDestinationFactor,
              Equation colorBlendEquation, Factor alphaSourceFactor,
              Factor alphaDestinationFactor, Equation alphaBlendEquation);

    ////////////////////////////////////////////////////////////
    // Member Data
    ////////////////////////////////////////////////////////////
    Factor   colorSrcFactor; ///< Source blending factor for the color channels
    Factor   colorDstFactor; ///< Destination blending factor for the color channels
    Equation colorEquation;  ///< Blending equation for the color channels
    Factor   alphaSrcFactor; ///< Source blending factor for the alpha channel
    Factor   alphaDstFactor; ///< Destination blending factor for the alpha channel
    Equation alphaEquation;  ///< Blending equation for the alpha channel
};


SFML_GRAPHICS_API bool operator ==(const BlendMode& left, const BlendMode& right);


SFML_GRAPHICS_API bool operator !=(const BlendMode& left, const BlendMode& right);

SFML_GRAPHICS_API extern const BlendMode BlendAlpha;    ///< Blend source and dest according to dest alpha
SFML_GRAPHICS_API extern const BlendMode BlendAdd;      ///< Add source to dest
SFML_GRAPHICS_API extern const BlendMode BlendMultiply; ///< Multiply source and dest
SFML_GRAPHICS_API extern const BlendMode BlendNone;     ///< Overwrite dest with source

} // namespace sf
 

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: How to build JSFML
« Reply #51 on: October 08, 2014, 09:49:06 am »
You can fork JSFML and update it if you know how jni and cie work (I don't).
SFML / OS X developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: How to build JSFML
« Reply #52 on: October 08, 2014, 07:13:02 pm »
@kryx, if JSFML uses the official CSFML (I don't know if it does) then the hard part is already done, all you would need to do is update JSFML.
« Last Edit: October 08, 2014, 07:37:24 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

kryx

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: How to build JSFML
« Reply #53 on: October 08, 2014, 11:15:58 pm »
mmmh yes, I suppose it to...

I have compile withour error the 2.1 version, so I know that I don't do errors.
But as I don't know what I must change in JSFLM (BlendMode.java?) to work fine, I have applied some majors corrections to my 2.1 version SFML and compile it...

But if you know how to do, I am very interesting by learn it!

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: How to build JSFML
« Reply #54 on: October 14, 2014, 10:30:26 am »
SFML is used directly, not CSFML.
And correct, the master branch is still based on the SFML 2.1 API, but you found this out already. :)

From what it looks (I haven't really looked at any 2.2 API changes yet), the BlendMode enumeration will cease to exist and be replaced by a simple class that represents that struct you posted.

This will have an effect on the central drawing dispatcher: SFMLNativeDrawer. The method signatures will need an update from an integer blend mode ordinal to, probably, two integers: factor and equation ordinals. The respective native code will have to be updated accordingly.

It should not be too much work, really, but I'd like to wait until the 2.2 API is "done", so I can take a week or two and do a quick update of JSFML.
JSFML - The Java binding to SFML.

kryx

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: How to build JSFML
« Reply #55 on: October 14, 2014, 05:55:04 pm »
Thanks a lot!

Now it isn't urgent as I have applied changes in previous version, but I'll take the 2.2 when it arrive :D

I hope that Anti-aliasing on RenderTexture will be implemented... :D (but no link here :D)

Have a nice day!

 

anything