Thread: Adding bitmap as a resource for texture mapping in OpenGL

  1. #1
    Unregistered
    Guest

    Lightbulb Adding bitmap as a resource for texture mapping in OpenGL

    I need to add a bitmap as a resource in a project but I have no idea how to call it.

    Lets say the name of my resource is IDB_BITMAP1 well... this doesnt work, I need to texture map IDB_BITMAP1 onto the Quad you see below. in the code below, thats were you would put whatever texture it was, like texture[1]...

    p.s. Is this even possible... and thanks for you help
    //////////////////////////////////////////////////////
    glBindTexture(GL_TEXTURE_2D,IDB_BITMAP1);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0f, 1.0f);
    glVertex3f(-1, 1, 0);

    glTexCoord2f(0.0f, 0.0f);
    glVertex3f(-1, -1, 0);

    glTexCoord2f(1.0f, 0.0f);
    glVertex3f(1, -1, 0);

    glTexCoord2f(1.0f, 1.0f);
    glVertex3f(1, 1, 0);

    glEnd();
    ///////////////////////////////////////////////////////


    p.s.s. If your wondering why I need to accomplish this, well, im making a windows screensaver. Windows will not let me use a bitmap in another directory so I have to add it as a resource. If anybody knows why this is, I would love to know that too!

    >tHaPuTeR

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Smile Maybe this...

    Here's something:


    HBITMAP bitmap1;


    bitmap1 = (HBITMAP) LoadImage(GetModuleHandle(NULL), "IDB_BITMAP1", IMAGE_BITMAP, imageX, imageY, 0);



    Replace imageX/imageY with the image's X/Y coordinates. This may help, but I am not sure.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    12

    Lightbulb

    I was chatting to someone and they said something about hard coding it into OpenGL. What does that mean?

    >tHaPuTeR

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with Bitmap Display
    By The Brain in forum Windows Programming
    Replies: 7
    Last Post: 03-23-2009, 05:33 AM
  2. Loading a bitmap (Without using glaux)
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 03-16-2006, 09:43 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  5. Loading a Bitmap resource for OpenGL Texture[x]
    By the dead tree in forum Game Programming
    Replies: 4
    Last Post: 08-26-2004, 01:12 PM