Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:56
    dranikpg synchronize #576
  • 16:58
    arenas7307979 starred mosra/magnum
  • 02:18
    Fibonacci43 starred mosra/magnum
  • 01:36
    zasdfgbnm starred mosra/magnum
  • Aug 10 22:15
    tlemo starred mosra/magnum
  • Aug 10 22:12
    tlemo starred mosra/corrade
  • Aug 10 20:33
    quarz starred mosra/magnum
  • Aug 10 16:10
    xJayLee starred mosra/magnum
  • Aug 10 14:49
    KellyWalker starred mosra/magnum
  • Aug 10 12:27
    codecov[bot] commented #146
  • Aug 10 12:27
    codecov[bot] commented #146
  • Aug 10 12:25
    codecov[bot] commented #146
  • Aug 10 12:24
    codecov[bot] commented #146
  • Aug 10 12:24
    codecov[bot] commented #146
  • Aug 10 12:24
    codecov[bot] commented #146
  • Aug 10 12:24
    codecov[bot] commented #146
  • Aug 10 10:42
    hugoam edited #146
  • Aug 10 10:41
    hugoam synchronize #146
  • Aug 10 10:29
    hugoam synchronize #146
  • Aug 10 10:15
    hugoam opened #582
Fo Nz
@FoNz99089892_twitter
As I read from the OpenGL docs, both buffer swap and FBO binding may cause syncing to the last command for OpenGL. So I think framebuffer should be read right after this happens in any application. So it's outside of "Magnum scope", but I think it's still worth mentioning...
Vladimír Vondruš
@mosra
syncing or flushing?
that a FBO binding would cause the pipeline to sync sounds strange
buffer swap of the default framebuffer causes a glFinish() to be called, yes (because you gotta wait for it to have it presented), but rebinding another FBO shouldn't cause a pipeline stall i think
another option instead of double-buffering is to delay the picking to the beginning of the next frame, before anything gets submitted to GL, but that might complicate the logic a lot
Fo Nz
@FoNz99089892_twitter

that a FBO binding would cause the pipeline to sync sounds strange

I have read that i(t may cause) in "Implicit synchronization" paragraph here (look at the last sentence):
https://www.khronos.org/opengl/wiki/Synchronization

another option instead of double-buffering is to delay the picking to the beginning of the next frame

Yes, that's what I done, and right after the framebuffer is bound but not cleared yet.

Azvf
@Azvf
I'm trying to scale a object derived from Object3D and Scene3D, But why doesn't the scale code work after the setTransformation() function?
    _outlineDrawable = SceneGraph::DrawableGroup3D{};
    _outliner.reset(new Outliner(&mesh, *_outlineDrawable, _scene));
    _outliner->scale(Magnum::Vector3{ 1.1f });
    auto mat = objects._attachmentObjects[id]->transformation();
    _outliner->setTransformation(mat);
Guillaume Jacquemin
@williamjcm
setTransformation overrides the existing transformation.
I think you want transform() instead.
Azvf
@Azvf
It worked, Thank you for the help!
Guillaume Jacquemin
@williamjcm
You're welcome! :thumbsup:
Azvf
@Azvf
I'm trying to import a lib in js within the scope of EM_ASM or EM_JS, but from the doc it seems it'll encapsulate them into a function anyway. Then how can I get around with it?
hsdk123
@hsdk123

Hey all > iOS

I see that my application doesn't seem to fill the screen - the sdl viewportEvent gives me

window size: (480, 320). dpi scaling: (1, 1). framebuffer size: (960, 640)

when it's clear though that the phone screen is much wider.

image0.png
Would anyone know what might be causing this?
hsdk123
@hsdk123
Seems it had to with adding the launch images or a launch storyboard
Vladimír Vondruš
@mosra
is it possible sdl has some weird / outdated default sizes? iirc (in 2016) i always had to force the size manually somehow to make it fill the screen and be "Retina"
Fo Nz
@FoNz99089892_twitter
@mosra How do I preserve the OpenGL ES Context on Android? Normally, I would destroy the window, but not the context. Then, on resume, I would create a new window and reattach the old context. This resembles the behaviour of setPreserveEGLContextOnPause. Can I do this without some tweaking on Magnum's source?
I don't care if app gets destroyed by the OS while in background. This would happen with any app, anyway.
Vladimír Vondruš
@mosra
i have no idea, honestly
do you use the AndroidApplication or something custom?
as long as you can retrieve and save the context handle (and the corresponding magnum GL context) then it should work
Fo Nz
@FoNz99089892_twitter

do you use the AndroidApplication or something custom?

Yes, I use Magnum's AndroidApplication. I know how to do it. I just wanted to know if it was possible without modifying the Magnum's source, but I think it's necessary. Thanks!

Vladimír Vondruš
@mosra
if you think there's something that i could add to AndroidApplication to make this easier to do externally, feel free to suggest that :)
hsdk123
@hsdk123

android context

https://gist.github.com/hsdk123/ea5b70493cc0923cb48de1bb86c6fbfe
https://gist.github.com/hsdk123/3a392070192bfaa6e97348f6023160d3

I remember having to do the same thing and ended up copying most of the androidapplication class and modifying it. @mosra if you might be able to take this into androidapplication, would be great

hsdk123
@hsdk123

Hey all, I'm using magnum's phong shader, but I'm getting different results on windows/emscripten vs mobile (android, ios).

On Windows / emscripten:

