#Zooming mechanics on a 2D surface

13 messages · Page 1 of 1 (latest)

steep sigil
#

So I have a Vertex Array which contains the position and colour for all points in my simulation, Each is a pixel in size. I would like to add zooming to this simulation however I am very uneducated with zooming mechanics.

First of all how can you zoom out on something which is one pixel in size? do you only show it if there are n objects in that pixel?

Second of all, what zooming method should I use? Preferably one with smooth zooms in and out.

Lastly, How does zooming work with these Arrays of vertices?

mystic ridgeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.

low grove
#

well, what would you like to happen exactly?

steep sigil
# low grove well, what would you like to happen exactly?

when you zoom out, things get smaller. like zooming out with google earth, so the pixels would be projected closer together. and the opposite for zooming out. I guess I would like this to read from a vertex array with the default scale and create another resized it appropriately however that may not be so efficient but its a start.
does this explain it well?

low grove
#

how do you place your vertices?

steep sigil
# low grove how do you place your vertices?
vertex_list = [0, 0, 10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100]

this is a sf::vertex_array object from SFML and if drew will show a line of points from 0, 0 to100, 100 because each coordinate in the list is seen as: [x0, y0, x1, y1, x2, y2, . . .]

low grove
#

well, all you need to do is to apply a scaling transform

#

no sure how you draw this thing exactly in sfml

steep sigil
low grove
#

can you specify a transform for the draw?

#

looks like you can via the render states

steep sigil
#

i found sf::Transform::scale

mystic ridgeBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.