PDA

View Full Version : Display Image File



baconbeastnz
05-30-2008, 03:31 AM
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?

Zengar
05-30-2008, 12:16 PM
I advice you to use SDL.

baconbeastnz
05-30-2008, 02:21 PM
Ok, i basically want to learn everything as its needed in the professional environment.

Zengar
05-30-2008, 04:00 PM
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)
Either:
2. Use glDrawPixels
Or
2. Draw a 2D rectangle with a texture

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

ZbuffeR
05-30-2008, 04:02 PM
... and don't use drawpixels :)

Zengar
05-30-2008, 04:06 PM
... hehe, true (but he wanted to know "everything")

baconbeastnz
05-30-2008, 04:25 PM
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

Zengar
05-30-2008, 11:58 PM
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.

baconbeastnz
05-31-2008, 12:33 AM
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