Bienvenue, Invité. Merci de vous connecter ou de vous inscrire. Avez-vous oublié d'activer ?

Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.


Sujets - Canadadry

Pages: [1]
1
Général / [mac] Erreur de linkage avec libobjc
« le: Juillet 28, 2013, 11:48:34 am »
Bonjour,

J'essai d'utiliser la SFML dans un projet cmake et j'obtiens l'erreur suivante : Symbol not found: _OBJC_CLASS_$_NSObject
J'ai installé la sfml à l'emplacement par défaut et j'ai juste ajouté target_link_libraries(${PROJECT_NAME} sfml-system) dans mon CMakeList.txt j'ai jeté un oeil au findSFML.cmake mais il n'y a rien de lié à mac donc je suis un peu perdu.

Merci d'avance,

Canadadry

2
Graphique / [résolue][sfml2][ms2010] Bug quand la font n'est pas trouvée.
« le: Février 21, 2013, 11:07:56 am »
Bonjour,
    J’essaie de charger et d'afficher une font avec la sfml 2 sous visual 2010.  J'utilise la RC et quand je charge une font et qu'il ne la trouve pas le programme plante violemment en affichant n'importe quoi dans la console.
Voici mon code minimal :
int main(int argc, char** argv)
{
        sf::Font m_font;m_font.loadFromFile("arial.ttf");
        return 0;
}
 

est-ce que quelqu'un a déjà eu le problème ?
Merci d'avance.


Edit :
En fait le problème est pire que ça car j'arrive à ouvrir le fichier avec fopen ce qui veut dire que le fichier spécifié existe bien et que le chemin que je donne est bon.

J'ai un autre problème qui est peut-être lié. Le titre de ma fenêtre affiche "D^?" alors que je lui demande "Asteroid".

[attachment deleted by admin]

3
Graphique / [sfml2][osx] Dépendance a X11
« le: Février 07, 2013, 07:34:34 pm »
Bonjour,
  Y a-t-il moyen de couper la dépendance de la SFML à X11 sachant que X11 n'est plus livré sur les dernières versions d'OSX (car déprécié)  et que la dépendance est juste freetype.
   Pour livrer mon programme sur d'autre mac je n'ai pas trouvé d'autre moyen que d'installer X11. Ce que je trouve loin d'être génial a faire pour l'utilisateur final.

Merci.

4
Graphique / [sfml2][osx]bug d'affichage avec des renderTexture
« le: Février 06, 2013, 09:59:21 pm »
Bonjour,

J'ai essayé d'ajouter une renderTexture dans mon programme. Mais elle a l'air de corrompre mes textures quand je la crée.

Voila mon code minimal fonctionnel :
#include <iostream>
#include <map>
#include <memory>
#include <cmath>

#include <SFML/Graphics.hpp>

int screen_width = 32;
int screen_height = 24;
int tile_size = 16;

std::string path = "img";

int main(int argc, char** argv)
{

        printf("build time %s\n",__TIME__);

        path = argv[0];
        path = path.substr(0,path.rfind("/"));
        path = path.substr(0,path.rfind("/"));
        path += "/Resources";

        sf::RenderWindow window(sf::VideoMode(screen_width*tile_size, screen_height*tile_size), "TileGame",sf::Style::Titlebar | sf::Style::Close);
        window.setVerticalSyncEnabled(true);
        window.setKeyRepeatEnabled(false);

        sf::RenderTexture textue;
//      textue.create(screen_width*tile_size, screen_height*tile_size,false);

        sf::Texture* m_texture = new sf::Texture;
        m_texture->loadFromFile(path+"/title.png");
        sf::Sprite      m_sprite;
        m_sprite.setTexture(*m_texture);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                        {
                                window.close();
                        }
                }

                window.setActive(true);
                window.clear(sf::Color::Black);
                window.draw(m_sprite);
                window.display();


        }

        return 0;
}
 

