Using Sprites and Masks
How do I deal with TGA files? Is it the same as BMPs, or do I need something like libpng for PNGs?
Since you said you are new to this forum ill give you a few friendly tips.
Go check nehe.gamedev.net it his tuts, itll explain how to load tga files. DO as I did, search on the web for GL sites, and youll find not only info on this but many other subjects as well. I myself ( a newbie to GL ) post dumb questions, but try and find out more by yourself first and don`t expect poeple on this board to take time out of their busy days and program some sample source code for you, altough I have found some of them are very dedicated and very helpful, they don''t have obligation towards this just wait a few days also, if someones hasnt replied the next day with an awnsers dont worry. Sometimes about a week after my initial post ( in forum where the message output is smaller and your msg doesnt get buried ) I get very valid replies, either by that time I figured it out myself, sometimes I was still stuck and the reply gave me the info I needed to destuck, but I work on the problem for some time. Finding awnsers by yourself can be very satisfying
Also no need to post messages like
>> Does anyone know how to do this?? Or are you all just
>> ignoring this post
Unless you want to be included on the front page of gamedev
Wait a minute, that gets you more replies ( tried that myself once ) ... Well anyway it makes you sound needy and aggressive towards other poeple, usually not a good thing. If you really want to post again try and convey either information in your post or be more subtle.
I think youll find on overall this board is very useful and friendly.
WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?
Go check nehe.gamedev.net it his tuts, itll explain how to load tga files. DO as I did, search on the web for GL sites, and youll find not only info on this but many other subjects as well. I myself ( a newbie to GL ) post dumb questions, but try and find out more by yourself first and don`t expect poeple on this board to take time out of their busy days and program some sample source code for you, altough I have found some of them are very dedicated and very helpful, they don''t have obligation towards this just wait a few days also, if someones hasnt replied the next day with an awnsers dont worry. Sometimes about a week after my initial post ( in forum where the message output is smaller and your msg doesnt get buried ) I get very valid replies, either by that time I figured it out myself, sometimes I was still stuck and the reply gave me the info I needed to destuck, but I work on the problem for some time. Finding awnsers by yourself can be very satisfying
Also no need to post messages like
>> Does anyone know how to do this?? Or are you all just
>> ignoring this post
Unless you want to be included on the front page of gamedev
Wait a minute, that gets you more replies ( tried that myself once ) ... Well anyway it makes you sound needy and aggressive towards other poeple, usually not a good thing. If you really want to post again try and convey either information in your post or be more subtle.
I think youll find on overall this board is very useful and friendly.
WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?
WHO DO THEYTHINK THEY'REFOOLING : YOU ?
Thanks for replying. I looked at the code and understand how it loads the image as a texture. If I texture a quad with the texture loaded from the TGA file, then will it automatically use the alpha channel to create the transparency effect?
Well i could answer that question, but i really thing you will
learn more and faster if you find out your self.
I will give you a few tips though.
1. Most of the info is in NeHe''s tutorials. They cover alot. Even
the transpary part you were asking about is there. This is no
hard part, so you should find out prety easy.
2. There are some books that is downloadable from the net and
can also be read online. They are called, The Blue Book,
The Red Book and OpenGL Super Bible. They are very good.
3. Dont ask questions about everything, just ask when you REALY
is stuck, otherwize people will think you are a pain and will
for sure ignore you.
There are more, but theese are the most important. Good Luck.
Allmight.
learn more and faster if you find out your self.
I will give you a few tips though.
1. Most of the info is in NeHe''s tutorials. They cover alot. Even
the transpary part you were asking about is there. This is no
hard part, so you should find out prety easy.
2. There are some books that is downloadable from the net and
can also be read online. They are called, The Blue Book,
The Red Book and OpenGL Super Bible. They are very good.
3. Dont ask questions about everything, just ask when you REALY
is stuck, otherwize people will think you are a pain and will
for sure ignore you.
There are more, but theese are the most important. Good Luck.
Allmight.
-------------------------------------------------Founder and DirectorAllSoft Studios
Use tutorials 9 and 20. Espacially 20 which cover masks. The basics are all explain but it entails to creating a mask for each bmp or tga. This mask is two color. One which will be use for transparancy and the other that will host the image. The tutorial is pretty descriptive. NeHe describes this has a cookie cutter effect, and thats a good way to describe it.
WHO DO THEYTHINK THEY'REFOOLING : YOU ?
Ill keep to this thread since it seems to be very active. Which program/paint program/etc. are you all using to create your mask.
I for one uses Jasc Paint Shop Pro 4 for my artwork, so I am using this. But I find it is a pain in the ass sometimes, there isnt any magic filter to do this, and decreasing the color depth just doesnt cut it ! But thats what im using for now...
WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?
I for one uses Jasc Paint Shop Pro 4 for my artwork, so I am using this. But I find it is a pain in the ass sometimes, there isnt any magic filter to do this, and decreasing the color depth just doesnt cut it ! But thats what im using for now...
WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?
WHO DO THEYTHINK THEY'REFOOLING : YOU ?
OK, I created a TGA file with an alpha channel using PSP7 (recently got it) and used NeHe''s TGA loading code to open the file and create a texture. But when I tell the program to put the texture onto a quad, all i get is a white square. Does the alpha channel work the same way as masking did in Lesson 20, in other words: white = transparent and black = solid, or is it the other way around when using TGAs? I have tried both ways for the alpha channel/mask, but I still get a white texture.
I found out that the first time the TGA file was actually a white box. But when I redid it again with a correct mask, it showed up correctly in the thumbnail preview with explorer (using Win98SE) but still is a white box in my program. Like I said before, I am using NeHe''s TGA loading code and I used PSP7 to create the TGA file. It is 32 bit (24 bit with 8 bit alpha) and uncompressed. I tell the program to apply the texture to a quad. I can''t think of anything wrong with it.
This is very frustrating! I downloaded a hex editor and looked at my tga file. Prefectly fine. Using Borland C++''s inspect feature, found no problems when loading the code. BUT, when I go to display the image as a texture, I get a white square still. I cannot think of anything that can be wrong with this. I would appriciate any help I can get. Either through this message forum, via e-mail (cyberbotx@hotmail.com), via ICQ (47084619), or via AIM (CyberBotX2).
I finally got it to work the way I needed it to!! I just did a search of the forum for "TGA" and read through all the posts. I took what I could from the posts and got my TGA to display with transparency correctly. Here is what I did:
BTW, I hope I got the code tag to work correctly!
First time I didn't know about the source tag, now I think I got it to work.
Edited by - CyberBotX on November 23, 2000 7:13:56 PM
// At the end of my LoadTGa func (got from NeHe's site here) glGenTextures(1, &texture->texID); glBindTexture(GL_TEXTURE_2D, texture->texID); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); if (texture->bpp == 24) type = GL_RGB; glTexImage2D(GL_TEXTURE_2D, 0, type, texture->width, texture->height, 0, type, GL_UNSIGNED_BYTE, texture->imageData);// In my InitGL func glBindTexture(GL_TEXTURE_2D, testtga.texID); glEnable(GL_TEXTURE_WRAP_S); glEnable(GL_TEXTURE_WRAP_T);// Before drawing in DrawGLScene glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, backtga.texID); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND);// After drawing glDisable(GL_TEXTURE_2D); glBlendFunc(GL_ONE, GL_ONE); glDisable(GL_BLEND);
BTW, I hope I got the code tag to work correctly!
First time I didn't know about the source tag, now I think I got it to work.
Edited by - CyberBotX on November 23, 2000 7:13:56 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement