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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - PhiLLe

Pages: [1]
Python / pysfml2-cython building problems
« on: May 16, 2011, 10:21:15 pm »

I have some problems with building pysfml2-cython with mingw32 on windows. I am using Python27.

My building log (--compiler=mingw32 is default):
Code: [Select]
C:\Users\Philipp\Documents\C++\pysfml2-cython>python setup.py build_ext --inplac
running build_ext
cythoning sf.pyx to sf.cpp
building 'sf' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Program Files\CodeBlocks\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\Py
thon27\include -Ic:\Python27\PC -c sf.cpp -o build\temp.win32-2.7\Release\sf.o
sf.cpp: In function 'PyObject* __pyx_pf_2sf_11SoundBuffer_7samples___get__(PyObj
sf.cpp:7838: warning: comparison between signed and unsigned integer expressions

sf.cpp: In function 'void __Pyx_RaiseArgtupleInvalid(const char*, int, Py_ssize_
t, Py_ssize_t, Py_ssize_t)':
sf.cpp:38407: warning: unknown conversion type character 'z' in format
sf.cpp:38407: warning: format '%s' expects type 'char*', but argument 5 has type
sf.cpp:38407: warning: unknown conversion type character 'z' in format
sf.cpp:38407: warning: too many arguments for format
sf.cpp: In function 'void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t)':
sf.cpp:38625: warning: unknown conversion type character 'z' in format
sf.cpp:38625: warning: format '%s' expects type 'char*', but argument 3 has type
sf.cpp:38625: warning: too many arguments for format
sf.cpp: In function 'void __Pyx_RaiseTooManyValuesError(Py_ssize_t)':
sf.cpp:38633: warning: unknown conversion type character 'z' in format
sf.cpp:38633: warning: too many arguments for format
sf.cpp: In function 'PyObject* __pyx_pf_2sf_5Image_14get_tex_coords(PyObject*, P
sf.cpp:15063: warning: '__pyx_v_p' is used uninitialized in this function
writing build\temp.win32-2.7\Release\sf.def

All this should be okay even there are some warnings. But then:
Code: [Select]
C:\Program Files\CodeBlocks\MinGW\bin\g++.exe -mno-cygwin -mdll -static --entry
_DllMain@12 --output-lib build\temp.win32-2.7\Release\libsf.a --def build\temp.w
in32-2.7\Release\sf.def -s build\temp.win32-2.7\Release\sf.o -Lc:\Python27\libs
-Lc:\Python27\PCbuild -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system -
lpython27 -lmsvcr90 -o C:\Users\Philipp\Documents\C++\pysfml2-cython\sf.pyd
g++: build\temp.win32-2.7\Release\libsf.a: No such file or directory
error: command 'g++' failed with exit status 1

I don't get this. Shouldn't it build a file called libsf.a?

Can somebody help?

Graphics / Crazy bug using OpenGL lighting and RenderWindow
« on: May 12, 2011, 10:10:19 pm »
After I tried a lot to solve it I decided to show this to you guys.

I am pretty sure the code should be correct this way.
Sorry, but it can't be smaller:
Code: [Select]
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