Si je dé commente le create plus rien ne s'affiche.
Si joint des screenshots de mon programme. Une quand tout fonctionne, et l'autre avec le renderTexture.
http://img842.imageshack.us/img842/6592/capturedcran20130206214.png
http://img109.imageshack.us/img109/6592/capturedcran20130206214.png

Si vous avez une idée,
Merci.

5
Discussions générales / SFML 2 et Qt5 sur Windows
« le: Décembre 30, 2012, 12:52:37 pm »
Salut,

   Depuis quelques semaines Qt5 est sortie. J'ai un peu joué avec, et j'ai essayé OpenGL dans Qt5. Malheureusement je n'ai pas réussie a utiliser OpenGL en appelant directement ses fonctions. J'ai seulement réussi à utiliser OpenGL en passant par les classes Qt comme dans les exemples qu'ils donnent. Après quelques recherches, je suis tombé sur l'explication : Comment Qt5 gère OpenGL sur Windows.

Pour résumer : Ils ne veulent plus s’embêter avec l'implémentation hasardeuse d'OpenGL sur winows, notamment les problèmes de drivers, de version resté en 1.1. Ils ont observé que les navigateurs fournissant WebGL ne se préoccupais pas de tout ça. Ça marche en sortant de la boite. Ils ont trouvé qu'ils utilisaient ANGLE, une librairie fournissant de l'OpenGL ES 2 par dessus DirectX 9.0c.

Ma question est : Qu'est-ce qu'on peut faire pour faire marcher la SFML 2 avec Qt5 sur Windows.
Je vois deux solutions :
Ne rien faire et laisser les gens recompiler Qt pour utiliser de l'OpenGL classique au lieu d'ANGLE.
Porter la SFML 2 sur OpenGL 2 et linker à ANGLER au lieu de la Dll OpenGL.

Qu'en pensez vous?

J'ai aussi ouvert un topic sur le forum anglais. => http://en.sfml-dev.org/forums/index.php?topic=10134.new#new



6
Graphique / [sfml2] Utilisation vertexArray
« le: Décembre 06, 2012, 11:53:56 pm »
bonjour,

J’essaie d'utiliser la nouvelle architecture graphique. Mais je n'arrive pas a afficher une image à la main avec la class vertexArray. Voila mon code :
#include <iostream>
#include <SFML/Graphics.hpp>

int main(int argc, char** argv)
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");

    sf::Texture tileset;
    tileset.loadFromFile("tmw_desert_spacing.png");
    sf::Sprite  sprite(tileset);
    sprite.setOrigin(tileset.getSize().x,0);
    sprite.setPosition(800,0);

    sf::VertexArray m_vertex_array(sf::Quads,4);
        m_vertex_array[0].position = sf::Vector2f(0,0);
        m_vertex_array[1].position = sf::Vector2f(0,100);
        m_vertex_array[2].position = sf::Vector2f(100,100);
        m_vertex_array[3].position = sf::Vector2f(100,0);

    m_vertex_array[0].texCoords = sf::Vector2f(0, 0);
    m_vertex_array[1].texCoords = sf::Vector2f(0, 1);
    m_vertex_array[2].texCoords = sf::Vector2f(1, 1);
    m_vertex_array[3].texCoords = sf::Vector2f(1, 0);

    sf::RenderStates renderStates;
    renderStates.texture = &tileset;


    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
            else if(event.type == sf::Event::KeyPressed)
                window.close();
        }

        window.clear(sf::Color::Green);
        window.draw(sprite);
        window.draw(m_vertex_array, renderStates);
        window.display();

    }

    return 0;
}
 

La sprite s'affiche bien mais le vertexarray affiche un beau carré noir. Qu'est-ce que j'ai loupé ?
Merci  :)

7
Général / [Résolue][mac][sfml2] Impossible de compiler le module audio
« le: Septembre 30, 2012, 10:53:37 am »
Bonjour,

  J’essaie de compiler la dernière version de la sfml2 en utilisant les paramètre par défaut de cmake avec un makefile unix et j'ai des erreurs lors de la compilation du module audio.

