Display Image File

Hi there, have looked on redbook and several tutorials.

I just want o display an image file on my c++ app…

How do I go about doing this?

I advice you to use SDL.

Ok, i basically want to learn everything as its needed in the professional environment.

I don’t really understand what you mean by “everything” and which “professional envorinment”, but if you want to do it with OpenGL…

  1. Load the file (I assume you can do it already)
  2. Use glDrawPixels
  3. Draw a 2D rectangle with a texture

This should be enough if you have got the basics already…

… and don’t use drawpixels :slight_smile:

… hehe, true (but he wanted to know “everything”)

I don’t know the process of loading the file in open gl, but sounds like its not the norm?

So most projects that use opengl for graphics proberbly use SDL for their other input, instead of directX… ?

Is it wise to use SDL for timers>? e.g I need a timer that runs say 60 times a second to run display(void); but I don’t want to run into any lag problems like I did with java

What I meant previously was that, I want to learn skills and gain knowledge that will be useful in the development industry (tools development, graphics, e.t.c, things that will help me get a ‘junior programmer’ position)

I’m taking a C & openGl paper next semester so I figure get into it early. So i can learn directX aswell

  1. If you only want to display an image, it is an overkill to use OpenGL — that is why I suggested you should use SDL (a 2d image library, mostly).

  2. I have no idea if SDL supports timers.

  3. There is no “process of loading file in OpenGL”, there is a process of downloading the image to OpenGL (creating a texture). How you load your file and what kind of file it is is totally up to you.

  4. If you want to gain useful skills, go through all OpenGL tutorials and try making your own small demos — this is the fastest way.

Thanks Zenger. Will do that. have tried the SDL tutorials, and am trying to use codeblocks as devhub bases their tutorials on it.

Having a weird error though:

Linking executable: bin\SDL Tutorial 1.exe
CApp.h.gch\Release_CApp_h_gch: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings