René's URL Explorer Experiment


Title: GLSL renders to squared output · Issue #2 · WebGLSamples/WebGLSamples.github.io · GitHub

Open Graph Title: GLSL renders to squared output · Issue #2 · WebGLSamples/WebGLSamples.github.io

X Title: GLSL renders to squared output · Issue #2 · WebGLSamples/WebGLSamples.github.io

Description: After using square-sized sprites and everything worked great, the moment I have tried a rectangular sprite with the size of 20x200, I have realized that it forces the output to 20x20, it only considers the width of the sprite and forces ...

Open Graph Description: After using square-sized sprites and everything worked great, the moment I have tried a rectangular sprite with the size of 20x200, I have realized that it forces the output to 20x20, it only consi...

X Description: After using square-sized sprites and everything worked great, the moment I have tried a rectangular sprite with the size of 20x200, I have realized that it forces the output to 20x20, it only consi...

Opengraph URL: https://github.com/WebGLSamples/WebGLSamples.github.io/issues/2

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"GLSL renders to squared output","articleBody":"After using square-sized sprites and everything worked great, the moment I have tried a rectangular sprite with the size of 20x200, I have realized that it forces the output to 20x20, it only considers the width of the sprite and forces the height to be the same as the width\n\n[jsFiddle here](http://jsfiddle.net/dfjcdg1p/4/)\n\nIf you will inspect the canvas, you will see that it has the proper sizes: 20x200\n\nI have used your shaders to render:\n\nVertex Shader:\n\n```\n        uniform float u_frameOffset;\n        uniform vec4 u_screenDims;\n        attribute vec2 centerPosition;\n        attribute float rotation;\n        attribute float perSpriteFrameOffset;\n        attribute float spriteSize;\n        attribute vec2 cornerOffset;\n        attribute vec2 spriteTextureSize;\n        attribute float spritesPerRow;\n        attribute float numFrames;\n        attribute vec4 textureWeights;\n        varying vec2 v_texCoord;\n        varying vec4 v_textureWeights;\n\n        void main() {\n          float frameNumber = mod(u_frameOffset + perSpriteFrameOffset, numFrames);\n          float row = floor(frameNumber / spritesPerRow);  // Compute the upper left texture coordinate of the sprite\n          vec2 upperLeftTC = vec2(spriteTextureSize.x * (frameNumber - (row * spritesPerRow)),\n                                  spriteTextureSize.y * row);\n          vec2 tc = upperLeftTC + spriteTextureSize * (cornerOffset + vec2(0.5, 0.5));\n          v_texCoord = tc;\n          v_textureWeights = textureWeights;\n          float s = sin(rotation);\n          float c = cos(rotation);\n          mat2 rotMat = mat2(c, -s, s, c);\n          // vec2 scaledOffset = spriteSize * cornerOffset;\n          vec2 scaledOffset = spriteSize * cornerOffset;\n          vec2 pos = centerPosition + rotMat * scaledOffset;\n          gl_Position = vec4(pos * u_screenDims.xy + u_screenDims.zw, 1.0, 1.0);\n        }\n```\n\nFragment Shader:\n\n```\n        precision mediump float;\n        uniform sampler2D u_texture0;\n        uniform sampler2D u_texture1;\n        uniform sampler2D u_texture2;\n        uniform sampler2D u_texture3;\n        varying vec2 v_texCoord;\n        varying vec4 v_textureWeights;\n        void main() {\n          vec4 color;\n          if (v_textureWeights.x \u003e 0.0)\n            color = texture2D(u_texture0, v_texCoord);\n          else if (v_textureWeights.y \u003e 0.0)\n            color = texture2D(u_texture1, v_texCoord);\n          else if (v_textureWeights.z \u003e 0.0)\n            color = texture2D(u_texture2, v_texCoord);\n          else // v_textureWeights.w \u003e 0.0\n            color = texture2D(u_texture3, v_texCoord);\n          gl_FragColor = color;\n        }\n```\n\nMy GLSL knowledge isn't very strong yet and I'd appreciate any help to make it render with the original width \u0026 height.\nRight now I see that the Vertex Shader accepts only spriteSize (which is only the width of the sprite) as a parameter when calculating position \u0026 sizes.\n","author":{"url":"https://github.com/catalinberta","@type":"Person","name":"catalinberta"},"datePublished":"2015-06-10T11:42:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2/WebGLSamples.github.io/issues/2"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b7626655-7455-99eb-b982-f2825e169a1b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8A38:DF47A:85CDDA3:AD235E8:6975D3AA
html-safe-nonced700fdabc097ca77bb3134a5233ac832243470288c5cf33c41aa61335621566f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTM4OkRGNDdBOjg1Q0REQTM6QUQyMzVFODo2OTc1RDNBQSIsInZpc2l0b3JfaWQiOiI0MjA5OTQyNTI3NDQ5ODc5NDY2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacef42b8d77b8ff39897b76505178028cccea5801470addcf504dd2a2138135c4a
hovercard-subject-tagissue:86938958
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/WebGLSamples/WebGLSamples.github.io/2/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f53d93305316a27200408120ad27c4d7714264e927b33eb8828bdaa5e1ed4768/WebGLSamples/WebGLSamples.github.io/issues/2
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f53d93305316a27200408120ad27c4d7714264e927b33eb8828bdaa5e1ed4768/WebGLSamples/WebGLSamples.github.io/issues/2
og:image:altAfter using square-sized sprites and everything worked great, the moment I have tried a rectangular sprite with the size of 20x200, I have realized that it forces the output to 20x20, it only consi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecatalinberta
hostnamegithub.com
expected-hostnamegithub.com
None4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f
turbo-cache-controlno-preview
go-importgithub.com/WebGLSamples/WebGLSamples.github.io git https://github.com/WebGLSamples/WebGLSamples.github.io.git
octolytics-dimension-user_id9687040
octolytics-dimension-user_loginWebGLSamples
octolytics-dimension-repository_id26513148
octolytics-dimension-repository_nwoWebGLSamples/WebGLSamples.github.io
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id26513148
octolytics-dimension-repository_network_root_nwoWebGLSamples/WebGLSamples.github.io
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
release488b30e96dfd057fbbe44c6665ccbc030b729dde
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues/2#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FWebGLSamples%2FWebGLSamples.github.io%2Fissues%2F2
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%2FWebGLSamples%2FWebGLSamples.github.io%2Fissues%2F2
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=WebGLSamples%2FWebGLSamples.github.io
Reloadhttps://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues/2
Reloadhttps://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues/2
Reloadhttps://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues/2
WebGLSamples https://patch-diff.githubusercontent.com/WebGLSamples
WebGLSamples.github.iohttps://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FWebGLSamples%2FWebGLSamples.github.io
Fork 287 https://patch-diff.githubusercontent.com/login?return_to=%2FWebGLSamples%2FWebGLSamples.github.io
Star 957 https://patch-diff.githubusercontent.com/login?return_to=%2FWebGLSamples%2FWebGLSamples.github.io
Code https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io
Issues 5 https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues
Pull requests 2 https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/pulls
Actions https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/actions
Projects 0 https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/projects
Wiki https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/wiki
Security 0 https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/security
Insights https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/pulse
Code https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io
Issues https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues
Pull requests https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/pulls
Actions https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/actions
Projects https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/projects
Wiki https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/wiki
Security https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/security
Insights https://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/WebGLSamples/WebGLSamples.github.io/issues/2
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/WebGLSamples/WebGLSamples.github.io/issues/2
GLSL renders to squared outputhttps://patch-diff.githubusercontent.com/WebGLSamples/WebGLSamples.github.io/issues/2#top
https://github.com/catalinberta
https://github.com/catalinberta
catalinbertahttps://github.com/catalinberta
on Jun 10, 2015https://github.com/WebGLSamples/WebGLSamples.github.io/issues/2#issue-86938958
jsFiddle herehttp://jsfiddle.net/dfjcdg1p/4/
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.