libgdx / libgdx/libgdx

GWT build issue with Pixmap.createFromFrameBuffer

Open
#6,904 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
25.4k
Forks
6.5k
Avg merge
1d 16h
Merged PRs (30d)
5

Description

Issue details

It isn't possible to compile following code on GWT (required for taking screenshots):

Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
ByteBuffer pixels = pixmap.getPixels();

It gives following error when compiling: Type mismatch: cannot convert from Buffer to ByteBuffer

And seems to be caused by this line, with IDE showing the line as syntax error.

It shows also this and this line as syntax error with message Cannot resolve symbol 'pixmap', but I have no idea why and it isn't causing any problems for me (most likely because I am not calling those functions).

Version of libGDX and/or relevant dependencies

1.11.0

Please select the affected platforms
  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • macOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GWT compilation example in the issue and inspect gdx/src/com/badlogic/gdx/graphics/Pixmap.java at lines 103, 311, and 329. Reproduce the ByteBuffer/Buffer error for the HTML/GWT target, then verify that the reported syntax and symbol errors are resolved and the screenshot code compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, java
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.