Hi. ;D
Ok, so I have a quad, that is not a retangle nor square. It's a trapezoid.
Basically, the quad act as if it's a pair of triangles and texture becomes deformed the farer its' shape goes away from a square.
In case problem is on my end I attached the screens of what I see.
In case problem is not on my end, is this the desired and/or expected behaviour?
I didn't look very carefully through documentation but only thing I could notice is the warning about integer texture coords(but irrelevant here).
Here the code and image to reproduce the problem, press any key to increase the trapezoidness of the quad, press any mouse button to toggle texture smoothing(doesn't help):
#include <SFML/Graphics.hpp>
int main(int argc,char * argv[])
{
sf::RenderWindow app(sf::VideoMode(600,600),"");
sf::VertexArray arr(sf::Quads);
sf::Vector2f pts[4];
pts[0]=sf::Vector2f(0.f,0.f);
pts[1]=sf::Vector2f(0.f,64.f);
pts[2]=sf::Vector2f(64.f,64.f);
pts[3]=sf::Vector2f(64.f,0.f);
sf::Texture tex;
tex.loadFromFile("laser.tga");
tex.setSmooth(true);
float test=0.f,max=512.f;
arr.append(sf::Vertex(sf::Vector2f(0.f,0.f),pts[0]));
arr.append(sf::Vertex(sf::Vector2f(0.f,max),pts[1]));
arr.append(sf::Vertex(sf::Vector2f(max,max-test),pts[2]));
arr.append(sf::Vertex(sf::Vector2f(max,test),pts[3]));
while(1)
{
sf::Event eve;
while(app.pollEvent(eve))
{
if(eve.type==sf::Event::KeyPressed)
{
test+=1.f;
arr.clear();
arr.append(sf::Vertex(sf::Vector2f(0.f,0.f),pts[0]));
arr.append(sf::Vertex(sf::Vector2f(0.f,max),pts[1]));
arr.append(sf::Vertex(sf::Vector2f(max,max-test),pts[2]));
arr.append(sf::Vertex(sf::Vector2f(max,test),pts[3]));
}
if(eve.type==sf::Event::MouseButtonPressed)
{
tex.setSmooth(!tex.isSmooth());
}
}
app.clear(sf::Color::Green);
app.draw(arr,&tex);
app.display();
}
}
[attachment deleted by admin]
That's what I thought. ;D I assumed quads might be two triangles but then does it mean that one quad is as heavy to render as two triangles? Could you please run the code with that image and say if it happens to you too? I'd apperciate that since this laptop is quite interesting(Ahem ;)) piece of hardware and has intels graphics...
That's how 'graphics' work, every 3D model is split into hundreds up to billions of triangles. ;)
I know.
I also noticed there are two tirnagles forming out of that trapezoid quad but thanks for thought. :)
static const GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES,
GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS};
I see that quads are not hacked in by stiching two triangles by sfml so I'm asking if it's expected out of opengl. Preferably laurent or tank or someone else who is one of opengl pros in here. I found one post but there, the quad was drawn by opengl code so it's like invisible to me.
Well ok, gotta do it the triangles way. Awesome..