-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Feature/build for macos #25
Feature/build for macos #25
Conversation
- Fix when "swapped" height and width in outputTexture after WebCamTexture initialziton;
private bool IsWebCamTextureInitialized() | ||
{ | ||
//At least on OSX, at the beginning webCamTexture always has 16x16 size. So we must wait, until size will be correct | ||
return webCamTexture.width > TEXTURE_SIZE_THRESHOLD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to check whether the size is set correctly.
return webCamTexture.width == DefaultWidth && webCamTexture.height == DefaultHeight;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it will be work in all cases. For example when you request DefaultWidth = 480, webCamTexture return 640 (at least at OS X). If you request DefaultWidth = 640, it return 640.
p.s. also code will crash in that point and other, if requested resolution is not supported (for example i request full HD, but my web cam support only HD. I think it doesn't matter at current moment, because as i understand you completely change the way like SDK will work with webCamTexture and pixels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example when you request DefaultWidth = 480, webCamTexture return 640 (at least at OS X). If you request DefaultWidth = 640, it return 640.
Yes, because the actual value is set in each .unity
file (those values are overwritten).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, that real value come from .unity file, and values from code will be overwritten :) I'm talking about the values that WebCamTexture returns at runtime after we have passed our values (overwritten by .unity) to the WebCamTexture constructor.
Look at the screen, that was done from debug view in studio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Now I see.
Hmm...certainly it looks that the value cannot be predicted (https://docs.unity3d.com/ScriptReference/WebCamTexture-requestedHeight.html).
Will you change the comment like this? (if you use MacBook pro).
In fact, I'm not sure if it is OS X's problem (the camera may causes the issue).
// Some cameras may take time to be initialized, so wait here. (e.g. on MacBook Pro, the size of webCamTexture is 16x16 at the beginning.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think problem are more common. I came across several topics where people are faced with getting the correct dimensions for the texture. Just for example:
https://answers.unity.com/questions/232168/how-can-i-get-the-device-camera-aspect-ratio.html?_ga=2.132976206.1384449721.1606825289-1204939603.1605516746
https://answers.unity.com/questions/773464/webcamtexture-correct-resolution-and-ratio.html#answer-1148424
You don't have that problem on your device?
Of course i can change comment, but i don't sure that it will be right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think problem are more common.
I completely agree with you. That's why I would not like to particularly refer to OS X here.
You don't have that problem on your device?
Well, not yet for better or worse.
(cherry picked from commit 62e4fb5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM
Fix for issue #22 .
Now you can build a project for the OS X (CPU version).