How do you display images in OpenGL

Viewed 27938

How do you render images (.bmp and .jpeg) using OpenGL ? I've come across some tutorials, but they were for C# not C/C++. The reason I want to render images, is because I want to draw a spaceship(for a game). I could use a OpenGL primitive, but it doesn't really look that great. The other option is to draw the spaceship using co-ordinates, but that would take ages, and wouldnt look as good.

running the following snippet always returns failed:

#include <iostream>
#include <GL/glfw.h>
using namespace std;
int main()
{
  GLFWimage image;
  if(glfwReadImage("ship.tga", &image, GLFW_ORIGIN_UL_BIT)!=GL_TRUE);
  cout << "FAILED";
  system("PAUSE");
  return 0;
}

What am I doing wrong ? Poorly written code. Sorry about that. Works now

3 Answers
Related