Results 1 to 4 of 4

Thread: Offscreen surfaces and texture mapping?

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Silverton, Oregon
    Posts
    27

    Offscreen surfaces and texture mapping?

    Hi,

    In DirectDraw/Direct3D I used offscreen surfaces for sprites. I would load the image onto the surface which was in hardware memory. I would then say I want to copy a portion (0,0) to (64,64) to the back surface. I could also choose (50,50) to (200, 200), etc. This worked well for sprite maps as there are several images usually in one loaded image. Are there offscreen surfaces or something similar, and what OpenGL version? I'm aiming for OpenGL 1.1-1.5 for this 2d project.

    So, assuming this is my only way, how would I use GL_QUADS to take a portion of an image such as (50,50) to (200,100) for example and texture map that to a quad? The only examples I see on the internet are texture mapping an entire image to a quad, but this will be rare in my project. Any suggestions would be great. Thanks.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Offscreen surfaces and texture mapping?

    You can do that with texture coordinates. Mapping an entire image involves texturing from 0 to 1 in both s and t directions.
    Say you have a 256*256 texture.
    To display only the (50,50) to (200,100) region, use fractinal texcoords, like these :

    s0=50/256.0
    t0=50/256.0
    s1=200/256.0
    t1=100/256.0

    Use GL_NEAREST filtering, if you want to keep the rendered pixels as close as possible as original texels.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Silverton, Oregon
    Posts
    27

    Re: Offscreen surfaces and texture mapping?

    That looks too easy Thanks. Are images loaded into video memory like offscreen surfaces in video memory? For example, the way this tutorial does it:

    http://gpwiki.org/index.php/OpenGL:T...rtho_and_Alpha

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Silverton, Oregon
    Posts
    27

    Re: Offscreen surfaces and texture mapping?

    Well, what I mean is can I determine what textures are saved in video or cpu memory?

Similar Threads

  1. Render offscreen / to texture - basic questions
    By art-ganseforth in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-02-2016, 04:38 AM
  2. Offscreen Rendering vs Render-to-texture
    By McLeary in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 02-25-2011, 03:34 PM
  3. Offscreen texture rendering to bitmap
    By Tyrahell in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-01-2010, 08:28 AM
  4. texture offscreen blending
    By ilsvm in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-31-2003, 11:38 PM
  5. generating/mapping text onto surfaces
    By lavalamp in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-19-2001, 08:06 PM

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