hugoam / two Goto Github PK
View Code? Open in Web Editor NEWc++ toolkit for rapid development of live graphical apps and games
License: zlib License
c++ toolkit for rapid development of live graphical apps and games
License: zlib License
Hi,
Followed your instructions but getting this on OSX:
nsa-000:mud-sample freebsd$ mud/bin/genie
-bash: mud/bin/genie: cannot execute binary file
Unsure what to do about this error I'm seeing:
...
INFO: Init Gfx System
INFO: resource path: d:/Dev/toy/data/
INFO: resource path: d:/Dev/toy/data/examples/ex_blocks/
INFO: Creating GLFW context. GLFW version 3.3
ERROR: GLFW 65546: Cannot make current with a window that has no OpenGL or OpenGL ES context
ERROR: GLFW 65538: Cannot set swap interval without a current OpenGL or OpenGL ES context
GfxSystem: Native Handle = 004508AE
GfxSystem: bgfx::init
...
I have the latest drivers. In GlfwContext.cpp
of mud, I see a check if MUD_RENDERER_BGFX
is defined which then sets glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API)
. The GLFW documentation states
Windows without contexts must not be passed to glfwMakeContextCurrent
But only a few lines later, this exact thing happens.
Is this a bug?
Thanks!
I found the following code:
// File: two/src/bgfx/BgfxSystem.cpp
// Function: BgfxSystem::init
info("gfx - bgfx::init");
bgfx::Init params = {};
params.type = bgfx::RendererType::OpenGL;
params.type = bgfx::RendererType::Direct3D11;
//params.type = bgfx::RendererType::Direct3D12;
params.type = bgfx::RendererType::WebGPU;
params.resolution.width = uint32_t(context.m_size.x);
params.resolution.height = uint32_t(context.m_size.y);
params.resolution.reset = BGFX_RESET_NONE;
the value of params.type
is repeated assigned with OpenGL
, Direct3D11
, WebGPU
, this is confusing me. Can you explain this?
Thank you very much.
Hello! I've been trying to build toy
, and had this problem. I've got no errors building bgfx
, but had the same error trying to build the mud-sample
as the README specifies. This is the error after running make
for the second time - the error is the same as the first, but this second run is more legible.
➜ gmake-linux git:(master) make config=debug64
==== Building fcpp (debug64) ====
==== Building glslang (debug64) ====
==== Building glsl-optimizer (debug64) ====
yacc ../../../mud/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.y
yacc: e - line 164 of "../../../mud/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.y", syntax error
%locations
^
make[1]: *** [<builtin>: ../../../mud/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c] Error 1
make: *** [Makefile:69: glsl-optimizer] Error 2
I'm currently using Fedora 28, yacc
1.9.
Kudos for your awesome projects!
I tried to compile two as described in README.md
but i got those compiler errors, i'm on Debian 9:
BgfxSystem.cpp
In file included from ../../../src/ctx/Context.h:10:0,
from ../../../src/ctx-glfw/GlfwContext.h:11,
from ../../../src/bgfx/BgfxSystem.h:13,
from ../../../src/bgfx/BgfxSystem.cpp:17:
../../../src/math/Vec.h:208:32: error: ‘two::x3’ declared as an ‘inline’ variable
export_ constexpr inline vec3 x3 = { 1.f, 0.f, 0.f };
^~
../../../src/math/Vec.h:209:32: error: ‘two::y3’ declared as an ‘inline’ variable
export_ constexpr inline vec3 y3 = { 0.f, 1.f, 0.f };
^~
../../../src/math/Vec.h:210:32: error: ‘two::z3’ declared as an ‘inline’ variable
export_ constexpr inline vec3 z3 = { 0.f, 0.f, 1.f };
^~
../../../src/math/Vec.h:212:32: error: ‘two::ZeroQuat’ declared as an ‘inline’ variable
export_ constexpr inline quat ZeroQuat = { 0.f, 0.f, 0.f, 1.f };
^~~~~~~~
../../../src/math/Vec.h:214:32: error: ‘two::Rect4’ declared as an ‘inline’ variable
export_ constexpr inline vec4 Rect4 = { 0.f, 0.f, 1.f, 1.f };
^~~~~
btw, i don't need webgpu, so a work-around that simply skipped this would be great.
this is on a tree i cloned within last couple of days, and on linux (obviously).
strangely my bgfx installation built without any errors, so it's a bit odd that this dies.
==== Building shaderc (debug64) ====
Creating ../../linux64_gcc/obj/x64/Debug/shaderc
Creating ../../linux64_gcc/obj/x64/Debug/shaderc/bgfx/tools/shaderc
shaderc.cpp
shaderc_glsl.cpp
shaderc_hlsl.cpp
shaderc_metal.cpp
shaderc_pssl.cpp
shaderc_spirv.cpp
../../../../bgfx/tools/shaderc/shaderc_spirv.cpp:17:10: fatal error: webgpu/webgpu_cpp.h: No such file or directory
#include <webgpu/webgpu_cpp.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
shaderc.make:212: recipe for target '../../linux64_gcc/obj/x64/Debug/shaderc/bgfx/tools/shaderc/shaderc_spirv.o' failed
make[1]: *** [../../linux64_gcc/obj/x64/Debug/shaderc/bgfx/tools/shaderc/shaderc_spirv.o] Error 1
make[1]: *** Waiting for unfinished jobs....
Makefile:96: recipe for target 'shaderc' failed
make: *** [shaderc] Error 2
I followed the Linux build instructions in the README. From the build log:
==== Building 00_cube (debug64) ====
Creating ../../linux64_gcc/obj/x64/Debug/02_camera
Creating ../../linux64_gcc/obj/x64/Debug/00_tutorial
Creating ../../linux64_gcc/obj/x64/Debug/02_camera/example/02_camera
Creating ../../linux64_gcc/obj/x64/Debug/00_tutorial/example/00_tutorial
Creating ../../linux64_gcc/obj/x64/Debug/00_cube
Creating ../../linux64_gcc/obj/x64/Debug/01_shapes
Creating ../../linux64_gcc/obj/x64/Debug/02_camera/example/03_materials
Creating ../../linux64_gcc/obj/x64/Debug/00_tutorial/example/meta/00_tutorial
Creating ../../linux64_gcc/obj/x64/Debug/02_camera/src/mud
Creating ../../linux64_gcc/obj/x64/Debug/01_shapes/example/01_shapes
Creating ../../linux64_gcc/obj/x64/Debug/00_cube/example/00_cube
Creating ../../linux64_gcc/obj/x64/Debug/00_tutorial/src/mud
02_camera.cpp
Creating ../../linux64_gcc/obj/x64/Debug/01_shapes/src/mud
Creating ../../linux64_gcc/obj/x64/Debug/00_cube/src/mud
00_tutorial.cpp
01_shapes.cpp
00_cube.cpp
In file included from ../../../src/noise/Structs.h:9:0,
from ../../../src/noise/Api.h:2,
from ../../../src/mud/mud.h:13,
from ../../../example/02_camera/02_camera.cpp:1:
../../../src/noise/Noise.h:11:23: fatal error: FastNoise.h: No such file or directory
compilation terminated.
02_camera.make:226: recipe for target '../../linux64_gcc/obj/x64/Debug/02_camera/example/02_camera/02_camera.o' failed
make[1]: *** [../../linux64_gcc/obj/x64/Debug/02_camera/example/02_camera/02_camera.o] Error 1
Makefile:108: recipe for target '02_camera' failed
make: *** [02_camera] Error 2
make: *** Waiting for unfinished jobs....
In file included from ../../../src/noise/Structs.h:9:0,
from ../../../src/noise/Api.h:2,
from ../../../src/mud/mud.h:13,
from ../../../example/00_tutorial/00_tutorial.cpp:1:
../../../src/noise/Noise.h:11:23: fatal error: FastNoise.h: No such file or directory
compilation terminated.
The include path for 02_camera needs to contain 3rdparty/FastNoise
, and that's missing from the generated makefile in build/projects/gmake-linux/02_camera.make
.
Looking at the Lua build scripts, 'uses_mud_noise' in 'mud.lua' defines this include directory. That is part of 'mud.noise', which is part of 'mud.mud'. So, 02_camera needs to depend on 'mud.mud'.
So, in 'scripts/mud_example.lua', I added 'mud.mud' to the dependencies for 02_camera:
mud_example("02_camera", { mud.mud, mud.gfx, mud.gfx.ui, mud.gfx.pbr }, { _G["03_materials"] })
I guess that's appropriate since 02_camera.cpp includes "mud.mud"? But it fails, GENie blows up with an error if I do this.
Metal backend has been found to fail with the following stacktrace:
-[MTLVertexDescriptorInternal newSerializedDescriptor]:832: failed assertion `None of the attributes set bufferIndex to 2, but MTLVertexDescriptor set buffer layout[2].stride(4).'
Process 87068 stopped
thread #8, stop reason = signal SIGABRT
frame #0: 0x00007fff5cf7be3e libsystem_kernel.dylib__pthread_kill + 10 libsystem_kernel.dylib__pthread_kill:
-> 0x7fff5cf7be3e <+10>: jae 0x7fff5cf7be48 ; <+20>
0x7fff5cf7be40 <+12>: movq %rax, %rdi
0x7fff5cf7be43 <+15>: jmp 0x7fff5cf730b8 ; cerror_nocancel
0x7fff5cf7be48 <+20>: retq
Target 0: (00_cube_d) stopped.
(lldb) bt
thread #8, stop reason = signal SIGABRT
frame #0: 0x00007fff5cf7be3e libsystem_kernel.dylib__pthread_kill + 10 frame #1: 0x00007fff5d0ba150 libsystem_pthread.dylibpthread_kill + 333
frame #2: 0x00007fff5ced8312 libsystem_c.dylibabort + 127 frame #3: 0x00007fff5cea0368 libsystem_c.dylib__assert_rtn + 320
frame #4: 0x00007fff39ad3f8d MetalMTLReportFailure + 778 frame #5: 0x00007fff39adc805 Metal-[MTLVertexDescriptorInternal newSerializedDescriptor] + 454
frame #6: 0x00007fff39ad362f Metal-[MTLRenderPipelineDescriptorInternal newSerializedVertexDataWithFlags:error:] + 490 frame #7: 0x00007fff39ac1382 Metal-[MTLCompiler newRenderPipelineStateWithDescriptor:options:reflection:error:completionHandler:] + 153
frame #8: 0x00007fff39aa43a4 Metal-[_MTLDevice newRenderPipelineStateWithDescriptor:options:reflection:error:] + 76 frame #9: 0x00000001018c619c 00_cube_dbgfx::mtl::Device::newRenderPipelineStateWithDescriptor(this=0x0000000106f16008, _descriptor=0x00000001034759e0, _options=2, _reflection=0x000070000b8aa0c8) at renderer_mtl.h:315
frame #10: 0x00000001018be593 00_cube_dbgfx::mtl::RendererContextMtl::getPipelineState(this=0x0000000106f16000, _state=106319887, _rgba=0, _fbh=(idx = 65535), _numStreams='\x03', _vertexDecls=0x000070000b8aac50, _programIdx=11, _numInstanceData='\0') at renderer_mtl.mm:2010 frame #11: 0x00000001018b90cc 00_cube_dbgfx::mtl::RendererContextMtl::submit(this=0x0000000106f16000, _render=0x000000010c800440, _clearQuad=0x000000010f343e90, _textVideoMemBlitter=0x000000010f343e20) at renderer_mtl.mm:3849
frame #12: 0x0000000101858d80 00_cube_dbgfx::Context::renderFrame(this=0x000000010c800040, _msecs=5000) at bgfx.cpp:1911 frame #13: 0x0000000101858c46 00_cube_dbgfx::renderFrame(_msecs=-1) at bgfx.cpp:1096
frame #14: 0x0000000101859ee3 00_cube_dbgfx::Context::renderThread((null)=0x000000010c800240, (null)=0x000000010c800040) at bgfx_p.h:2714 frame #15: 0x00000001018fd783 00_cube_dbx::Thread::entry(this=0x000000010c800240) at thread.cpp:294
frame #16: 0x00000001018fd72d 00_cube_dbx::ThreadInternal::threadFunc(_arg=0x000000010c800240) at thread.cpp:89 frame #17: 0x00007fff5d0b76c1 libsystem_pthread.dylib_pthread_body + 340
frame #18: 0x00007fff5d0b756d libsystem_pthread.dylib_pthread_start + 377 frame #19: 0x00007fff5d0b6c5d libsystem_pthread.dylibthread_start + 13
For now this can be worked around by forcing the renderer to OpenGL, but in the future we want to support the Metal backend.
Example 03_materials
throws an unhandled exception from nvoglv64.dll
when I try to run it. (Built from the latest master (00fc8af) using VS2017 on Windows 10 Pro 64 bit with GeForce GTX 1080 graphics card, driver version 417.35, 4k monitor.)
Unfortunately the exception details are not particularly helpful (at least to me):
Unhandled exception at 0x00000000678D0AD9 (nvoglv64.dll) in 03_materials_d.exe: Fatal program exit requested. occurred
Neither is the backtrace of the thread that raises the exception:
I tried to find debugging symbols, but it seems that nVidia does not provide .pdb files for their drivers.
Backtrace of the main thread:
The last two lines of the console log before entering the debugger are:
INFO: loading program filter/prefilter_envmap_v0 with options
INFO: loaded program c:/Users/tc/Programming/Games/Toy/mud/data//shaders/compiled/filter/prefilter_envmap_v0 id 19
I've also attached the full console log in case there is anything helpful in there: 03_materials_console_output.txt
The debug output is as follows:
03_materials_debug_output.txt
I see all commit history is gone! Did you have secrets in there?
When running example 07_gltf
the materials appear very different from the ones in the WebGL version:
(Built from the latest master (00fc8af) using VS2017 on Windows 10 Pro 64 bit with GeForce GTX 1080 graphics card, driver version 417.35, 4k monitor.)
It seems that genie wants to write outside two's folder. It fails. Following the README.md on Win10 character by character I got:
c:\Learning\Code\CPP\TWOROOT\two>bin/windows/genie vs2017
'bin' is not recognized as an internal or external command, operable program or batch file.
Tried with backslashes instead of fwd slashes:
c:\Learning\Code\CPP\TWOROOT\two>bin\windows\genie.exe vs2017
setting windowsTargetPlatformVersion to 8.1
cannot open c:/Learning/Code/CPP/TWOROOT/bx/scripts/bx.lua: No such file or directory
stack traceback:
[C]: in upvalue 'builtin_dofile'
[string "premake = { }..."]:96: in function 'dofile'
c:/Learning/Code/CPP/TWOROOT/two/scripts/3rdparty/bgfx/bgfx.lua:6: in main chunk
[C]: in upvalue 'builtin_dofile'
[string "premake = { }..."]:96: in function 'dofile'
c:/Learning/Code/CPP/TWOROOT/two/scripts/two.lua:33: in main chunk
[C]: in upvalue 'builtin_dofile'
[string "premake = { }..."]:96: in function 'dofile'
c:/Learning/Code/CPP/TWOROOT/two/scripts/genie.lua:21: in main chunk
[C]: in upvalue 'builtin_dofile'
[string "premake = { }..."]:96: in function 'dofile'
[string "_WORKING_DIR = os.getcwd()..."]:45: in function '_premake_main'
Tried with quotes and forward slashes ("bin/windows/genie.exe" vs2017
) with the same results.
Tried on another drive and as an admin to make sure it is not a rights issue. Same results.
It would be useful to mention in the README.md to put two inside an extra new folder as it will write things its parent dir.
There are so much terms here: bgfx, mud, two, etc.
What I need is to be able to pop up an OS window, which has two buttons, with a hotkey.
And close that window with a second press of the same hotkey.
Where can I find a tutorial of how to create such example with Visual Studio?
first : there are two modules their path is "https://github.com/hugoam/nanovg". one is "3rdparty/nanovgvg-layers",another one is "3rdparty/nanovg-layers"
second :git.exe submodule update --progress --init -- "3rdparty/nanovg"
error: pathspec '3rdparty/nanovg' did not match any file(s) known to git
this seems 3rdparty/nanovg not in the git.
there are so many problems. I tried to compile the program successfully, but when i run the samples, many has errors such as can not load gltf, corrupted suddennly , so i think you should do more work to make it stable
To compile example 05_character
I had to modify the file name for the character model (the trivial patch is attached after the text.)
After doing that I get the following output instead of the expected animated character:
(Built from the latest master (00fc8af) using VS2017 on Windows 10 Pro 64 bit with GeForce GTX 1080 graphics card, driver version 417.35, 4k monitor.)
If a select build configuration to Debug native 64 bit generate this error - "Pre-C++11 compiler is not supported!"
xcode version - Version 11.2.1 (11B53)
OS x version - Mojave 10.14.5
crisper font rendering in particular would go a long way in the examples.
Hi, really nice library you got here. You happen to know what causes this flicker bug? Its in Chrome and Firefox, but they use the same engine nonetheless internally:
Ubuntu 18
bgfx works for me for the most part. a lot of the compiled scenes will fail. e.g. 08_sky_d, xx_three_d, etc.
[info] ui - window init - resource path /home/pgruenbacher/Code/cpp/two/data
[info] ui - loading images from path /home/pgruenbacher/Code/cpp/two/data/interface/uisprites
[info] ui - loading resources
[info] ui - init input
[info] ui window - resize to (1600, 900) - pixel size (1600, 900)
[warning] ui - style TypeLabel not found
[warning] ui - style TypeLabel not found
[warning] ui - style Tree not found
[warning] ui - style Dockbox not found
[warning] ui - style Section not found
[warning] ui - style Dockbox not found
08_sky_d: malloc.c:2401: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
I'll try a quick investigation.
Hi, I was wondering if WSL compatibility would be a thing that mud may support. So far, on a mostly clean-ish installation, I run into several errors:
In file included from ../../../mud/3rdparty/glfw/src/internal.h:188:0,
from ../../../mud/3rdparty/glfw/src/context.c:28:
../../../mud/3rdparty/glfw/src/x11_platform.h:33:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/glfw/mud/3rdparty/glfw/src/context.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from ../../../mud/3rdparty/glfw/src/internal.h:188:0,
from ../../../mud/3rdparty/glfw/src/egl_context.c:28:
../../../mud/3rdparty/glfw/src/x11_platform.h:33:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
In file included from ../../../mud/3rdparty/glfw/src/internal.h:188:0,
from ../../../mud/3rdparty/glfw/src/glx_context.c:28:
../../../mud/3rdparty/glfw/src/x11_platform.h:33:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/glfw/mud/3rdparty/glfw/src/egl_context.o] Error 1
make[1]: *** [../../linux64_gcc/obj/x64/Debug/glfw/mud/3rdparty/glfw/src/glx_context.o] Error 1
make: *** [glfw] Error 2
make: *** Waiting for unfinished jobs....
make[1]: yacc: Command not found
make[1]: *** [../../../mud/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c] Error 127
make[1]: *** Waiting for unfinished jobs....
make: *** [glsl-optimizer] Error 2
In file included from ../../../mud/3rdparty/bgfx/src/glcontext_egl.cpp:9:0:
../../../mud/3rdparty/bgfx/src/renderer_gl.h:43:22: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/bgfx/mud/3rdparty/bgfx/src/glcontext_egl.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from ../../../mud/3rdparty/bgfx/src/glcontext_glx.cpp:9:0:
../../../mud/3rdparty/bgfx/src/renderer_gl.h:43:22: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/bgfx/mud/3rdparty/bgfx/src/glcontext_glx.o] Error 1
make: *** [bgfx] Error 2
When building and running example 06_particles
I would expect to see something similar to the WebGL demo.
Instead I get this:
I can zoom and rotate, but no particles appear on the screen...
(Built from the latest master (00fc8af) using VS2017 on Windows 10 Pro 64 bit with GeForce GTX 1080 graphics card, driver version 417.35, 4k monitor.)
For both gcc-4.9.3 and gcc-7.3.0, the bgfx compilation is failing at the below conversions. I have tried various casts with no luck.
Any suggestions?
../../../mud/3rdparty/bgfx/src/renderer_gl.cpp: In member function ‘void bgfx::gl::TextureGL::create(const bgfx::Memory*, uint32_t, uint8_t)’:
../../../mud/3rdparty/bgfx/src/renderer_gl.cpp:5167:10: error: cannot convert ‘uint8_t* {aka unsigned char*}’ to ‘bx::AllocatorI*’ for argument ‘1’ to ‘void bimg::imageDecodeToRgba8(bx::AllocatorI*, void*, const void*, uint32_t, uint32_t, uint32_t, bimg::TextureFormat::Enum)’
);
^
../../../mud/3rdparty/bgfx/src/renderer_gl.cpp: In member function ‘void bgfx::gl::TextureGL::update(uint8_t, uint8_t, const bgfx::Rect&, uint16_t, uint16_t, uint16_t, const bgfx::Memory*)’:
../../../mud/3rdparty/bgfx/src/renderer_gl.cpp:5330:112: error: cannot convert ‘uint8_t* {aka unsigned char*}’ to ‘bx::AllocatorI*’ for argument ‘1’ to ‘void bimg::imageDecodeToRgba8(bx::AllocatorI*, void*, const void*, uint32_t, uint32_t, uint32_t, bimg::TextureFormat::Enum)’
bimg::imageDecodeToRgba8(temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.