conan-io / examples2

Conan 2.x examples
MIT License
87 stars 48 forks source link

imgui example not working #127

Closed FreePhoenix888 closed 6 months ago

FreePhoenix888 commented 6 months ago
PS C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction> conan install . --build=missing

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

======== Computing dependency graph ========
Graph root
    conanfile.py: C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\conanfile.py
Requirements
    glew/2.2.0#e5519ddcf52267be816b50d3dfa14a23 - Cache
    glfw/3.3.8#54540ba4627e939dd76f098dc36b65d0 - Cache
    glu/system#ee50fc2ade0e1c0c8ebb3be3ea60e0f5 - Cache
    imgui/1.89.4#bf3c9fee25b5bc510e85bf1d2ad055e6 - Cache
    opengl/system#b29589c04d6df84c110d6acb066ab653 - Cache

======== Computing necessary packages ========
Requirements
    glew/2.2.0#e5519ddcf52267be816b50d3dfa14a23:bb9c81224eec59d1d72d5c025be722a58d99a2b9#29ed16a187951035e626f78e9f9414bb - Cache
    glfw/3.3.8#54540ba4627e939dd76f098dc36b65d0:297149c43b562095879d245f61d9b2e590276ce7#5db24ce2010329d6ff349f0f2ef9e7ba - Cache
    glu/system#ee50fc2ade0e1c0c8ebb3be3ea60e0f5:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
    imgui/1.89.4#bf3c9fee25b5bc510e85bf1d2ad055e6:9bdee485ef71c14ac5f8a657202632bdb8b4482b#a3530a24b9d7abf0ebf391e5f8b60147 - Cache
    opengl/system#b29589c04d6df84c110d6acb066ab653:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache

======== Installing packages ========
imgui/1.89.4: Already installed! (1 of 5)
imgui/1.89.4: Appending PATH env var with : C:\Users\FreePhoenix\.conan2\p\imgui78b286530a4a8\p\bin
opengl/system: Already installed! (2 of 5)
glfw/3.3.8: Already installed! (3 of 5)
glu/system: Already installed! (4 of 5)
glew/2.2.0: Already installed! (5 of 5)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'env_info' used in: imgui/1.89.4
WARN: deprecated:     'cpp_info.filenames' used in: opengl/system, glew/2.2.0, glfw/3.3.8
WARN: deprecated:     'cpp_info.names' used in: glew/2.2.0, glfw/3.3.8
WARN: deprecated:     'cpp_info.build_modules' used in: glfw/3.3.8

======== Finalizing install (deploy, generators) ========
conanfile.py: Writing generators to C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\build\generators  
conanfile.py: Generator 'CMakeDeps' calling 'generate()'
conanfile.py: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(imgui)
    find_package(glfw3)
    find_package(glew)
    target_link_libraries(... imgui::imgui glfw GLEW::GLEW)
conanfile.py: Generator 'CMakeToolchain' calling 'generate()'
conanfile.py: CMakeToolchain generated: conan_toolchain.cmake
conanfile.py: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23    
conanfile.py: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\build\generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW'
conanfile.py: CMakeToolchain generated: CMakePresets.json
conanfile.py: CMakeToolchain generated: ..\..\CMakeUserPresets.json
conanfile.py: Calling generate()
conanfile.py: Generators folder: C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\build\generators     
conanfile.py: Generating aggregated env files
conanfile.py: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully
PS C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction> cmake --preset conan-default   
Preset CMake variables:

  CMAKE_POLICY_DEFAULT_CMP0091="NEW"
  CMAKE_TOOLCHAIN_FILE:FILEPATH="C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\build\generators\conan_toolchain.cmake"

-- Using Conan toolchain: C:/Users/FreePhoenix/Documents/Programming/examples2/examples/libraries/imgui/introduction/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- The CXX compiler identification is MSVC 19.38.33133.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Target declared 'imgui::imgui'
-- Conan: Target declared 'glfw'
-- Conan: Target declared 'opengl::opengl'
-- Conan: Component target declared 'GLEW::glew_s'
-- Conan: Target declared 'GLEW::GLEW'
-- Conan: Target declared 'glu::glu'
-- Configuring done (3.5s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/FreePhoenix/Documents/Programming/examples2/examples/libraries/imgui/introduction/build
PS C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction> cmake --build --preset conan-release
MSBuild version 17.8.3+195e7f5a3 for .NET Framework

  1>Checking Build System
  Building Custom Rule C:/Users/FreePhoenix/Documents/Programming/examples2/examples/libraries/imgui/introduction/CMakeLists.txt
  main.cpp
  opengl_shader.cpp
  file_manager.cpp
  imgui_impl_glfw.cpp
  imgui_impl_opengl3.cpp
  dear-imgui-conan.vcxproj -> C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\build\Release\dear-imgu
  i-conan.exe
  Building Custom Rule C:/Users/FreePhoenix/Documents/Programming/examples2/examples/libraries/imgui/introduction/CMakeLists.txt
PS C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction> cd build\Release
PS C:\Users\FreePhoenix\Documents\Programming\examples2\examples\libraries\imgui\introduction\build\Release> .\dear-imgui-conan.exe
Error reading Shader File!
Error reading Shader File!
Error Linking Shader Program:
Vertex info
-----------
(0) : error C5145: must write to gl_Position
memsharded commented 6 months ago

Hi @FreePhoenix888

Thanks for your report and details to reproduce. I have managed to do all steps, in Windows, and the application builds succesfully and I can run it.

A GUI window opens up and shows the controls and the logo, but not the colored triangle. It also prints to terminal:

Error reading Shader File!
Error reading Shader File!
Error compiling Vertex Shader:

Error compiling Fragment Shader:

Error Linking Shader Program:

Quick question: is the GUI window opening in your case, or crashing and opening to fail? Do you see anything at all?

memsharded commented 6 months ago

Ok, the issue in my case seems to be that the assets (the shaders) are not in the right location. Copying them from the assets folder into the build\Release folder besides the built executable, and launching again the executable makes it work.

memsharded commented 6 months ago

@Konard, you seeing the same issue? Can you please check if it is the shaders file location?

FreePhoenix888 commented 6 months ago

Hi @FreePhoenix888

Thanks for your report and details to reproduce. I have managed to do all steps, in Windows, and the application builds succesfully and I can run it.

A GUI window opens up and shows the controls and the logo, but not the colored triangle. It also prints to terminal:

Error reading Shader File!
Error reading Shader File!
Error compiling Vertex Shader:

Error compiling Fragment Shader:

Error Linking Shader Program:

Quick question: is the GUI window opening in your case, or crashing and opening to fail? Do you see anything at all?

I see empty white window with default window controls on the top and after error it closes itself

FreePhoenix888 commented 6 months ago

Ok, the issue in my case seems to be that the assets (the shaders) are not in the right location. Copying them from the assets folder into the build\Release folder besides the built executable, and launching again the executable makes it work.

Thank you I will try it later

czoido commented 6 months ago

Hi @FreePhoenix888, Thanks for reporting. I opened a PR that should fix it: https://github.com/conan-io/examples2/pull/129

memsharded commented 6 months ago

https://github.com/conan-io/examples2/pull/129 has fixed this issue, but please re-open or create a new ticket if there is any further issue.