Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various build problems with VS 2022 and possible version mismatch with dwSampleFramework #1

Open
Sam-Izdat opened this issue Feb 20, 2022 · 3 comments

Comments

@Sam-Izdat
Copy link

I've had a few problems getting this to compile with VS 2022 on Windows 10 and I've worked through them, but I wanted to document them for you.

Required VS features

First, it might be worth noting in the README that VS 2022 apparently needs to be told explicitly to install the following, under "Tools" -> "Get Tools and Features" :

  • "C++ CMake tools for Windows" (I think it's required but not positive)
  • "Windows 10 SDK"

"WIN32" undefined

Dependencies fail to compile because "WIN32" is not defined (i.e. if defined(WIN32) and #ifdef WIN32 return false). I just slapped add_definitions(-DWIN32) into CMakeLists.txt but I imagine there's a proper way to fix this.

Build flags

The build failed without the /EHsc flag. I ended up building with:

cmake -DCMAKE_CXX_FLAGS="/EHsc" -G "Visual Studio 17 2022" ..

dwSampleFramework problem

In main.cpp, this line kept it from compiling:

m_bake_sdf_program->set_uniform("u_VolumeSize", volume_size);

There was no suitable overload for set_uniform in dwSampleFramework.

I declared this (in dwSampleFramework) in ogl.h:

bool    set_uniform(std::string name, glm::ivec3 value);

and defined this in olg.cpp:

bool Program::set_uniform(std::string name, glm::ivec3 value)
{
    if (m_location_map.find(name) == m_location_map.end())
        return false;

    glUniform3i(m_location_map[name], value.x, value.y, value.z);

    return true;
}

Everything looks fine now. Thanks for sharing this example.

@diharaw
Copy link
Owner

diharaw commented Feb 20, 2022

Hey! Thank you for looking into this! I'm still using VS 2019 so didn't see these issues. I'll fix these up soon.

@Sam-Izdat
Copy link
Author

I just upgraded, myself. Found your repo a few hours later and was kicking myself -- considered going right back. :P

Would it be alright to submit PRs, or maybe feature requests -- like, for exporting the SDF textures, loading in meshes through GUI, and such? Or, would you rather keep this a minimal sample?

@diharaw
Copy link
Owner

diharaw commented Feb 20, 2022

Exporting the SDF textures might be a good idea, but I don’t want the sample to be too bloated since it’s meant to be somewhat educational. But feel free to submit PRs for this or the framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants