Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:24:28+00:00 2026-06-08T21:24:28+00:00

Edit This was a bug that has been fixed in https://github.com/threerings/playn/commit/137ce50dddd2716f84c38ec1568d7ae5a368434b . See Par

  • 0

Edit This was a bug that has been fixed in https://github.com/threerings/playn/commit/137ce50dddd2716f84c38ec1568d7ae5a368434b. See Par Eklund’s answer for details.

Before I begin: I am a novice at game programming in general so it’s very likely that I have a fundamental misunderstanding of the tools I am using. However I’ll push on with my question…

Whenever I try to draw something on my Surface Layer during the paint method I get a black screen. If I draw during the init method it shows up OK.

I am trying to replicate the code under the Surface Layer banner here. The code in question is this:

public void paint() {
  // Draw 100 random peas imperatively.
  surf.clear(0);
  for (int i = 0; i < 100; ++i) {
    int x = (int)(random() * WIDTH);
    int y = (int)(random() * HEIGHT);
    surf.drawImage(pea, x, y);
  }
}

I am using PlayN 1.4 so while that code doesn’t directly match up to what I am writing I thought I at least had the equivalent (except I am drawing white rectangles):

public void paint(final float alpha) {
  surfaceLayer.surface().clear();
  surfaceLayer.surface().setFillColor(Color.rgb(255, 255, 255));
  for (int i = 0; i < 100; ++i) {
    int x = (int) (Math.random() * width);
    int y = (int) (Math.random() * height);
    surfaceLayer.surface().fillRect(x, y, 5, 5);
  }
}

Nothing is rendered to the screen. If I move that code into the init method it renders as expected.

Now interestingly if I make PlayN 1.3.1 project and use the exact same code it renders fine during the paint method (given that I’m still using the exact same code I’m not sure what version the PlayN website is using in its example code…).

What have I missed here? Has 1.4 changed something to do with the Surface Layer and I must use it differently now? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:24:29+00:00Added an answer on June 8, 2026 at 9:24 pm

    I am basically a novice to game programming myself and I have run in to the same problem as you (same symptoms at least) with PlayN 1.5-SNAPSHOT. I filed an issue for it here: http://code.google.com/p/playn/issues/detail?id=205

    Also, my experience is that it does not seem to be specifically related to whether rendering is done in the init- or the paint method. Rather, it seems as if rendering only succeeds the _first_time_ (first frame rendering occurs). Please see the attached file in the issue for a (somewhat) minimal example.

    Like I stated in the issue, I suspect that this is related to the GL20 implementation and how frame buffers are being managed, but given that I am even more a novice on OpenGL you should take my speculation with a huge grain of salt.

    The PlayN main contributors should be able to answer and solve this pretty quickly though. Let’s hope that we receive their attention soon. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit : The bug that caused this problem has been fixed. The @version tag
EDIT : As of 2012-06-11 this bug has been finally fixed! https://bugs.webkit.org/show_bug.cgi?id=35981#c1 I have
Edit: The bug which prompted this question has now been fixed . In the
EDIT: Sorry Guys, This has been resolved The comment to check the inline style
EDIT: This bug was logged, and confirmed as a Facebook bug . It has
Edit This question has gone through a few iterations by now, so feel free
EDIT: This issue is already submitted on Github. Changing the Act part to this
Sorry If something like this has already been asked, but I can't find exactly
I was bit this week by a bug that occurred when my code was
EDIT: We're in Chrome 19 now, and this still isn't fixed. Just a clarification:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.