int main()
    sf::Clock clock;
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML + OpenGL", sf::Style::Default, sf::ContextSettings(32));


    gluPerspective(70.f, App.GetWidth() / App.GetHeight(), 1.f, 600.f);


    GLfloat light_ambient[] = {0.0, 0.0, 0.0, 1.0};
    GLfloat light_diffuse[] = {1.0, 1.0, 1.0, 1.0};
    GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0};
    GLfloat light_position[] = {0.0, 0.0, 1.0, 0.0};

    glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    float red[] = {102.f/255.f, 51.f/255.f, 51.f/255.f};
    float blue[] = {51.f/255.f, 51.f/255.f, 102.f/255.f};
    float green[] = {51.f/255.f, 102.f/255.f, 51.f/255.f};

    while (App.IsOpened())
        sf::Event Event;
        while (App.PollEvent(Event))
            if (Event.Type == sf::Event::Closed)

            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);

        App.Clear(sf::Color(0, 0, 0, 1));


        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
        glRotatef(clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
        glRotatef(clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

        // Draw a cube

            glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
            glColor3f(1.f, 0.f, 0.f);
            glNormal3f(0.f, 0.f, -1.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f( 50.f,  50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);

            glColor3f(1.f, 0.f, 0.f);
            glNormal3f(0.f, 0.f, 1.f);
            glVertex3f(-50.f, -50.f, 50.f);
            glVertex3f( 50.f,  -50.f, 50.f);
            glVertex3f( 50.f,  50.f, 50.f);
            glVertex3f(-50.f,  50.f, 50.f);

            glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
            glColor3f(0.f, 1.f, 0.f);
            glNormal3f(-1.f, 0.f, 0.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f(-50.f,  50.f,  50.f);
            glVertex3f(-50.f, -50.f,  50.f);

            glColor3f(0.f, 1.f, 0.f);
            glNormal3f(1.f, 0.f, 0.f);
            glVertex3f(50.f, -50.f, -50.f);
            glVertex3f(50.f, -50.f,  50.f);
            glVertex3f(50.f,  50.f,  50.f);
            glVertex3f(50.f,  50.f, -50.f);

            glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
            glColor3f(0.f, 0.f, 1.f);
            glNormal3f(0.f, -1.f, 0.f);
            glVertex3f(-50.f, -50.f,  50.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f,  50.f);

            glColor3f(0.f, 1.f, 0.f);
            glNormal3f(0.f, 1.f, 0.f);
            glVertex3f(-50.f, 50.f,  50.f);
            glVertex3f(-50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f,  50.f);


    return EXIT_SUCCESS;

The bug is:
The two red quads don't show up.

This only happens when:
- you use lighting
- you use sf::RenderWindow instead of sf::Window (I wanted to display text, so I had to change to RenderWindow)

Crazy thing about it:
- When you change it to this the blue quads won't show up:
Code: [Select]
float blue[] = {51.f/255.f, 51.f/255.f, 102.f/255.f};
float red[] = {102.f/255.f, 51.f/255.f, 51.f/255.f};
float green[] = {51.f/255.f, 102.f/255.f, 51.f/255.f};

I am using SFML2 and CodeBlocks + MinGW.

Any ideas?

General / Problems with linking SFML2 static
« on: May 08, 2011, 09:18:17 pm »
Hey. I have some problems linking a test .cpp against the static sfml2 libraray with codeblocks.

Code: [Select]
// No comments on the code please xD
#include <SFML/System.hpp>

int main ()
    sf::Clock clock;
    return clock.GetElapsedTime();

I build the SFML2 Lib static and dynamic without any errors with cmake and the mingw32 makefile.

When I link against "libsfml-system-s.a" there is this error:
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN2sf5ClockC1Ev'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZNK2sf5Clock14GetElapsedTimeEv'|
||=== Build finished: 2 errors, 0 warnings ===|

When I link against "libsfml-system.a" there is no error. Also the examples work when they are created with the static library. Whats up with that?

General / Question about "make all"
« on: April 30, 2011, 04:35:02 pm »
Is there a reason why "make all" only creates targets that produce a binary?
Wouldn't it be useful to produce the doc target, too?

Window / A way to get sf::Style of an existing window
« on: April 21, 2010, 07:29:11 pm »
Is there a way to get the style of a window that exists?
I want to check if my window is fullscreen and didn't find a function for that purpose in the documentation.

Network / Client managing
« on: February 18, 2010, 06:16:12 pm »

I am writing a little Server application.
My Problem is that the Socket for my client disconnects when I am storing my Socket in a vector and I push back an other object.

Code: [Select]
vector<Player> Clients;

void Accept(void * UserData)
    sf::SocketTCP Listener;
    Player NewClient;

    if (!Listener.Listen(PORT))
        cerr << "Clouldn't Bind to port: " << PORT << endl;

    while (true)
        cout << "New connection. Address: "  << endl;

My player class:
Code: [Select]
class Player {

        sf::SocketTCP Socket;
        sf::IPAddress Address;



So the problem occurs when "Clients.push_back(NewClient);" is called the second time. I don't know why but the Socket "Clients.at(0).Socket" just disconnects.

I hope somebody can help me.

General / [soloved] Linking Problem - Debug Mode - Windows
« on: October 09, 2009, 04:31:23 pm »

I am trying to compile a simple SFML application.
I am working with Visual Studio 2008 Express under Vista.

My steps:
1) Create a console Project
2) Write the code:
Code: [Select]
#include <SFML/Window.hpp>

int main()
    // Create the main window
    sf::Window App(sf::VideoMode(640, 480, 32), "SFML", sf::Style::Close);


    // Start main loop
    while (App.IsOpened())
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
            // Close window : exit
            if (Event.Type == sf::Event::Closed)

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))


    return EXIT_SUCCESS;

3) Compile

I am linking to these libraries:
sfml-system-s-d.lib sfml-window-s-d.lib
sfml-system-s.lib sfml-window-s.lib

Everything works in the Release mode. But there are some warnings when I compile in the Debug mode:
sfml-system-s-d.lib(Platform.obj) : warning LNK4099: PDB "vc90.pdb" wurde nicht mit "..\..\xxx\lib\vc2008\sfml-system-s-d.lib" oder an "xxx\win\Debug\vc90.pdb" gefunden; Objekt wird verknüpft, als ob keine Debuginformationen vorhanden wären.

Its kind of sad that it is in German :(

Well thats only a warning. I can run it without problems. But just one time. When I rebuild it the Program asks for a .dll:

Very Strange...

Can anybody help me?

I solved it! I just had to build sfml by myseld and it worked fine.

Pages: [1]