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]
1
Python / pysfml2-cython building problems
« on: May 16, 2011, 10:21:15 pm »
Hi!

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
e
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
ect*)':
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
 'Py_ssize_t'
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
 'Py_ssize_t'
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
yObject*)':
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?

2
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));

    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glClearDepth(1.f);

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

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    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)
                App.Close();

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

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

        //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClear(GL_DEPTH_BUFFER_BIT);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        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
        glBegin(GL_QUADS);

            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);

        glEnd();

        App.Display();
    }
    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?

3
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:
Quote
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?

4
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?

5
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.

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

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:
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)
    {
        Clients.push_back(NewClient);
        Listener.Accept(Clients.back().Socket);
   
        cout << "New connection. Address: "  << endl;
    }
   
    Listener.Close();
}


My player class:
Code: [Select]
class Player {
    public:
       
        ~Player()
        {
            Socket.Close();
        }

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

    private:

};


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.

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

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);

    App.ShowMouseCursor(false);

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

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

        App.Display();
    }

    return EXIT_SUCCESS;
}

3) Compile

I am linking to these libraries:
Debug:
sfml-system-s-d.lib sfml-window-s-d.lib
Release:
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:
Quote
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:
MSVCP90D.dll

Very Strange...

Can anybody help me?
Greetings

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

Pages: [1]
anything