[ 95%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundBufferRecorder.cpp.o
[ 96%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundFile.cpp.o
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:199:48: error: use of undeclared identifier 'SF_FORMAT_OGG'
    fileInfos.format     = format | (format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16);
                                               ^
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:199:64: error: use of undeclared identifier 'SF_FORMAT_VORBIS'
    fileInfos.format     = format | (format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16);
                                                               ^
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:266:27: error: use of undeclared identifier 'SF_FORMAT_VORBIS'
    if (fileInfo.format & SF_FORMAT_VORBIS)
                          ^
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:302:41: error: use of undeclared identifier 'SF_FORMAT_WVE'
    if (toLower(ext) == "wve"  ) return SF_FORMAT_WVE;
                                        ^
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:303:41: error: use of undeclared identifier 'SF_FORMAT_OGG'
    if (toLower(ext) == "ogg"  ) return SF_FORMAT_OGG;
                                        ^
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:304:41: error: use of undeclared identifier 'SF_FORMAT_MPC2K'
    if (toLower(ext) == "mpc2k") return SF_FORMAT_MPC2K;
                                        ^
/Users/Canadadry/Downloads/LaurentGomila-SFML-6e81dab/src/SFML/Audio/SoundFile.cpp:305:41: error: use of undeclared identifier 'SF_FORMAT_RF64'; did you mean 'SF_FORMAT_W64'?
    if (toLower(ext) == "rf64" ) return SF_FORMAT_RF64;
                                        ^~~~~~~~~~~~~~
                                        SF_FORMAT_W64
/Library/Frameworks/sndfile.framework/Headers/sndfile.h:67:2: note: 'SF_FORMAT_W64' declared here
        SF_FORMAT_W64                   = 0x0B0000,             /* Sonic Foundry's 64 bit RIFF/WAV */
        ^
7 errors generated.
make[2]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundFile.cpp.o] Error 1
make[1]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/all] Error 2
make: *** [all] Error 2

Merci.  :)

8
Graphique / [Résolu] Créer un contexte openGL partagé à la main.
« le: Juillet 16, 2012, 03:57:47 pm »
Bonjour,

Je souhaite avoir une classe de création de context opengl maison. Je me suis fortement inspiré de ta classe Laurent pour ne pas dire que j'ai tout pris. ^^.
Voilà le code de ma classe.
//hpp
#ifndef GLCONTEXT_H
#define GLCONTEXT_H

#include <windows.h>

struct GLContextSettings
{
    explicit GLContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) :
    DepthBits        (depth),
    StencilBits      (stencil),
    AntialiasingLevel(antialiasing),
    MajorVersion     (major),
    MinorVersion     (minor)
    {
    }
    unsigned int DepthBits;
    unsigned int StencilBits;
    unsigned int AntialiasingLevel;
    unsigned int MajorVersion;
    unsigned int MinorVersion;
};

class GLContext
{
public:
    GLContext(GLContext* shared, const GLContextSettings& settings);
    virtual ~GLContext();
    const GLContextSettings& getSettings() const;
    bool isValid() const;
    bool MakeCurrent();

    static GLContext* getCurrentGLContext();


private:
    GLContext();
    void createContext(GLContext* shared, unsigned int bitsPerPixel, const GLContextSettings& settings);
    static int EvaluateFormat(unsigned int bitsPerPixel, const GLContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing);

    static GLContext* m_staticCurrentContext;
    HWND              m_window;
    HDC               m_deviceContext;
    HGLRC             m_context;
    GLContextSettings m_settings;
};

#endif // GLCONTEXT_H

#include "glcontext.h"

#include <windows.h>
#include <GL/gl.h>

#include "glext/wglext.h"
#include <cstdio>
#include <cmath>

#define ABS(x) ((x)>0)?(x):(-(x))

GLContext* GLContext::m_staticCurrentContext = NULL;

GLContext::GLContext()
: m_window(NULL)
, m_deviceContext(NULL)
, m_context(NULL)
, m_settings()
{
}

