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

Thread: Internal textures

  1. #11

    Internal textures

    The TGLXGraphic class is a non vcl class, it handles the internal image routines in the imagelist, saving and so on, it will solve it.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  2. #12

    Internal textures

    Hmm, are you certain. :? I had a look at some of the code for it:

    [pascal]------------------------------------------------------------------------------
    Type TGLXGraphic = class(TPersistent)
    private
    { Private declarations }
    FGraphicType: TGLXGraphicType;
    FBitmap : TBitmap;
    FJpeg : TJPEGImage;
    FData: TTextureData;
    procedure SetBitmap(const Value: TBitmap);
    procedure SetJpeg(const Value: TJPEGImage);
    procedure CreateBlankBitmap(Bitmap: TBitmap);
    function GetHeight: Integer;
    function GetWidth: Integer;
    public
    { Public declarations }
    constructor Create;
    destructor Destroy; override;
    Procedure Assign(Source: TPersistent); override;

    Function BuildTexture: glUint;
    procedure LoadGraphic(FileName: String);
    Procedure DeleteTexture(Texture: glUint);[/pascal]

    Darhazer means "non-VCL", which I take to mean "using no VCL classes." There may be some confusion here - from the above snippet, I see TPersistent, TBitmap, TJPEGImage, etc., which are contained in VCL units. Are you thinking in other terms (components or whatnot)?
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  3. #13

    Internal textures

    Well, i might have missplaced the names a bit =) you're right =)
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  4. #14

    Internal textures

    What I mean is that I want to include as few as possible units. My project for now uses only units
    Windows,
    Messages,
    BMP //handlung loading the bmp file into texture
    OpenGL;
    I want .exe file is keept as little as possible
    I think there should be a way to save the RGB array from the loaded texture but I don't know how. I think if the function provided by the BMP unit returns the texture, than the texture is RGB array and can be saved. Any ideas?
    I know how to solve the problem with the ImageList but no one VCL component (Image list is VCL component) should be used.
    If I can separate only that part of the library that is needed and it will no add to the .exe more than 15-20KB the solution is acceptable as a last resor. Also, any solution that can write BMP into arrays (as an external program, not used in the game) is more than acceptable
    The goal is to make little but quality game, whis not used external files and player can edit them easly
    http://www.kaldata.net

  5. #15

    Internal textures

    Here's my non-VCL bitmap loader that can load from file or memory: http://www.alistairkeys.co.uk/NonVCLBitmap.pas.

    I checked it with 3 or 4 24bit pictures and it seems to work. It probably handles 32 bit fine as well, though I've not tested that out.

    You can combine that loader by packing your bitmaps onto the end of your exe file (link). (I can't remember if the example for that uses the VCL, but it's trivial to convert to non-VCL by using dynamic arrays + BlockRead/BlockWrite as appropriate).

    Blah. Off to bed. Have fun!
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  6. #16

    Internal textures

    I think that the original padding calculation is wrong and only works by chance. The following should be correct:

    [pascal][background=#FFFFFF][comment=#0000FF][normal=#000000]
    [number=#C00000][reserved=#000000][string=#00C000]// calculate padding -- row width must be padded to 4 byte boundary
    Padding := WidthInBytes and 3;
    if Padding and 1 <> 0 then Padding := 4 - Padding;[/pascal]

    That should be correct. There's probably a more elegant method for this, but I'm not sure because my brain has turned into mush from one too many late nights...

    I've uploaded the changed version and tested it with a few bitmaps w/ different widths.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  7. #17

    Internal textures

    How exactly do you define 'VCL'? I have always thought of VCL as being descendants of TComponent, that you drop onto your form at design-time. Alimonster seems to be condemning all Delphi classes as VCL.
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  8. #18

    Internal textures

    At the simplest level, I use "VCL" to mean "anything in a VCL unit". So yeah, basically most of the stuff that comes with Delphi, and any class that's TPersistent or below. TPersistent is part of the VCL (in the unit "classes"). Not every class - you can derive your own heirarchies from TObject, as long as they don't descend from VCL classes.

    c:\program files\borland\delphi*\source\vcl <--- that's the VCL code right there!

    I do admit that I unfairly lump some non-VCL units as "VCL code" (like the SysUtils unit, which is actually in the RTL, and sometimes the math unit). I prefer units containing one or two (max) classes, or a small modicum of functions, having a clearly defined purpose. Sprawling utliity files are an easy way to bloat your exe and I'm highly allergic to code size.

    Anything in the delphi*\source\rtl\sys dirs go under the category of "non VCL", even if I sometimes mistakenly say otherwise.

    Btw, I should have mentioned this before, but I forgot: the BPP in the non-VCL bitmap loader is bytes per pixel, not bits per pixel. I may rename that var later so it's clear, and/or provide another var for bits per pixel. I said my brain was mush and I wasn't joking.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

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
  •