Hello, im new to OpenGL, and so far, i am able to draw a triangle with this simple code:
glClearColor(1,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex2d(-0.5f, -0.5f);
glVertex2d(0, 0.5f);
glVertex2d(0.5f, -0.5f);
glEnd();
window.display();
But how do i put a texture on it? I have read the tutorial here at the bottom of the page
http://www.sfml-dev.org/tutorials/2.2/graphics-sprite.php
I have created a texture, loaded it, and then call
sf::Texture::bind(&texture);
But my triangle is still white.
Ahh, ok.
But right now, i just want to put a super simple texture on my triangle.
Do you know how to do it the old way then?
glClearColor(1,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
sf::Texture::bind(&texture); //This doesn't seem to work :-(
glVertex2d(-0.5f, -0.5f);
glVertex2d(0, 0.5f);
glVertex2d(0.5f, -0.5f);
glEnd();
window.display();
Do i need to call something else for the Texture::bind() to work? It doesn't seem to work atm.
I appreciate your help though! :)