Skip to content

Integrating three-globe with react-three-fiber #2719

Discussion options

You must be logged in to vote

Have you seen https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively ?

You can extend the globe and use it as a native element.

import React, { useRef, useLayoutEffect } from 'react'
import { extend } from 'react-three-fiber'
import ThreeGlobe from 'three-globe'

extend({ ThreeGlobe })

const Globe = (props) => {
  // This reference will give us direct access to the ThreeGlobe class
  const globeRef = useRef()

  // An effect that runs after three.js elements are created but before render
  useLayoutEffect(() => {
    // Configure the globe
    globeRef.current.globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
    globeRef.current.b…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@manhtuongta1996
Comment options

@rohanbhangui
Comment options

Answer selected by manhtuongta1996
Comment options

You must be logged in to vote
2 replies
@IlirBajrami
Comment options

@emre-turan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #2718 on January 17, 2023 21:12.