René's URL Explorer Experiment


Title: Unexpected Y-axis translation when using `ortho()` and `resetMatrix()` · Issue #891 · processing/processing4 · GitHub

Open Graph Title: Unexpected Y-axis translation when using `ortho()` and `resetMatrix()` · Issue #891 · processing/processing4

X Title: Unexpected Y-axis translation when using `ortho()` and `resetMatrix()` · Issue #891 · processing/processing4

Description: NoteThis issue is a repost of processing/processing#6175 by @usuallyannoyed, updated and edited for tone and clarity. Description The ortho() function does not behave as expected. Expected Behavior ortho(0, width, 0, height) with a clear...

Open Graph Description: NoteThis issue is a repost of processing/processing#6175 by @usuallyannoyed, updated and edited for tone and clarity. Description The ortho() function does not behave as expected. Expected Behavior...

X Description: NoteThis issue is a repost of processing/processing#6175 by @usuallyannoyed, updated and edited for tone and clarity. Description The ortho() function does not behave as expected. Expected Behavior...

Opengraph URL: https://github.com/processing/processing4/issues/891

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected Y-axis translation when using `ortho()` and `resetMatrix()`","articleBody":"\u003e [!NOTE]\r\n\u003e This issue is a repost of https://github.com/processing/processing/issues/6175 by @usuallyannoyed, updated and edited for tone and clarity.\r\n\r\n## Description  \r\nThe `ortho()` function does not behave as expected. \r\n\r\n## Expected Behavior  \r\n`ortho(0, width, 0, height)` with a cleared modelview matrix (`resetMatrix`) should allow users to draw within the specified bounds (e.g., `0` to `width` on the x-axis and `0` to `height` on the y-axis).  \r\n\r\n## Current Behavior  \r\nInstead, the drawing area behaves incorrectly, requiring adjustments (e.g., translating `-height` on the y-axis) to achieve the expected results. This behavior makes it unintuitive for users who expect the specified bounds to align with the visible viewport.  \r\n\r\n## Steps to Reproduce  \r\n```Processing\r\nvoid setup() {\r\n  size(500, 500, P3D);\r\n}\r\n\r\nvoid draw() {\r\n  ortho(0, width, 0, height);\r\n  resetMatrix(); // clear modelview matrix\r\n  fill(255);\r\n  \r\n  // Uncomment the line below to 'fix' the behavior\r\n  // translate(0, -height); \r\n  \r\n  beginShape(TRIANGLES);\r\n  vertex(640, 640);\r\n  vertex(0, 640);\r\n  vertex(0, 0);\r\n  endShape();\r\n}\r\n```  \r\n\r\n### Observed Result  \r\nThe triangle only becomes visible when compensating for the unexpected offset by translating the y-axis.  \r\n\r\n### Expected Result  \r\nThe triangle should appear within the specified `ortho` bounds without additional transformations.  \r\n\r\n## Environment  \r\n- **Operating System**: macOS 13.4 \r\n- **Processing Version**: 4.3.1  \r\n\r\n## Possible Causes / Solutions  \r\nThe issue appears to stem from the following block of code in the Processing source:  \r\n\r\nhttps://github.com/processing/processing4/blob/937f528c1638fa96bc8fde5a67483dad9de8b5c9/core/src/processing/opengl/PGraphicsOpenGL.java#L4482-L4486\r\n\r\nDespite the comment saying that `The minus sign is needed to invert the Y axis.`, this implementation does not fully invert the y-axis as intended. Instead, it flips the y-axis around zero, resulting in all the y-coordinates being offset into negative space.  \r\n\r\n### Suggested Fix  \r\nTo invert the y-axis properly in normalized device coordinates (NDC), pre-multiply the projection matrix with a `-1` scale for the y-axis. This can be achieved by modifying the projection matrix calculation as follows:  \r\n\r\n```java\r\n// Add a pre-multiplied -1 y scale to flip the y axis in NDC.\r\n    projection.set(x,  0, 0, tx,\r\n                   0, -y, 0, -ty,\r\n                   0,  0, z, tz,\r\n                   0,  0, 0,  1);\r\n```  \r\n\r\nThis approach ensures the y-axis behaves as expected without requiring additional transformations.  \r\n\r\n### Additional comments\r\nThis behavior stems from Processing's choice to have the Y-axis increase downward, consistent with traditional computer graphics. While reasonable, the implementation relies on ad-hoc adjustments throughout the code. Centralizing it at a lower level (NDC or viewport) and exposing it as an optional flag would provide more clarity and flexibility.","author":{"url":"https://github.com/SableRaf","@type":"Person","name":"SableRaf"},"datePublished":"2024-12-17T20:59:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/891/processing4/issues/891"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7d31406f-0158-c866-6379-0c652ddeb2c2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA08E:FE603:F8DBF6:143F392:696B0F11
html-safe-noncea9f3d59e264806ecb1e010958bfc6c9843fed3f937a1534f4d1551fcff7bd72b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDhFOkZFNjAzOkY4REJGNjoxNDNGMzkyOjY5NkIwRjExIiwidmlzaXRvcl9pZCI6IjkyMTIyNTExMDEyNzg3MDMzNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc718b04f104b35b77950c974bef8c0f8b2effed0667e4266445c49b52f1a851b
hovercard-subject-tagissue:2746045363
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/processing4/891/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d62527d602a7fe21b099a3ef5c4a83120d304e810889c5a1d21aa311439a0762/processing/processing4/issues/891
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d62527d602a7fe21b099a3ef5c4a83120d304e810889c5a1d21aa311439a0762/processing/processing4/issues/891
og:image:altNoteThis issue is a repost of processing/processing#6175 by @usuallyannoyed, updated and edited for tone and clarity. Description The ortho() function does not behave as expected. Expected Behavior...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSableRaf
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
go-importgithub.com/processing/processing4 git https://github.com/processing/processing4.git
octolytics-dimension-user_id1617169
octolytics-dimension-user_loginprocessing
octolytics-dimension-repository_id844382769
octolytics-dimension-repository_nwoprocessing/processing4
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id844382769
octolytics-dimension-repository_network_root_nwoprocessing/processing4
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
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/processing/processing4/issues/891#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing4%2Fissues%2F891
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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing4%2Fissues%2F891
Sign up https://github.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%2Fprocessing4
Reloadhttps://github.com/processing/processing4/issues/891
Reloadhttps://github.com/processing/processing4/issues/891
Reloadhttps://github.com/processing/processing4/issues/891
processing https://github.com/processing
processing4https://github.com/processing/processing4
Please reload this pagehttps://github.com/processing/processing4/issues/891
Notifications https://github.com/login?return_to=%2Fprocessing%2Fprocessing4
Fork 126 https://github.com/login?return_to=%2Fprocessing%2Fprocessing4
Star 311 https://github.com/login?return_to=%2Fprocessing%2Fprocessing4
Code https://github.com/processing/processing4
Issues 221 https://github.com/processing/processing4/issues
Pull requests 35 https://github.com/processing/processing4/pulls
Actions https://github.com/processing/processing4/actions
Projects 2 https://github.com/processing/processing4/projects
Wiki https://github.com/processing/processing4/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/processing/processing4/security
Please reload this pagehttps://github.com/processing/processing4/issues/891
Insights https://github.com/processing/processing4/pulse
Code https://github.com/processing/processing4
Issues https://github.com/processing/processing4/issues
Pull requests https://github.com/processing/processing4/pulls
Actions https://github.com/processing/processing4/actions
Projects https://github.com/processing/processing4/projects
Wiki https://github.com/processing/processing4/wiki
Security https://github.com/processing/processing4/security
Insights https://github.com/processing/processing4/pulse
New issuehttps://github.com/login?return_to=https://github.com/processing/processing4/issues/891
New issuehttps://github.com/login?return_to=https://github.com/processing/processing4/issues/891
#954https://github.com/processing/processing4/pull/954
Unexpected Y-axis translation when using ortho() and resetMatrix()https://github.com/processing/processing4/issues/891#top
#954https://github.com/processing/processing4/pull/954
bugSomething isn't workinghttps://github.com/processing/processing4/issues?q=state%3Aopen%20label%3A%22bug%22
help wantedExtra attention is neededhttps://github.com/processing/processing4/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/SableRaf
https://github.com/SableRaf
SableRafhttps://github.com/SableRaf
on Dec 17, 2024https://github.com/processing/processing4/issues/891#issue-2746045363
processing/processing#6175https://github.com/processing/processing/issues/6175
@usuallyannoyedhttps://github.com/usuallyannoyed
processing4/core/src/processing/opengl/PGraphicsOpenGL.javahttps://github.com/processing/processing4/blob/937f528c1638fa96bc8fde5a67483dad9de8b5c9/core/src/processing/opengl/PGraphicsOpenGL.java#L4482-L4486
937f528https://github.com/processing/processing4/commit/937f528c1638fa96bc8fde5a67483dad9de8b5c9
bugSomething isn't workinghttps://github.com/processing/processing4/issues?q=state%3Aopen%20label%3A%22bug%22
help wantedExtra attention is neededhttps://github.com/processing/processing4/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
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.