Browse Source

Merge pull request #7210 from jynus/issue7162

Update code to 4.0+ for screenshotting the viewport tutorial
Matthew 2 years ago
parent
commit
cd7b520c76
1 changed files with 3 additions and 4 deletions
  1. 3 4
      tutorials/rendering/viewports.rst

+ 3 - 4
tutorials/rendering/viewports.rst

@@ -138,14 +138,13 @@ following code:
 
 ::
 
-   # Retrieve the captured Image using get_data().
-   var img = get_viewport().get_texture().get_data()
+   # Retrieve the captured Image using get_image().
+   var img = get_viewport().get_texture().get_image()
    # Flip on the Y axis.
    # You can also set "V Flip" to true if not on the root Viewport.
    img.flip_y()
    # Convert Image to ImageTexture.
-   var tex = ImageTexture.new()
-   tex.create_from_image(img)
+   var tex = ImageTexture.create_from_image(img)
    # Set sprite texture.
    $sprite.texture = tex