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 - mercurio7891

Pages: [1] 2
1
Window / [OSX] Window.getPosition return wrong coords
« on: November 16, 2012, 05:42:47 am »
In OSX, Window.getPosition() always return the coord (0, 900) despite manually setting or moving the window.

Here is a code example

#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>

int main(int argc, char** argv)
{
    sf::ContextSettings context_settings(16, 0, 0, 3, 1);

    sf::Window window(sf::VideoMode(1024, 768),
        "SFML - OpenGL Test", sf::Style::Default, context_settings);

    window.setPosition(sf::Vector2i(50, 50));

    glClearColor(0.39f, 0.58f, 0.93f, 1.0f);

    bool running = true;

    while (running)
    {
        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                running = false;
            }
            else if (event.type == sf::Event::Resized)
            {
                glViewport(0, 0, event.size.width, event.size.height);
            }
            else if (event.type == sf::Event::KeyPressed)
            {
                if (event.key.code == sf::Keyboard::A)
                {
                    printf("Window Position - %i, %i\n",
                        window.getPosition().x, window.getPosition().y);
                }
            }
        }

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        window.display();
    }

    return EXIT_SUCCESS;
}
 

Pressing the key 'A' always prints the following output:
Window Position - 0, 900
Window Position - 0, 900
 

I am using the build from the source repository.

P.S another side question. I notice that setPosition takes a signed integer. Does it means it can accept negative coords. If it does, how does the negative coord affect window placement? In OSX, if i do setPosition({-50, -50}) the window wrap to the bottom right instead of the top left.

2
General / [OSX] sfml 2.0 RC and opengl 3.2
« on: November 09, 2012, 08:56:12 am »
Following this thread

http://en.sfml-dev.org/forums/index.php?topic=9083.msg61236#msg61236

and after adding the following code to SFContext.mm to the function SFContext::createContext

// Add support for OpenGL 3.2 on Mac OS X Lion and later
    if (settings.majorVersion > 3 || (settings.majorVersion == 3 && settings.minorVersion >= 2)) {
        attrs.push_back(NSOpenGLPFAOpenGLProfile);
        attrs.push_back(NSOpenGLProfileVersion3_2Core);
    } else {
        attrs.push_back(NSOpenGLPFAOpenGLProfile);
        attrs.push_back(NSOpenGLProfileVersionLegacy);
    }

 

It gives the following error upon attempting to create a opengl 3.2 context

2012-11-09 15:42:08.715 sfml-test-d[8498:5503] invalid share context
2012-11-09 15:42:08.717 sfml-test-d[8498:5503] invalid context
Error. Unable to create the context.
Failed to activate the window's context
Failed to activate the window's context
......

My mac does support opengl 3.2 core profile.

3
Graphics / [OS X] Lion and opengl 3
« on: October 29, 2011, 12:18:22 pm »
Hi, just wanted to ask any mac user out there if Lion officially support opengl 3 contexts?

I heard rumors on the web that Lion have supports up till 3.2 contexts.

However I can't seems to create SFML using a 3.[0|1|2] context. It always defaults to a 2.1 context

My hardware does support opengl 3.3 as I have created a 3.3 context in windows using boot camp

regards

4
General / How to link to SFML 2.0 statically
« on: October 26, 2011, 07:20:08 am »
Hi I tried linking the code to the sfml static libs but I am still getting a lot of undefined symbols. Am I forgetting to include any libraries or something?

Code: [Select]

g++ -DSFML_STATIC -c -fmessage-length=0 -DDEBUG -O0 -g3 -gdwarf-2 -I/SDKs/Sfml.sdk/sfml-01254d4/include/ -Wall -Wno-missing-braces main.cpp -o debug/main.o

g++ -DSFML_STATIC -c -fmessage-length=0 -DDEBUG -O0 -g3 -gdwarf-2 -I/SDKs/Sfml.sdk/sfml-01254d4/include/ -Wall -Wno-missing-braces -MM -MP -MT debug/main.o main.cpp -o debug/main.d

