Hello. Pretty new here. Anyway I am learning opengl using SFML instead of GLEW and GLFW. Find it pratical to use this. I have a problem on texture tho. Stretching. here is the image
I am using this image
The size of the original is 512x512. But on my screen its really small but stretch so bad.. Anyway to fix this? thanks
Here is my code
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
sf::Shader shader;
sf::Clock clock;
sf::Texture texture;
if (!texture.loadFromFile("container.jpg", sf::IntRect(10, 10, 200, 200))) {
}
sf::VertexArray quad2 = getQuad2();
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
sf::Time elapsed = clock.getElapsedTime();
float greenValue = (sin(elapsed.asSeconds())) + 0.5f;
sf::Texture::bind(&texture);
sf::Shader::bind(&shader);
shader.setParameter("ourColor", 0.0f, greenValue, 0.0f, 1.0f);
//window.draw(vertices,6,sf::Quads, &shader);
window.draw(quad2, &shader);
window.display();
clock.restart();
}
return 0;
}