Allegro.cc Forums » Programming Questions » Sin & Cos Questions (Amarillion's tutorial)

 NyanKoneko Member #5,617 March 2005 Space coordinate as what you, as the programmer, make up. In OpenGL, for example, you will often find programmers using 1.0f to represent the top of the screen, -1.0f for the bottom, -1.0f for the left side of the screen, and 1.0f for the right side of the screen.So a dot at the right side of the screen in the middle would be defined (in code) as (1.0f, 0.0f). A dot in the middle of the screen would be (0.0f, 0.0f). A dot at the bottom of the screen in the middle would be (0.0f, -1.0f).```(-1, 1) ------- (0, 1) ---------- (1, 1) | | | (-1, 0) (0, 0) (1, 0) | | | (-1,-1) --------- (0, -1) ------- (1, -1) ``` Now the screen, in memory, can really defined by a 2 dimentional array defiend as video_mem[height][width]. This is what's called screen coordinates. It usually goes from (0,0) - Upper Left, to (width_resolution, height_resolution) - Lower Right. So to convert world coordinates to screen coordinates, you would have to take the coordiantes you made up, like from -1 to 1, and convert them into which pixels in the array. So if you're running in 640 x 480, you would convert the word coordinates (1, -1) from above as (639, 479) in screen coordinates to represent the bottom right hand side of the screen.In other words, World Coordinates are what the programmer makes up to best fit whatever the program is supposed to do, while screen coordinates are made up by the hardware and video memory. -----------------Website: Playing With YarnMy Games: Flying Flammie, CorruptionWare, Hero of Light VS. Warriors of Darkness.Other: Collegro, The Seasons