Skip to main content
GameDev.net gamedev.net
🔒 Locked

Loading bitmaps or graphics files

Started by andyroo Jan 2, 2003 at 1:22 PM 1 replies 250+ views
Original Post
andyroo
andyroo
Hey. I have to admit, I am stunned by the NeHe tutorials. I am very new to OpenGL and this is the first time I''ve actually sat down and tried learning it. Congrats to all who have contributed to the tutorials. They are excellent and well presented. Now I can talk about my matrices and all that there with a bit more confidence (even if I am not 100% sure what the hell I''m talking about!) Now onto the question, and its really simple. I want to load a bitmap or tga or whatever graphics file that OpenGL prefers. It''ll be 800x600, 16-bit colour. And if it is possible, for it just to hold there for a few seconds and fade out after say, 4 seconds. I presume tga would be best, since alpha blending will be used for the fading effect. As for loading a simple quad image, I was thinking of creating a quad shape and putting the 800x600 image onto it just as a texture. Tho that does seem rather the complicated method of displaying a static image.. Any ideas or code would be brilliant. ~ Andyroo
~ Andyroo
titan2782
titan2782
To start, openGL could give a rats ass what you wanted to load since you dont load images using openGL, you use a custom function.

Now, the easiest way for me to learn TGA was to open the lesson 32 code (i think, it has to do with selection) and use the TGA code from there. Simple.

Now, as for the fading effect, i would change the color of the poly you map it to. Go from glColor3f(1.0f,1.0f,1.0f) to glColor(0.0f,0.0f,0.0f) on a timer. Please ntoe this is just a crude example.

Thats all you need for fade in and out, i dont know where you go the blending idea. even though it owuld work, its not nesecary unless you want to fade something behind it into view. Then blending would be nessecary.

IT Administrator / Software Engineere
http://drdsoftware.cjb.net
Thunder_Hawk
Thunder_Hawk
That''ll only work if you want your background to be black. The easiest way to do it is by going from glColor4f(1.0f,1.0f,1.0f,1.0f); to glColor4f(1.0f,1.0f,1.0f,0.0f); based on timing code. Your image format doesn''t need to have an alpha channel for this effect unless you want the image itself to have various alpha values. You''ll also need to call glEnable(GL_BLEND); and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); (there maybe other blend functions that''ll work too depending on what you want to do) for this to work. Look through the tutorials, you should find code to load tgas and bmps (the bmp code is a little out of date though).

_____________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Forma

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.