Mouse position changes size of a drawn cube
Question
I was doing the tutorials for SFML on using OpenGl and I encountered this very strange problem. In my code the drawing of the cube works fine but it resizes after my mouse. If I have my mouse in the top left corner the cube is resized to almost nothing and if I have my mouse at the bottom right it draws the cube correctly(full size). img832.imageshack.us/img832/440/sfmlprob.png
This works correctly(tutorial code): http://pastebin.com/hrzrC52j
This one does not work (my code): http://pastebin.com/8ja0Qpkb
If I copy all the code from the tutorial into my own code it works correctly(does not resize) so there should be some difference in the code but I've looked over and over again and can't find anything that should resize the cube.
Solution
if (Event.Type = sf::Event::Resized)
glViewport(0,0,Event.Size.Width,Event.Size.Height);
should actually be
if (Event.Type == sf::Event::Resized)
glViewport(0,0,Event.Size.Width,Event.Size.Height);
So you used =
instead of ==
and all events including mouse-moved got through to the glViewport
code.