René's URL Explorer Experiment


Title: PGraphics loadPixels() seems to not set/check .loaded flag in P2D · Issue #6214 · processing/processing · GitHub

Open Graph Title: PGraphics loadPixels() seems to not set/check .loaded flag in P2D · Issue #6214 · processing/processing

X Title: PGraphics loadPixels() seems to not set/check .loaded flag in P2D · Issue #6214 · processing/processing

Description: Description Whenever loadPixels() is used on a PGraphics object in a P2D context, it seems to literally download the texture every time, regardless of whether it's been called/downloaded before. In the standard renderer, it seems like su...

Open Graph Description: Description Whenever loadPixels() is used on a PGraphics object in a P2D context, it seems to literally download the texture every time, regardless of whether it's been called/downloaded before. In...

X Description: Description Whenever loadPixels() is used on a PGraphics object in a P2D context, it seems to literally download the texture every time, regardless of whether it's been called/downloaded before...

Opengraph URL: https://github.com/processing/processing/issues/6214

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PGraphics loadPixels() seems to not set/check .loaded flag in P2D ","articleBody":"## Description\r\nWhenever loadPixels() is used **on a PGraphics object** in a P2D context, it seems to literally download the texture every time, regardless of whether it's been called/downloaded before. In the standard renderer, it seems like subsequent loadPixels() calls do not result in numerous texture downloads.\r\n\r\n## Expected Behavior\r\nI was expecting the loadPixels() function to check the isLoaded() / loaded flag before deciding on whether the pixel array has to be recreated or not.\r\n\r\n## Current Behavior\r\nIn P2D, calling loadPixels on a large PGraphics texture numerous times a frame absolutely wrecks the frame rate, as it should if it recreates/downloads the buffer every time. The standard renderer seems to ignore subsequent loadPixels() calls to the same PGraphics texture. On standard PImage files this issue does not exist. Only PGraphics objects passed into / converted to PImage objects, see example below.\r\n\r\n## Steps to Reproduce\r\n```\r\nPGraphics pg;\r\n\r\nvoid setup()\r\n{\r\n  size(500, 500, P2D);\r\n  frameRate(60);\r\n\r\n  //pg = createGraphics(width, height); // 60fps - works as expected; PImage.loadPixels() call in sampleColour ignored \r\n  pg = createGraphics(width, height, P2D); // 2fps - performance seemingly wrecked by pg.loadPixels() in sampleColour() \r\n}\r\n\r\nvoid draw()\r\n{\r\n  surface.setTitle(\"FPS: \"+nf(frameRate, 1, 1));\r\n\r\n  /*\r\n  This example replicates the PImage.get() behaviour\r\n  creating a 'sampleColour' method to illustrate the issue\r\n  */\r\n  \r\n  // update offscreen pg \u0026 prepare texture for sampling\r\n  pg.beginDraw();\r\n  pg.background(0);\r\n  pg.fill(255);\r\n  pg.ellipse(pg.width/2, pg.height/2, pg.width, pg.height);\r\n  pg.endDraw();\r\n  \r\n  pg.loadPixels(); // safeguard for removing/commenting the loadPixels in the sampleColour function below\r\n\r\n  int numX = 20;\r\n  int numY = 20;\r\n\r\n  for(int i = 0; i \u003c numX; i++)\r\n    for(int j = 0; j \u003c numY; j++)\r\n    {\r\n      float normX = (i+0.5f)/float(numX);\r\n      float normY = (j+0.5f)/float(numY);\r\n      color c = sampleColour(pg, normX, normY);\r\n      \r\n      fill(c);\r\n      rectMode(CENTER);\r\n      rect(normX*width, normY*height, width/numX, height/numY);\r\n    }\r\n}\r\n\r\ncolor sampleColour(PImage img, float normX, float normY)\r\n{\r\n  img.loadPixels(); // with this uncommented, this function wrecks the sketch in P2D - but not in the standard renderer\r\n  return img.pixels[int(normY * img.height) * img.width + int(normX * img.width)];\r\n}\r\n```\r\n\r\n## Your Environment\r\n* Processing version: Both 3.5.4 and 4.0b1\r\n* Operating System and OS version: macOS Big Sur 11.4 (20F71)\r\n* Other information:\r\n","author":{"url":"https://github.com/rapatski","@type":"Person","name":"rapatski"},"datePublished":"2021-08-26T12:36:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/6214/processing/issues/6214"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:260e5c0c-fb25-0bde-09d5-030bd49dea7d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE010:287A4D:4E8668:6CCBB1:696FE185
html-safe-nonce87e97480aa5c15477fde59968649128fe55fee4ed849f8d4a459635cf505a6be
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDEwOjI4N0E0RDo0RTg2Njg6NkNDQkIxOjY5NkZFMTg1IiwidmlzaXRvcl9pZCI6IjU3MDQ1NjAzOTAxOTY2ODMxNDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacda4ea4cf40188339de71519388232bb2f57539e6dc37af00ba73333e19dff2fa
hovercard-subject-tagissue:980195445
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/processing/processing/6214/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d9f858f00a25079eb38c3bdce9471d35710ee8d3b02db311a4852e3e2605c50a/processing/processing/issues/6214
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d9f858f00a25079eb38c3bdce9471d35710ee8d3b02db311a4852e3e2605c50a/processing/processing/issues/6214
og:image:altDescription Whenever loadPixels() is used on a PGraphics object in a P2D context, it seems to literally download the texture every time, regardless of whether it's been called/downloaded before. In...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerapatski
hostnamegithub.com
expected-hostnamegithub.com
Nonea5d30ba41f7d9acded2fd135aa830ac2f5c7e52dca0e776e658d37eaf9dfb033
turbo-cache-controlno-preview
go-importgithub.com/processing/processing git https://github.com/processing/processing.git
octolytics-dimension-user_id1617169
octolytics-dimension-user_loginprocessing
octolytics-dimension-repository_id7807399
octolytics-dimension-repository_nwoprocessing/processing
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7807399
octolytics-dimension-repository_network_root_nwoprocessing/processing
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2f945b7bb88421600e89dfefbb1548ad0a44781a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/processing/processing/issues/6214#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing%2Fissues%2F6214
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing%2Fissues%2F6214
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=processing%2Fprocessing
Reloadhttps://patch-diff.githubusercontent.com/processing/processing/issues/6214
Reloadhttps://patch-diff.githubusercontent.com/processing/processing/issues/6214
Reloadhttps://patch-diff.githubusercontent.com/processing/processing/issues/6214
processing https://patch-diff.githubusercontent.com/processing
processinghttps://patch-diff.githubusercontent.com/processing/processing
Please reload this pagehttps://patch-diff.githubusercontent.com/processing/processing/issues/6214
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fprocessing%2Fprocessing
Fork 1.5k https://patch-diff.githubusercontent.com/login?return_to=%2Fprocessing%2Fprocessing
Star 6.5k https://patch-diff.githubusercontent.com/login?return_to=%2Fprocessing%2Fprocessing
Code https://patch-diff.githubusercontent.com/processing/processing
Issues 471 https://patch-diff.githubusercontent.com/processing/processing/issues
Pull requests 23 https://patch-diff.githubusercontent.com/processing/processing/pulls
Actions https://patch-diff.githubusercontent.com/processing/processing/actions
Wiki https://patch-diff.githubusercontent.com/processing/processing/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/processing/processing/security
Please reload this pagehttps://patch-diff.githubusercontent.com/processing/processing/issues/6214
Insights https://patch-diff.githubusercontent.com/processing/processing/pulse
Code https://patch-diff.githubusercontent.com/processing/processing
Issues https://patch-diff.githubusercontent.com/processing/processing/issues
Pull requests https://patch-diff.githubusercontent.com/processing/processing/pulls
Actions https://patch-diff.githubusercontent.com/processing/processing/actions
Wiki https://patch-diff.githubusercontent.com/processing/processing/wiki
Security https://patch-diff.githubusercontent.com/processing/processing/security
Insights https://patch-diff.githubusercontent.com/processing/processing/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/processing/processing/issues/6214
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/processing/processing/issues/6214
PGraphics loadPixels() seems to not set/check .loaded flag in P2D https://patch-diff.githubusercontent.com/processing/processing/issues/6214#top
https://github.com/rapatski
https://github.com/rapatski
rapatskihttps://github.com/rapatski
on Aug 26, 2021https://github.com/processing/processing/issues/6214#issue-980195445
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.