g++ -framework OpenGL -framework Cocoa -gdwarf-2  -L/SDKs/Sfml.sdk/sfml-01254d4/lib/ -o debug/sfml-test-d debug/main.o -lsfml-graphics-s -lsfml-window-s -lsfml-system-s

Undefined symbols for architecture x86_64:
  "_LMGetKbdType", referenced from:
      sf::priv::HIDInputManager::LoadKey(__IOHIDElement*)     in libsfml-window-s.a(HIDInputManager.mm.o)
  "_IOHIDElementGetUsagePage", referenced from:
      sf::priv::HIDInputManager::LoadMouse(__IOHIDDevice*)     in libsfml-window-s.a(HIDInputManager.mm.o)
      sf::priv::HIDInputManager::LoadKeyboard(__IOHIDDevice*)      in libsfml-window-s.a(HIDInputManager.mm.o)
  "_TISCopyCurrentKeyboardLayoutInputSource", referenced from:
      sf::priv::HIDInputManager::HIDInputManager()in libsfml-window-s.a(HIDInputManager.mm.o)
  "_kTISPropertyUnicodeKeyLayoutData", referenced from:
      sf::priv::HIDInputManager::HIDInputManager()in libsfml-window-s.a(HIDInputManager.mm.o)
  "_TISGetInputSourceProperty", referenced from:
      sf::priv::HIDInputManager::HIDInputManager()in libsfml-window-s.a(HIDInputManager.mm.o)
  "_IOHIDDeviceGetProperty", referenced from:
      sf::priv::HIDInputManager::GetLocationID(__IOHIDDevice*)      in libsfml-window-s.a(HIDInputManager.mm.o)
  "_IOHIDManagerCreate", referenced from:
      sf::priv::HIDJoystickManager::GetInstance()     in libsfml-window-s.a(HIDJoystickManager.cpp.o)
      sf::priv::HIDJoystickManager::HIDJoystickManager()in libsfml-window-s.a(HIDJoystickManager.cpp.o)
      sf::priv::HIDJoystickManager::HIDJoystickManager()in libsfml-window-s.a(HIDJoystickManager.cpp.o)
      sf::priv::HIDInputManager::HIDInputManager()in libsfml-window-s.a(HIDInputManager.mm.o)

.... and more of it

5
Window / When is the global shared context created??
« on: May 13, 2011, 08:53:27 am »
Hi, does sfml creates a global context for sharing. When is this global context created? Is it created when a sf::Window is created?

e.g

Code: [Select]

On first create of sf::Window
    create shared global context
    create render context and share with the global context


regards

6
Window / sf::RenderWindow opengl version vs glGetString(GL_VERSION)
« on: May 04, 2011, 07:44:13 pm »
hi, in sfml2 on windows, is anyone getting a different version from glGetString(GL_VERSION) versus the one reported back by sf::ContextSettings?

I created a RenderWindow with 2.0 context, but glGetString always report back as version 3.3

I was wondering if this happens only on my machine or is it happening to others too?

regards

7
Window / anyway to set the version sf:Context is created against?
« on: April 30, 2011, 09:19:43 pm »
Is there anyway to set the sf::Context to be created to a specific opengl version?? For e.g 4.0 or maybe 2.1

regards

8
Window / opengl resources and context sharing
« on: April 12, 2011, 12:51:22 pm »
hi, is it possible for resources to be shared?? suppose I have one render context created on thread 1, and in thread 2 I attempt to do a glBindBuffer command etc. would it work??

regards

9
Window / [SFML2][OSX] Create another window after closing the first
« on: March 31, 2011, 09:03:54 pm »
Hi, in OSX for sfml2, how do i create a window, close it, and recreate it again??

