Results 1 to 3 of 3

Thread: Cross platform rendering to a texture...

  1. #1
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    San Diego, CA, USA
    Posts
    209

    Cross platform rendering to a texture...

    I am interested in rendering to a texture, but want to be able to keep my code as cross platform compatible as possible. I know in Windows one may render to a DIBitmap which may then be used as a texture, but the code seems WAY too windows dependant. Is there a way of doing this that is cross platform compatible, or is there a way to get this accomplished in a similar way with X and (hopefully) Macintosh?

  2. #2
    Member Newbie
    Join Date
    Oct 2002
    Location
    Rijeka, Croatia
    Posts
    36

    Re: Cross platform rendering to a texture...

    Yes. All textures have same format. They are 2D arrays of pixels, aligned in 1D memory as row after row. Therefore your texture has its beginning address (within a pointer) where you can access individual pixels with this formula:

    adr= first_pix_addr + (Y * width + X);

    The rest is bitmap header which is platform dependent. For example Win32 BMP has headers describing the bitmap, but it also contains a pointer to the actual pixels. If you wish to use crossplatform textures, use TGA or RAW formats. Bitmap headers are just structures that get written into files to describe the bitmap.

    Hope this helps.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Aug 2000
    Location
    Turin
    Posts
    258

    Re: Cross platform rendering to a texture...

    There is no need of using DIB to render to textures, and reading pixels is slow as hell.

    Just do the render and use glCopyTexSubImage.

    See my tutorial on NeHe (#36 if i can remember) for an easy and quite fast render to texture method...

    hope it helps
    [rIO^sPINNING kIDS] - rio@nospam.spinningkids.org

    -/- This is a signature virus. Add it to your signature. Help it spreading! -/-

Similar Threads

  1. Render-to-texture in cross-platform applications.
    By ErV in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-27-2007, 08:16 AM
  2. cross-platform ?
    By Tetsuo in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-17-2005, 07:52 PM
  3. Texture Mapping Cross Platform
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-10-2004, 02:21 AM
  4. Cross Platform
    By Gavin in forum OpenGL: macOS
    Replies: 2
    Last Post: 10-29-2000, 08:50 PM
  5. OpenGL as a Cross-Platform 2D API?
    By RossB in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 10-03-2000, 06:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean