Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draw_vertex_texture primitives have confusing UV behaviour compared to vertex buffers #2536

Closed
JordOfTheFlies opened this issue Dec 19, 2023 — with GM Bug Reporter · 1 comment
Assignees
Labels
project This issue has a sample project attached runner-bug In-game bugs with the "GameMaker Studio 2" runtimes

Comments

@JordOfTheFlies
Copy link

Description

Simply put, vertex primitives (i.e. draw_vertex_texture) seem to automatically normalise texture coordinates to the specific texture given instead of the whole texture page (where UV [1,1] is the bottom right corner of the texture rather than the texture page), whereas vertex_buffers operate on the whole texture page.
The former resulting in wrong results when using functions like texture_get_uvs and texture_get_texel_width (the former of which is specifically stated in the manual as being of use for 2D primitive functions).
Perhaps more of an oddity if you just want to draw the entirety of a texture, but if you're trying to draw a section of a texture a whole other approach needs to be taken to get the correct UVs.

The behaviour should either consistent between functions, or the manual is changed to reflect that UVs won't work as expected with such functions and that coordinates will need to be calculated differently. The manual currently, outside of perhaps the argument names, doesn't indicate that there's any difference in how UVs work between the two functions.

Steps To Reproduce

  1. Attempt to draw a sprite using any of the named function
  2. The result will be wrong unless the texture page is otherwise empty

4cfeff9c-9e3b-4650-9e1e-6a1d6db54f52

@gm-bug-reporter gm-bug-reporter bot added runner-bug In-game bugs with the "GameMaker Studio 2" runtimes project This issue has a sample project attached labels Dec 19, 2023
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Jan 9, 2024
…ompared to vertex buffers

YoYoGames/GameMaker-Bugs#2536
* Updated the "Primitives and Vertex Formats" page:
  * Defined a bit better what a primitive is
  * Inserted image with the pr_* constants on this page (since they're shared between primitives and vertex buffers)
  * Added an introduction to both primitives and vertex buffers, most basic use with copy-pastable examples
  * Added a section on Texture Coordinates after the introductions to both to point out the difference in uvs
* Moved the "enable WebGL on HTML5" note to a snippet
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Jan 9, 2024
…ompared to vertex buffers

YoYoGames/GameMaker-Bugs#2536
* Added clarification on what the uv coordinates refer to on related pages
* Added a sentence on the surface_get_texture page to explain that it returns an ID, rather than a pointer
* Moved "power of two requirement" note to a snippet
@YYBartT
Copy link

YYBartT commented Jan 9, 2024

Added the info, together with a general overview on using primitives and vertex buffers to the Primitives and Vertex Formats page.

@YYBartT YYBartT closed this as completed Jan 9, 2024
gurpreetsinghmatharoo pushed a commit to YoYoGames/GameMaker-Manual that referenced this issue Aug 8, 2024
…ompared to vertex buffers

YoYoGames/GameMaker-Bugs#2536
* Updated the "Primitives and Vertex Formats" page:
  * Defined a bit better what a primitive is
  * Inserted image with the pr_* constants on this page (since they're shared between primitives and vertex buffers)
  * Added an introduction to both primitives and vertex buffers, most basic use with copy-pastable examples
  * Added a section on Texture Coordinates after the introductions to both to point out the difference in uvs
* Moved the "enable WebGL on HTML5" note to a snippet

(cherry picked from commit 519fb69)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project This issue has a sample project attached runner-bug In-game bugs with the "GameMaker Studio 2" runtimes
Projects
None yet
Development

No branches or pull requests

3 participants