|
-
Feb 19th, 2002, 12:56 PM
#1
Thread Starter
Fanatic Member
resource files
Hey all...
How do I use a resource file?
I'm playing around with OpenGL, and I wanna see if I can keep all the textures into a resource file so I can keep track of them.
I add them into a resource file, and when i do
fp = fopen(IDB_TOPTEXTURE)
or
fp = fopen("IDB_TOPTEXTURE")
It says "cannot be found"
I can't find any tutorials on howto use the resource thing either.
I included the resource.h header it makes
Thanks
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 19th, 2002, 02:47 PM
#2
Hyperactive Member
if your textures are bitmaps you can create bitmap resources
from within the resource editor.
Something tells me this wouldn't be the best way to do it if you had tons of textures. Maybe compress them into somekind of
file like the way Quake does with it's pak files.
But once you have the bitmap you can create a CBitmap object
and use the LoadBitmap(ID_BITMAP) function to load it into
memory (where ID_BITMAP is the resource ID of the bitmap
you created in the resource editor).
Make sure you remove it from memory when you're done.
Bababooey
Tatatoothy
Mamamonkey
-
Feb 19th, 2002, 03:02 PM
#3
Thread Starter
Fanatic Member
Well how do I do that?
Right now its a cube that rotates
http://users.cloud9.net/~khalid/downloads/cube.zip
That's it so far, I wanted to do it so it's just the exe
Code:
AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle
if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}
File=fopen(Filename,"r"); // Check To See If The File Exists
if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}
return NULL; // If Load Failed Return NULL
}
char *textureloc = "texture.bmp";
if (TextureImage[0]=LoadBMP(textureloc))
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 19th, 2002, 05:22 PM
#4
You can load a bitmap from a resource using the LoadImage or LoadBitmap API call. However, the returned bitmap handle will not be something that OpenGL likes. It is best to put all textures in external files.
Noble's way is for MFC which you don't use as I see. The MFC CBitmap class is just a wrapper for the HBITMAP GDI handle.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 19th, 2002, 05:57 PM
#5
Thread Starter
Fanatic Member
Ah okay.
I want to avoid MFC as much as possible (simply cos i don't know it)
Do you know how to work with .pak file?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 20th, 2002, 10:02 AM
#6
No, but you can probably find information on the web, maybe even code or a dll.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 20th, 2002, 10:30 AM
#7
Thread Starter
Fanatic Member
okidokey...thanks 
i finished the cube test thingy...if you wanna check it out
http://users.cloud9.net/~khalid/downloads/cube.zip
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 20th, 2002, 10:39 AM
#8
Hyperactive Member
a *.pak file is simply a zip file nothing more. If you want to
use a zip file you will need to implement zip support in your
application. You could get the source code for zip support
on the web....i forget the webpage exactly for it...somebody
help me out?
Bababooey
Tatatoothy
Mamamonkey
-
Feb 20th, 2002, 10:44 AM
#9
Hyperactive Member
Bababooey
Tatatoothy
Mamamonkey
-
Feb 20th, 2002, 10:46 AM
#10
Thread Starter
Fanatic Member
Ah cool thanks.
I'll look into that, but wait...thats not .pak...Does it also cover. cab?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 20th, 2002, 10:47 AM
#11
Hyperactive Member
read my previous post before the URL
i mentioned that a pak file is the same exact thing as a zip
file they just used a different extension
try opening a pak file with winzip and you will see
or change the extension and do the same thing
Bababooey
Tatatoothy
Mamamonkey
-
Feb 20th, 2002, 11:16 AM
#12
Thread Starter
Fanatic Member
ohh ok..that worked. cool
thanks alot!
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 20th, 2002, 12:01 PM
#13
Cool. Have you tried zooming inside the cube? Makes your head explode (although it gets a little bit slow then, you really have to optimize this - I have a 600 MHz Athlon, 128 MB ram and a TNT2 with the newest drivers).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 20th, 2002, 03:54 PM
#14
Thread Starter
Fanatic Member
Hmmm....my other friend with a TNT2 said the same thing.
My code is really long, like 800something lines,alot of it the window code...is there something wrong with the window handling code being about 400 lines?
Right now I'm trying to get the FPS to show...it's not working like it's supposed to..
Last edited by nabeels786; Feb 20th, 2002 at 03:59 PM.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 21st, 2002, 10:18 AM
#15
No, that's ok IF the code is not called during the main loop. One-time initialization can be as long as it wants, it won't have an impact on the frame rate.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 21st, 2002, 11:32 AM
#16
Thread Starter
Fanatic Member
ah ok...most of it is the wndmain and wndproc stuff.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|