Comments (13)
Thank you @jmatsushita, that's helpful!
from troika.
Hmm. Honestly I haven't given any thought to react-native at all. I'm definitely not opposed to trying to make it work, but I have no experience with it or how it might differ from the web. Is there an easy way I could test it out with my total lack of knowledge? 😬
I also haven't really considered offline sdf generation, since getting away from that was the main driver behind why I wrote this module in the first place. I suppose it could be possible but it feels like such a step backward that I'd need a really compelling reason.
from troika.
I'm curious if the latest release (included in drei 0.0.41) improves the react-native situation at all. It removes a hard dependency on document
and introduces a main-thread fallback when web workers are not supported, which may get it closer at least. @jmatsushita would you be able to test it out and report back?
from troika.
I also haven't really considered offline sdf generation, since getting away from that was the main driver behind why I wrote this module in the first place. I suppose it could be possible but it feels like such a step backward that I'd need a really compelling reason.
the upside to this is of course that troika would become cross platform. when r3f runs in RN it isn't constrained to a web view any longer, it runs natively in opengles. with microsofts recent work on RN this may soon extend to all platforms: android, ios, windows, macos, linux.
the catch is that these platforms do not use browser tech (ajax requests, stuff like that). if troika would allow users to still use it somehow it would become the defacto standard for text in x-platforms gl apps. 👍
from troika.
@drcmda De facto standard?! LOL no pressure! 😄
I feel like RN support should be possible without resorting to offline generation. Those two items I mentioned above may get us most of the way there, but since I have zero RN experience I'm going to need help verifying it and identifying additional issues.
from troika.
RN is more or less established but the new batch is about to come. microsoft is making it their official platform api, so people that develop for windows will use RN, and macos probably, too. im really excited for what will happen to the gpu space, where we're not tied to webgl any longer, yet we can use threejs and javascript, as it is.
RN compatible is basically plain javascript, so no ajax, document, window, all the browser stuff falls out. you would most likely import things via bundle splitting:
const font = await import(`/fonts/${name}.woff`)
so we will have the raw data, or arraybuffers ready. if troika can somehow handle that, it's good to go! 🤝
from troika.
I'm speculating but it sounds like XMLHttpRequest is supported, so I'm thinking the loading part should work if the bundled font is supplied as a data:
URI...? I'd be willing to add alternative loading methods e.g. the import
if there's a good way to detect the RN environment.
from troika.
Closing this. Feel free to reopen if you can provide info on what issue(s) may actually be occurring.
from troika.
Here's some news from the future ;) Happy to open a new issue if you prefer.
I've tried this again and got this error. I suppose that the canvas is now used to store the glyph atlases. Maybe we could pass the expo-gl
Canvas instance through to [webgl-sdf-generator](https://github.com/lojjic/webgl-sdf-generator)
?
I'll try and do a reproducer repo that has minimal dependencies.
from troika.
Added a simple repro repo https://github.com/jmatsushita/expo-drei-troika
from troika.
Cross-linking for reference: pmndrs/drei#1396
from troika.
@jmatsushita did you achieve use text? im having the same error here, with a simple component. Im using React Native with Expo.
import { Text } from "@react-three/drei/native";
import React from "react";
const SimpleText = () => {
return (
<Text color="black" anchorX="center" anchorY="middle">
hello world!
</Text>
);
};
export default SimpleText;
from troika.
@jmatsushita I'm also interested to know if you manage to use text from RN. I'm not using RN myself, but I'm trying to get text working when rendering using Three within web workers, and I'm getting the same error. Did you find any workaround?
from troika.
Related Issues (20)
- Text.sync can't update the mesh smoothly when I excute sync method quickly HOT 3
- About fonts CDN HOT 3
- Can I call sync with async/await syntax? HOT 2
- Util function getCaretAtPoint can't get the uniform text caret vertical position for number/character and Chinese text. HOT 5
- Runtime error: 'webgl-sdf-generator' does not contain a default export (imported as 'createSDFGenerator'). HOT 3
- Emoji and Unicode support HOT 3
- Memory Issue with troika-three-text HOT 5
- troika-three-text: Indic shaping
- getCaretAtPoint(...) taking surrogate pairs into consideration HOT 2
- Support ligature caret positioning provided in font
- anchorY="bottom-baseline" not working since v0.48.0 HOT 2
- Glitches when used with Montserrat HOT 2
- Cloning a synced text still requires sync();
- [ Angular 17 ] - TS2307: Cannot find module 'troika-three-text' or its corresponding type declaratio HOT 1
- troika-three-text uncaught exception HOT 8
- Apply GLSL shader to only some letters
- Fix netlify links in documentation
- Cannot set property customDepthMaterial of #<InstancedUniformsMesh> which has only a getter
- LinearEncoding was not found in 'three'
- troika-three-text: mesh.textRenderInfo missing lineHeight and other font metrics HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from troika.