#Separate texture for a vertex buffer
17 messages · Page 1 of 1 (latest)
yeah
all kinds of ways
the easiest way is to get the UVs of the sprite and use those when building the vertex buffer
Do you have an example on how I could use the uvs to achieve that?
alright so you now how your sprites are all on a big ol texture right? like the texture is a sticker sheet and the sprites are stickers on it?
when we draw stuff to the screen, we use the whole sticker sheet not just the stickers, so to tell vertex buffers (which is how everything is drawn in gm) what sticker to use, we use UVs
the UVs are the individual coordinates of the sprites on the texture page
if you check out this function, it returns the top left bottom and right UV values for a sprite
UVs always go from 0 to 1
so if the top left corner of a sprite is right in the middle of the texture, the UV coordinate of that coordinate is 0.5, 0.5
so when defining the top left corner of your vertex buffer, you have a vertex format that includes uvs, so it would look like:
vertex_texcoord(buffer, 0.5, 0.5);```for that vertex
right now what I do for draw a 3D model is:
texture = sprite_get_texture(tex_sprite, 0);
vertex_submit(model, pr_trianglelist, texture);
yes
oh I see, I will try
if you are importing the model, like as an OBJ