Giter Site home page Giter Site logo

Comments (13)

lojjic avatar lojjic commented on August 16, 2024 1

Thank you @jmatsushita, that's helpful!

from troika.

lojjic avatar lojjic commented on August 16, 2024

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.

lojjic avatar lojjic commented on August 16, 2024

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.

drcmda avatar drcmda commented on August 16, 2024

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.

@lojjic

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.

lojjic avatar lojjic commented on August 16, 2024

@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.

drcmda avatar drcmda commented on August 16, 2024

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.

lojjic avatar lojjic commented on August 16, 2024

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.

lojjic avatar lojjic commented on August 16, 2024

Closing this. Feel free to reopen if you can provide info on what issue(s) may actually be occurring.

from troika.

jmatsushita avatar jmatsushita commented on August 16, 2024

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)?

IMG_6086

I'll try and do a reproducer repo that has minimal dependencies.

from troika.

jmatsushita avatar jmatsushita commented on August 16, 2024

Added a simple repro repo https://github.com/jmatsushita/expo-drei-troika

from troika.

lojjic avatar lojjic commented on August 16, 2024

Cross-linking for reference: pmndrs/drei#1396

from troika.

CristobalAlvarez avatar CristobalAlvarez commented on August 16, 2024

@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.

hhsaez avatar hhsaez commented on August 16, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.