gamen.png
image0 (1).png
I can tell it probably has something to do with lighting, but I'm not sure where to start looking. Any suggestions?
(all running on opengl es)
Fo Nz
@FoNz99089892_twitter

I can tell it probably has something to do with lighting, but I'm not sure where to start looking. Any suggestions?

Try to look at JS console... maybe there is something.

Fo Nz
@FoNz99089892_twitter

I remember having to do the same thing and ended up copying most of the androidapplication class and modifying it. @mosra if you might be able to take this into androidapplication, would be great

This is fine, but you should destroy the old resources, like the GL Surface, when re-creating the new one, otherwise you will result in a memory leak!

Fo Nz
@FoNz99089892_twitter
I have done it! Keep the GL Context in memory on Android is definitely possible! I would borrow the code from @hsdk123 with the eglDestroySurface on the old surface, when the app requires a new surface.
OptimusLime
@OptimusLime
Howdy, long time lurker, I am experiencing some build issues that I've tried to track down for quite a few hours. The issue doesn't appear if I clone magnum into a folder and cmake add_subdirectory(... EXCLUDE_FROM_ALL). However, if I use Cmake "FetchContent" to clone the github repo, then when I build I get a whole bunch of errors like this:
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,66): warning C4346: 'Magnum::Math::IsScalar<T>::value': dependent name is not a type [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,66): message : prefix with 'typename' to indicate a type [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,82): error C2146: syntax error: missing ')' before identifier 'value' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,82): error C2365: 'T': redefinition; previous definition was 'template parameter' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53): message : see  declaration of 'T' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,82): error C2061: syntax error: identifier 'value' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,19): error C2059: syntax error: ')' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,82): error C2146: syntax error: missing ')' before identifier 'min' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,82): error C2146: syntax error: missing ';' before identifier 'min' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,102): error C2143: syntax error: missing ';' before '{' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(53,102): error C2447: '{': missing function header (old-style formal list?) [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,66): warning C4346: 'Magnum::Math::IsScalar<T>::value': dependent name is not a type [C:\Users\paul\coding\neurite\frontiers\scratch\sdlcs_helloworld_multiplatform\plugins\mag-plugin-node-api\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,66): message : prefix with 'typename' to indicate a type [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,82): error C2146: syntax error: missing ')' before identifier 'value' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,82): error C2365: 'T': redefinition; previous definition was 'template parameter' [C:\Users\paul\coding\neurite\frontiers\scratch\sdlcs_helloworld_multiplatform\plugins\mag-plugin-node-api\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56): message : see declaration of 'T' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,82): error C2061: syntax error: identifier 'value' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,19): error C2059: syntax error: ')' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,82): error C2146: syntax error: missing ')' before identifier 'max' [C:\coding\build\plugin-node-api.vcxproj]
C:\coding\build\_deps\magnum-src\src\Magnum/Math/Vector.h(56,82): error C2146: syntax error: missing ';' before identifier 'max' [C:\coding\build\plugin-node-api.vcxproj]
FetchContent simply clones into a directory build/_deps/magnum-src and then builds to build/_deps/mangum-build. Nothing special. Any ideas on why this might be happening?
Vladimír Vondruš
@mosra
on line 53 there's a definition of a min() function
so i have a hunch that this has something to do with windows.h and the insane macros there
build with #define NOMINMAX? :)
in all places in magnum where i'm including windows.h i'm defining this, so this is probably due to your code (or a 3rd party lib used by your code) including windows.h without defining NOMINMAX first
OptimusLime
@OptimusLime
I just got back to the computer. Wow, that did it! I can't thank you enough, that was so difficult to track down.
Innokentiy Alaytsev
@Innokentiy-Alaytsev
IMHO, the best solution is to define NOMINMAX globally for the entire project through CMake target property (target_compile_definitions or something). In theory, Magnum could do that the same way and make in PUBLIC. The latter has the downside of being totalitarian.
OptimusLime
@OptimusLime
I did it through "add_compile_definitions(NOMINMAX)" in CMake. Is this a pretty common error case when getting started with Magnum and Windows?
hsdk123
@hsdk123
Hey all, referring back to my question on the phong shader - would anyone know what might be happening?
Vladimír Vondruš
@mosra

Is this a pretty common error case when getting started with Magnum and Windows?

@OptimusLime you'd hit this whenever there's a variable or a function defined min or max anywhere, so i wouldn't say this is specific to Magnum, even the standard <limits> header has issues with this ... so i'd say dealing with NOMINMAX is a common Windows practice? (not a Windows user myself tho)

@hsdk123 sorry, forgot to reply :) i have some ideas:
  • the red window blinds are also a Phong shader? or something different
  • could it be some uninitialized variable that's just lucky to be non-zero on emscripten/desktop but is zero on the phone?
  • what all features do you enable for it? is it textured (is it possible that it's referencing some uninitialized texture)?
  • if you set the ambient color to something non-black, does anything change?
  • if not, does anything change if you set light count to 0?
  • if you enable GL debug output on the (android) phone, do you get any messages / errors? or, in case of iOS, the GL debugger in Xcode?
  • is the ANGLE translation layer involved in this or are you running directly on device GL drivers?
hsdk123
@hsdk123

@mosra

the red window blinds

This is just the clear colour coming through.

angle

On windows it's angle, and then for browser it's emscripten. The windows + emscripten outputs are the same (The model shows with shading). The ios + android outputs are the same (model doesn't show)

I'll try think on the other points!