I did something like:
Code: [Select]


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
void WindowFunction()
{
    // Create the main window
    sf::ContextSettings Settings;
    Settings.DepthBits         = 24; // Request a 24 bits depth buffer
    Settings.StencilBits       = 8;  // Request a 8 bits stencil buffer
    Settings.AntialiasingLevel = 0;  // Request 2 levels of antialiasing
    Settings.MajorVersion      = 3;
    Settings.MinorVersion      = 3;
    sf::Window App(sf::VideoMode(1024, 768, 32), "SFML OpenGL", sf::Style::Close, Settings);

    Settings = App.GetSettings();

    std::cout << "DepthBits " << Settings.DepthBits << "\n";
    std::cout << "StencilBits " << Settings.StencilBits << "\n";
    std::cout << "Antialiasing Level " << Settings.AntialiasingLevel << "\n";
    std::cout << "Opengl Version " << Settings.MajorVersion << "." << Settings.MinorVersion << "\n";

    // Set color and depth clear value
    glClearDepth(1.f);
    glClearColor(0.176f, 0.196f, 0.667f, 0.0f);

    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);

    // Start game 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();

            // Resize event : adjust viewport
            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);
        }

        // Set the active window before using OpenGL commands
        // It's useless here because active window is always the same,
        // but don't forget it if you use multiple windows or controls
        //App.SetActive(true);

        // Clear color and depth buffer
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Finally, display rendered frame on screen
        App.Display();

        //App.SetActive(false);
    }
}

int main()
{
WindowFunction();

WindowFunction();

return EXIT_SUCCESS;
}


if i press 'esc' to close the first window, it aborts with a seg fault. If I press the 'cross' button at the top left corner of the first window, it aborts with a pure virtual function call error.

regards

10
Window / [SFML 2] Set window focus
« on: March 13, 2011, 05:24:22 am »
hi, is there any way to set the window focus? After creating my window, the window is always not in focus (e.g it doesn't capture key press event), and I have to click on it to set it as the focus.

regards

11
Window / Getting/checking the availability of opengl version
« on: February 13, 2011, 08:10:13 am »
Hi, I was wondering is there anyway to get/check the availability of an opengl version context without having to create a sf::Window??

regards

12
Window / sf::ContextSettings, opengl version hint
« on: January 29, 2011, 04:27:54 pm »
hi, I have a nvidia 8600 which can support opengl 3.3, however no matter what value i put as the value for the major, minor parameters in ContextSettings, it always create a opengl2.0 context instead.

Is there something I am missing out?

regards

13
Window / SFML2 SetActive() Failed to activate window context
« on: January 18, 2011, 12:27:59 pm »
Hi, I create a simple app and in the main loop when i do

App.SetActive(true);

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

App.Display();

App.SetActive(false);

When running, it output on the console "Failed to activate window context". If I comment away App.SetActive(false); everything is normal.

Why is it that calling App.SetActive(false) would produce that error? Is there a change in the proper usage of SetActive() in SFML2.0?

P.S: this problem did not appear in SFML1.6

regards.

14
General discussions / SFML 2.0 cmake installation and VS2010
« on: January 18, 2011, 10:44:57 am »
the code and source compiles fine. However I am having problem with the installation step which moves the files to a specified location as stated in the CMAKE_INSTALL_PREFIX.

after running cmake the VS2010 sln will include a project call "INSTALL" which I assume would install the files to the proper location. However when I compile the project "INSTALL" it gave an error saying "can't find the batch label specified - VCReportError"

Is there something I am missing out?

regards

15
Window / SetPosition and mutex. Anyway inbuilt way to avoid?
« on: January 15, 2011, 06:40:50 am »
Hi, is there anyway inbuilt thread safe flag in sfml which I can specify to allow calls to be thread safe? or do I have to manually wrap every sfml call with a mutex.

for e.g sf::Window::SetPosition which can be access from multiple thread.

Must I have a mutex for every SetPosition call?

regards

Pages: [1] 2
anything