Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Setting texture as background...

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2003
    Location
    McFarland, WI, US
    Posts
    8

    Setting texture as background...

    I am using a texture on a square for my background and im wondering how i can make sure everythign else i draw goes on top?

  2. #2
    Intern Contributor
    Join Date
    Apr 2002
    Location
    UK
    Posts
    50

    Re: Setting texture as background...

    Can you just make sure its z value is greater (or less, not sure which) than the rest of the objects?

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: Setting texture as background...

    Depends on your view setup and settings.

    One is to draw things based on the Z axis as far and near. Where +Z is near and -Z is farm draw your background at -Z max based on how it is set in your world.
    This reqaires you have depth checking in enabled.

    without depth checking you draw from back to front. background then other objects.

    Originally posted by guzba:
    I am using a texture on a square for my background and im wondering how i can make sure everythign else i draw goes on top?

  4. #4
    Intern Contributor
    Join Date
    Jan 2003
    Location
    coventry
    Posts
    72

    Re: Setting texture as background...

    you draw it first without enabling depth checking nor depth writing.


    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glDisable(GL_DEPTH_TEST);
    glDepthMask(GL_FALSE);

    drawbackground();

    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    drawscene();
    ----------------------------
    Non!

Posting Permissions

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