SFML/imgui-sfml

Render draw list error

foxy202emb opened this issue · 3 comments

Hello, i start to try using imgui with sfml with codeblocks. when i compile the example code
#include "imgui.h"
#include "imgui-SFML.h"

#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/System/Clock.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/Graphics/CircleShape.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "ImGui + SFML = <3");
window.setFramerateLimit(60);
ImGui::SFML::Init(window);

sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);

sf::Clock deltaClock;
while (window.isOpen()) {
    sf::Event event;
    while (window.pollEvent(event)) {
        ImGui::SFML::ProcessEvent(event);

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

    ImGui::SFML::Update(window, deltaClock.restart());

    ImGui::Begin("Hello, world!");
    ImGui::Button("Look at this pretty button");
    ImGui::End();

    window.clear();
    window.draw(shape);
    ImGui::SFML::Render(window);
    window.display();
}

ImGui::SFML::Shutdown();

}

there are some errors at imgui-SFML.cpp in function 'RenderDrawLists':

imgui project\src\imgui-SFML.cpp|729|undefined reference to __imp_glPushAttrib'| imgui project\src\imgui-SFML.cpp|732|undefined reference to __imp_glEnable'|
imgui project\src\imgui-SFML.cpp|733|undefined reference to __imp_glBlendFunc'| imgui project\src\imgui-SFML.cpp|734|undefined reference to __imp_glDisable'|
imgui project\src\imgui-SFML.cpp|735|undefined reference to `__imp_glDisable'|
and so on..

does anyone know how to fix it?

Hello,

Seems like you didn't linked with opengl ?
In your project build options -> Linker settings -> Link library -> add opengl32 (on Windows)

Does it help ?
(I also link with glu32...)

I think it'll be enough to link with opengl32.lib, no need for glut

Hello,

Seems like you didn't linked with opengl ?
In your project build options -> Linker settings -> Link library -> add opengl32 (on Windows)

Does it help ?
(I also link with glu32...)

Thanks its help. thank you so much. i just add -opengl32 at linker in the debug and release.