Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: 2006 PGD Annual: stage 3 scores...

  1. #11

    2006 PGD Annual: stage 3 scores...

    Looking at the code 'texturem.jpg' is loaded into a data pointer, and then loaded into video memory and the the data pointer is nulled, so there could be a jump of 100Mg
    I'm seeing 130 MB in-game, and a 300 MB spike at load time, so that's a 150MB+ spike, at least room for 3 uncompressed versions... and wouldn't freeing the datapointer only release about 50 MB?

    :idea: if the texture isn't loaded directly but passed to a mipmap generator (like GLU's, or driver's mipmap autogeneration), and that generator works on 32bpp images only and you pass it a 24bpp bitmap, that might explain things, as we would then see the following temporaries:
    - 50 MB (4096x4096 @24bpp) bitmap loaded by the code
    - 64 MB (4096x4096 @32bpp) mipmapper's work copy of the bitmap
    - 30 MB mipmap temporaries
    Total: approx 150 MB...

  2. #12

    2006 PGD Annual: stage 3 scores...

    hmm, thats true

    I do gen mipmaps using glu. Perhaps using DDS textures would be better, but those we'll only have after the PGD contest is complete
    I'm out of my mind but please leave a message
    <br />www.sulaco.co.za
    <br />Rage 3D game engine

  3. #13

    2006 PGD Annual: stage 3 scores...

    Pretty much all hardware now supports SGIS_generate_mipmap extension, which asks the hardware to generate the mipmaps autmagically, it will probably be more efficient at it than GLU. Code snippet:

    Code:
    if GL_SGIS_generate_mipmap then begin
       // hardware-accelerated mipmap generation
       glTexParameteri&#40;GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE&#41;;
       glTexImage2d&#40;GL_TEXTURE_2D, 0, textureFormat, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer&#41;;
    end else begin
       // software GLU-based mipmap generation
       gluBuild2DMipmaps&#40;GL_TEXTURE_2D, textureFormat, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer&#41;;
    end;
    Replace GL_RGBA with whatever format the buffer is in (GL_BGR if a straight 24bpp windows bitmap f.i.), textureFormat is one of the hardware texture formats GL_RGB8, GL_RGBA8, etc.

  4. #14

    2006 PGD Annual: stage 3 scores...

    Thanx eric, I'll add it, and see if it makes a difference.
    I'm out of my mind but please leave a message
    <br />www.sulaco.co.za
    <br />Rage 3D game engine

  5. #15

    2006 PGD Annual: stage 3 scores...

    Hey Eric

    I sorted out the dark map problem using "some form of gamma correction".

    It is now configurable from the setup sceen, and also changable by hitting "G".

    Tried your fix for generating the mipmaps, and it is ALOT faster, there is one problem though

    For some reason, when I use the GL_SGIS_generate_mipmap extenstion, some of the textures fail to render :shock:

    Code:
    if Format = GL_RGBA then
      begin
        if GL_SGIS_generate_mipmap then begin
          // hardware-accelerated mipmap generation
          glTexParameteri&#40;pTarget, GL_GENERATE_MIPMAP_SGIS, GL_TRUE&#41;;
          glTexImage2d&#40;pTarget, 0, GL_RGBA8, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pData&#41;;
        end
        else
        begin
          // software GLU-based mipmap generation
          gluBuild2DMipmaps&#40;pTarget, GL_RGBA8, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, pData&#41;;
        end;
       // Original code   
       //gluBuild2DMipmaps&#40;pTarget, GL_RGBA8, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, pData&#41;
     end
     else
     begin
       if GL_SGIS_generate_mipmap then begin
          // hardware-accelerated mipmap generation
          glTexParameteri&#40;pTarget, GL_GENERATE_MIPMAP_SGIS, GL_TRUE&#41;;
          glTexImage2d&#40;pTarget, 0, GL_RGB8, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, pData&#41;;
        end
        else
        begin
          // software GLU-based mipmap generation
          gluBuild2DMipmaps&#40;pTarget, GL_RGB8, Width, Height, GL_RGB, GL_UNSIGNED_BYTE, pData&#41;;
        end;
       //Original code
       //gluBuild2DMipmaps&#40;pTarget, GL_RGB8, Width, Height, GL_RGB, GL_UNSIGNED_BYTE, pData&#41;;
     end;
    Any ideas on what I'm doing wrong?
    I'm out of my mind but please leave a message
    <br />www.sulaco.co.za
    <br />Rage 3D game engine

  6. #16

    2006 PGD Annual: stage 3 scores...

    some of the textures fail to render
    As in "they're all black/white/transparent" or "I get some crash/exception"?
    Does it affect some textures randomly or always the same? (if so which?) If it's "tankbarr.jpg" it may come from the image dimensions (which aren't powers of two).
    Also if you have other textures that don't need mipmap (or don't even work with mipmaps), don't forget to

    Code:
    glTexParameteri&#40;pTarget, GL_GENERATE_MIPMAP_SGIS, GL_FALSE&#41;;
    at some point, or they'll get mipmapped too.

  7. #17

    2006 PGD Annual: stage 3 scores...

    You are right, all the textures that render white are non power of two.

    I was hoping I could get away with not having to stick to that antiquated rule.
    I'm out of my mind but please leave a message
    <br />www.sulaco.co.za
    <br />Rage 3D game engine

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •