Results 1 to 16 of 16

Thread: resource files

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    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?

  2. #2
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    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

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  5. #5

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  7. #7

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  8. #8
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    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

  9. #9
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    Bababooey
    Tatatoothy
    Mamamonkey

  10. #10

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  11. #11
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    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

  12. #12

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  13. #13
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  14. #14

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  15. #15
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  16. #16

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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
  •  



Click Here to Expand Forum to Full Width