vsg-dev / vsgTutorial

VulkanSceneGraph Tutorial
MIT License
8 stars 7 forks source link

The Global Image does not show up when run hello_world #16

Closed daviszhu88 closed 5 months ago

daviszhu88 commented 6 months ago

The Global Image does not show up when run hello_world. There was only a dark-blue screen. I am running on Windows. What could be the problem? Thanks.

robertosfield commented 6 months ago

There is no way to know what is specially wrong on your system with so little information about your system.

This is what you should see (I've just built under Linux with VSG, vsgXhange and vsgTutorial master : Screenshot_20240422_091624

The hello_world example depends upon VulkanSceneGraph and vsgXchange libraries, and to low the OpenStreetMap data is requires vsgXchange::curl which depends upon libcurl to load the data from http.

Since you mention dark blue screen I can only guess that the window is opening and rendering the background colour bu is failing to load the data. Could it be that you've built vsgXchange without libcurl so it doesn't have the ability to download data.

Check your vsgXchange builds CMakeCache.txt or by running CMake gui and look at the vsgXchange_curl CMake variable, this should be ON if it's found libcurl and able to be the vsgXchange::curl plugin. The include/vsgXchange/Version.h will also have the vsgXchange_curl provided as a define.

This is what my include/vsgXchange/Version.h looks like (note the optional features at end):

 /* <editor-fold desc="MIT License">

Copyright(c) 2021 Robert Osfield

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitat
ion the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHA
LL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS IN THE SOFTWARE.

</editor-fold> */

#pragma once

#include <vsgXchange/Export.h>
#include <vsg/core/Version.h>

#ifdef __cplusplus
extern "C"
{
#endif

    #define VSGXCHANGE_VERSION_MAJOR    1
    #define VSGXCHANGE_VERSION_MINOR    1
    #define VSGXCHANGE_VERSION_PATCH    1
    #define VSGXCHANGE_SOVERSION        1

    #define VSGXCHANGE_VERSION_STRING   "1.1.1"
    #define VSGXCHANGE_SOVERSION_STRING "1"

    extern VSGXCHANGE_DECLSPEC struct VsgVersion vsgXchangeGetVersion();
    extern VSGXCHANGE_DECLSPEC const char* vsgXchangeGetVersionString();
    extern VSGXCHANGE_DECLSPEC const char* vsgXchangeGetSOVersionString();

    /// return 0 if the linked vsgXchange was built as static library (default), 1 if the linked vsgXchange library was built as shared/dynamic library.
    /// When building against a shared library, to ensure the correct selection of VSGXCHANGE_DECLSPEC (provided in vsgXchange/Export.h) one must compile with the define VSGXCHANGE_SHARED_LIBRARY
    extern VSGXCHANGE_DECLSPEC int vsgXchangeBuiltAsSharedLibrary();

    /// standard Features
    #define vsgXchange_all
    #define vsgXchange_images
    #define vsgXchange_models
    #define vsgXchange_stbi
    #define vsgXchange_dds
    #define vsgXchange_ktx
    #define vsgXchange_spv
    #define vsgXchange_cpp

    /// optional Features
    #define vsgXchange_curl
    #define vsgXchange_openexr
    #define vsgXchange_freetype
    #define vsgXchange_assimp
    #define vsgXchange_GDAL
    #define vsgXchange_OSG

#ifdef __cplusplus
}
#endif
daviszhu88 commented 6 months ago

Hi Robert,

Thanks. The issue was due to the "curl" was not included when I built the vsgXchange. The global image shows up now after I rebuild the lib. I think it will be more helpful to show some info when the data (image) was not retrieved. Thanks.

robertosfield commented 5 months ago

I have added libcurl-openssl-dev to the recommend dependencies listed for vsgXchange and added a check against vsgXchange_curl in hello_world.cpp to help avoid others being tripped up by this missig dependency,