Canvas index start at 1 or 0?
Posted: Sun Nov 12, 2023 4:02 pm
I'm making a level editor / file reading script, and to save on resources I'm going to pre-render the foreground to a canvas and draw that canvas every frame rather then drawing each tile individually, but I need to know if drawing an image at (0, 0) or (1, 1) is the exact top left pixel. I don't know how to go about finding this out since I'm unable to see pixels on an individual scale (problem with my eyes not hardware/software) and scaling the canvas would have the same problem of whether to draw it at 0, 0 or 1, 1.
second thought: using a shader that renders the pixel at (0, 0) in texture_coords (don't use pixle_coords obv since that would be screen resolution not texture point) would be a good idea but I feel that floating point accuracy might mess with the position and could end up incidentally drawing multiple pixels as 0,0 (probably won't be a problem but I'm paranoid).
please reply with the method you used to find the solution I would like to double check to make sure it is correct.
second thought: using a shader that renders the pixel at (0, 0) in texture_coords (don't use pixle_coords obv since that would be screen resolution not texture point) would be a good idea but I feel that floating point accuracy might mess with the position and could end up incidentally drawing multiple pixels as 0,0 (probably won't be a problem but I'm paranoid).
please reply with the method you used to find the solution I would like to double check to make sure it is correct.