GLContext::GLContext(GLContext* shared, const GLContextSettings& settings)
: m_window(NULL)
, m_deviceContext(NULL)
, m_context(NULL)
, m_settings()
{

    // if constext isn't valid we create a dummy window
    if(shared != NULL)
    {
        m_deviceContext = shared->m_deviceContext;
    }
    if(m_deviceContext == NULL)
    {
        // Creating a dummy window is mandatory: we could create a memory DC but then
        // its pixel format wouldn't match the regular contexts' format, and thus
        // wglShareLists would always fail. Too bad...
        m_window = CreateWindowA("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL);
        ShowWindow(m_window, SW_HIDE);
        m_deviceContext = GetDC(m_window);
    }
// Create the context
    if (m_deviceContext)
        createContext(shared,32,settings);
}

GLContext::~GLContext()
{
    if (m_context)
    {
        if (wglGetCurrentContext() == m_context) wglMakeCurrent(NULL, NULL);
        wglDeleteContext(m_context);
    }

    // if we own a window we also own his DC
    if (m_window)
    {
        ReleaseDC(m_window, m_deviceContext);
        DestroyWindow(m_window);
    }
}

bool GLContext::MakeCurrent()
{
     return m_deviceContext && m_context && wglMakeCurrent(m_deviceContext, m_context);
}

const GLContextSettings& GLContext::getSettings() const
{
    return m_settings;
}

bool GLContext::isValid() const
{
    return (m_deviceContext != NULL) && (m_context != NULL);
}

GLContext* GLContext::getCurrentGLContext()
{
    if(m_staticCurrentContext == NULL) m_staticCurrentContext = new GLContext();


    PIXELFORMATDESCRIPTOR  descriptor;

    int  iPixelFormat = GetPixelFormat(m_staticCurrentContext->m_deviceContext );
    DescribePixelFormat(m_staticCurrentContext->m_deviceContext, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &descriptor);
    m_staticCurrentContext->m_deviceContext              = wglGetCurrentDC();
    m_staticCurrentContext->m_context                    = wglGetCurrentContext();
    m_staticCurrentContext->m_settings.DepthBits         = descriptor.cDepthBits;
    m_staticCurrentContext->m_settings.StencilBits       = descriptor.cStencilBits;
    // TODO : use wglgetpixelformatattribivarb to retreive antialiasing level
    m_staticCurrentContext->m_settings.AntialiasingLevel = 0;
    // TODO : look at wglCreateContextAttribsARB to retreive openGL version
    m_staticCurrentContext->m_settings.MajorVersion      = 2;
    m_staticCurrentContext->m_settings.MinorVersion      = 0;

    return m_staticCurrentContext;
}

void GLContext::createContext(GLContext* shared, unsigned int bitsPerPixel, const GLContextSettings& settings)
{

    // Save the creation settings
    m_settings = settings;

    // Let's find a suitable pixel format -- first try with antialiasing
    int bestFormat = 0;
    if (m_settings.AntialiasingLevel > 0)
    {
        // Get the wglChoosePixelFormatARB function (it is an extension)
        PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB"));
        if (wglChoosePixelFormatARB)
        {
            // Define the basic attributes we want for our window
            int intAttributes[] =
            {
                WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
                        WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
                        WGL_ACCELERATION_ARB,   WGL_FULL_ACCELERATION_ARB,
                        WGL_DOUBLE_BUFFER_ARB,  GL_TRUE,
                WGL_SAMPLE_BUFFERS_ARB, (m_settings.AntialiasingLevel ? GL_TRUE : GL_FALSE),
                        WGL_SAMPLES_ARB,        m_settings.AntialiasingLevel,
                        0,                      0
            };

            // Let's check how many formats are supporting our requirements
            int   formats[128];
                UINT  nbFormats;
                float floatAttributes[] = {0, 0};
                bool  isValid = wglChoosePixelFormatARB(m_deviceContext, intAttributes, floatAttributes, sizeof(formats) / sizeof(*formats), formats, &nbFormats) != 0;
            while ((!isValid || (nbFormats == 0)) && m_settings.AntialiasingLevel > 0)
            {
                // Decrease the antialiasing level until we find a valid one
                m_settings.AntialiasingLevel--;
                intAttributes[11] = m_settings.AntialiasingLevel;
                isValid = wglChoosePixelFormatARB(m_deviceContext, intAttributes, floatAttributes, sizeof(formats) / sizeof(*formats), formats, &nbFormats) != 0;
            }

            // Get the best format among the returned ones
            if (isValid && (nbFormats > 0))
            {
                int bestScore = 0xFFFF;
                for (UINT i = 0; i < nbFormats; ++i)
                {
                    // Get the current format's attributes
                    PIXELFORMATDESCRIPTOR attributes;
                    attributes.nSize    = sizeof(attributes);
                    attributes.nVersion = 1;
                    DescribePixelFormat(m_deviceContext, formats[i], sizeof(attributes), &attributes);

                    // Evaluate the current configuration
                    int color = attributes.cRedBits + attributes.cGreenBits + attributes.cBlueBits + attributes.cAlphaBits;
                    int score = EvaluateFormat(bitsPerPixel, m_settings, color, attributes.cDepthBits, attributes.cStencilBits, m_settings.AntialiasingLevel);

                    // Keep it if it's better than the current best
                    if (score < bestScore)
                    {
                        bestScore  = score;
                        bestFormat = formats[i];
                    }
                }
            }
        }
        else
        {
            // wglChoosePixelFormatARB not supported ; disabling antialiasing
            printf("Antialiasing is not supported ; it will be disabled\n");
            m_settings.AntialiasingLevel = 0;
        }
    }

    // Find a pixel format with no antialiasing, if not needed or not supported
    if (bestFormat == 0)
    {
        // Setup a pixel format descriptor from the rendering settings
        PIXELFORMATDESCRIPTOR descriptor;
        ZeroMemory(&descriptor, sizeof(descriptor));
        descriptor.nSize        = sizeof(descriptor);
        descriptor.nVersion     = 1;
        descriptor.iLayerType   = PFD_MAIN_PLANE;
        descriptor.dwFlags      = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
        descriptor.iPixelType   = PFD_TYPE_RGBA;
        descriptor.cColorBits   = static_cast<BYTE>(bitsPerPixel);
        descriptor.cDepthBits   = static_cast<BYTE>(m_settings.DepthBits);
        descriptor.cStencilBits = static_cast<BYTE>(m_settings.StencilBits);
        descriptor.cAlphaBits   = bitsPerPixel == 32 ? 8 : 0;

        // Get the pixel format that best matches our requirements
        bestFormat = ChoosePixelFormat(m_deviceContext, &descriptor);
        if (bestFormat == 0)
        {
            printf("Failed to find a suitable pixel format for device context -- cannot create OpenGL context\n");
            return;
        }
    }

    // Extract the depth and stencil bits from the chosen format
    PIXELFORMATDESCRIPTOR actualFormat;
    actualFormat.nSize    = sizeof(actualFormat);
    actualFormat.nVersion = 1;
    DescribePixelFormat(m_deviceContext, bestFormat, sizeof(actualFormat), &actualFormat);
    m_settings.DepthBits   = actualFormat.cDepthBits;
    m_settings.StencilBits = actualFormat.cStencilBits;

    // Set the chosen pixel format
    if (!SetPixelFormat(m_deviceContext, bestFormat, &actualFormat))
    {
        printf("Failed to set pixel format for device context -- cannot create OpenGL context\n");
        return;
    }

    // Get the context to share display lists with
    HGLRC sharedContext = shared ? shared->m_context : NULL;

    // Create the OpenGL context -- first try context versions >= 3.0 if it is requested (they require special code)
    while (!m_context && (m_settings.MajorVersion >= 3))
    {
        PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = reinterpret_cast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribsARB"));
        if (wglCreateContextAttribsARB)
        {
            int attributes[] =
            {
                WGL_CONTEXT_MAJOR_VERSION_ARB, m_settings.MajorVersion,
                WGL_CONTEXT_MINOR_VERSION_ARB, m_settings.MinorVersion,
                WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
                0, 0
            };
            m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, attributes);
        }

        // If we couldn't create the context, lower the version number and try again -- stop at 3.0
        // Invalid version numbers will be generated by this algorithm (like 3.9), but we really don't care
        if (!m_context)
        {
            if (m_settings.MinorVersion > 0)
            {
                // If the minor version is not 0, we decrease it and try again
                m_settings.MinorVersion--;
            }
            else
            {
                // If the minor version is 0, we decrease the major version
                m_settings.MajorVersion--;
                m_settings.MinorVersion = 9;
            }
        }
    }

    // If the OpenGL >= 3.0 context failed or if we don't want one, create a regular OpenGL 1.x/2.x context
    if (!m_context)
    {
        // set the context version to 2.0 (arbitrary)
        m_settings.MajorVersion = 2;
        m_settings.MinorVersion = 0;

        m_context = wglCreateContext(m_deviceContext);
        if (!m_context)
        {
            printf("Failed to create an OpenGL context for this window\n");
            return;
        }

        // Share this context with others
        if (sharedContext)
        {
            // WARNING : wglShareLists doesn't seem to be thread-saf
            if (!wglShareLists(sharedContext, m_context))
                printf("Failed to share the OpenGL context\n");
        }
    }
}

