OpenGL i SFML

0

Chciałem włączyć przykładowy kod w moim programie z użyciem OpenGL.

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

int main()
{
    // create the window
    sf::Window window(sf::VideoMode(800, 600), "OpenGL", sf::Style::Default, sf::ContextSettings(32));
    window.setVerticalSyncEnabled(true);

    // load resources, initialize the OpenGL states, ...

    // run the main loop
    bool running = true;
    while (running)
    {
        // handle events
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                // end the program
                running = false;
            }
            else if (event.type == sf::Event::Resized)
            {
                // adjust the viewport when the window is resized
                glViewport(0, 0, event.size.width, event.size.height);
            }
        }

        // clear the buffers
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // draw...

        // end the current frame (internally swaps the front and back buffers)
        window.display();
    }

    // release resources...

    return 0;
}

Jednak program nie kompiluje się.

Error 1 error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
E:\MSVC++2012Express\OpenGLandSFML\OpenGLandSFML\main.obj OpenGLandSFML
Error 2 error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
E:\MSVC++2012Express\OpenGLandSFML\OpenGLandSFML\main.obj OpenGLandSFML
Error 3 error LNK1120: 2 unresolved externals
E:\MSVC++2012Express\OpenGLandSFML\Debug\OpenGLandSFML.exe OpenGLandSFML

Chodzi o błędy linkera, nie wiem po prostu, które biblioteki muszę dołaczyć jeszcze by mi program zadziałał.
Na razie mam te liby i odpowiednie dll:
sfml-graphics.lib
sfml-window.lib
sfml-system.lib

Nie wiem czego jeszcze mi brakuje - może ktoś Wie?

1

Nie wiem czego jeszcze mi brakuje - może ktoś Wie?
Brakuje OpenGL-a!..
standardowo pod VS używa się opengl32.lib, chyba że SFML daje własną libkę.

0

Myślałem, że jak dołącze

#include <SFML/OpenGL.hpp>

Two wszystko potrzebne będe miał ale zapomniałem dolinkować lib.

Jednak teraz występuje błąd przy uruchomieniu aplikacji.
http://i.imgur.com/Zvbj5zG.png

EDIT:
Problemem było to że kiedyś miałem w folderze systemowym SFML pod Ming'wa a teraz miam pod Visual się "kłociły".

1 użytkowników online, w tym zalogowanych: 0, gości: 1