#How to vertex submit inside a surface?

8 messages · Page 1 of 1 (latest)

shell arch
#

I have a surface that follows the camera, normally when drawing sprites inside the surface I substract the camera coordinates for drawing them relative.
However I'm not sure about how to draw a vertex buffer inside a surface that follows the view

wary wing
# shell arch I have a surface that follows the camera, normally when drawing sprites inside t...

not sure if it will work for that, but I do this to get room coordinates on a surface

vx = (Top left corner of your camera)
vy = (Top left corner of your camera)

if (surface_exists(tail_surf) == false) {
    tail_surf = surface_create(320,180) //make your surface, no bigger than your camera
    }
matrix_set(matrix_world, matrix_build(-vx,-vy,0,0,0,0,1,1,1)); //Do this to use in room x/y cordinates 
    
surface_set_target(tail_surf); //start drawing to the surface
draw_clear_alpha(c_black, 0); //clear previous data

//just draw with normal x/y
    
surface_reset_target(); //reset draw target
matrix_set(matrix_world, matrix_build(0,0,0,0,0,0,1,1,1)); //undo matrix change
draw_surface_ext(tail_surf, vx, vy,0,c_white,1) //draw your surface 

prob is a better way, but maybe this will be of use.

shell arch
wary wing
#

maybe,
or like, try to have them located in the upper left corner of the room so the positions in the room match the positions of the surface?
like, move whatever you are trying to work with to the upper left of the room, then back when you are done working on the surface?

idk I'm randomly spitballing, maybe someone else will know.
I have not really worked with vertex buffers

wise kernel
#

@shell arch I discovered recently camera_apply to do just that, just call it after setting your surface and you're good to go

shell arch
wise kernel
#

Also is your camera the same size as the surface you're drawing into ? What about viewports ?