int GLContext::EvaluateFormat(unsigned int bitsPerPixel, const GLContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing)
{
    return ABS(static_cast<int>(bitsPerPixel               - colorBits))   +
           ABS(static_cast<int>(settings.DepthBits         - depthBits))   +
           ABS(static_cast<int>(settings.StencilBits       - stencilBits)) +
           ABS(static_cast<int>(settings.AntialiasingLevel - antialiasing));
}

//cpp
 

J'arrive à créer des contextes depuis rien, à en partager, mais si j'essaie d'en créer un partagé avec un fenetre SFML j'ai une erreur lors du SetPixelFormat.  Je test avec ce code :
int main(int argc, char** argv)
{
    sf::RenderWindow App(sf::VideoMode(800, 600), "DEMO_MDE");
    //GLContext context(NULL,GLContextSettings());
    GLContext context2(GLContext::getCurrentGLContext(),GLContextSettings());
    printf("active other context : %d\n",context.MakeCurrent());
    printf("active other context : %d\n",context2.MakeCurrent());
}
 

Mais si je décommente la ligne deux et que je commente la première je n'ai plus d'erreur.  Je ne comprends pas vraiment ce qu'il se passe. Si quelqu'un avait une idée.

Merci d'avance.

9
Réseau / [sfml2][mac] Impossible d'utiliser la class TcpSelector
« le: Juin 24, 2012, 02:49:48 pm »
Bonjour,

   Je reçois un signal EXC_BAD_ACCESS lorsque j'essaie d'ajouter une socket a une instance de TcpSelector. voici le code complet reproduisant le bug : 

#include <SFML/Network.hpp>

int main(int argc, char **argv)
{
    sf::TcpListener listener;
    sf::SocketSelector selector;
    selector.add(listener);

    return 0;
}

je l'ai compilé avec cette ligne de commande :

g++ Main.cpp -o main -I ../../lib_C/SFML2/include -L ../../lib_C/SFML2/lib -lsfml-network-s -lsfml-system-s -g

Et voilà ce que me dis gdb lorsque je m'en sers :

gdb main
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done

(gdb) run
Starting program: main
Reading symbols for shared libraries ++......................... done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00000001000020b5 in sf::SocketSelector::add ()
 

Je vous joint le binaire. Je tourne sur mac avec lion. J'ai récupéré une version récente de la sfml version c4c2c77.

Merci de m'avoir lu.

[attachment deleted by admin]

Pages: [1]