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 2 of 2

Thread: OpenGL, Cg, MRT and Multitexturing issue

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2005
    Location
    Norwich, UK
    Posts
    3

    OpenGL, Cg, MRT and Multitexturing issue

    Hi,

    I'm working on a multipass algorithm that at the moment involves up to 4 texture per pass and MRTs (2 render targets).
    The problem is that somehow, between the 1st and the 2nd pass my textures are messed up.
    I've follow the hints from "GPU Programming Guide 2.3.0":
    1- Create and Initialize pBuffer as rtt (I use a modified version of Mark's RenderTexture)
    2- Create Cg Contexts and programs
    3- Create Static Textures (I create 3 textures here that will remained unmodified throught the life of the program: ID[1...3]); ID[0] is used by the pbuffer.

    Then, for every frame I do:
    1- Create Dynamic Texture 1 ID[4]
    3- load CG fragment shader1
    4- Activate/enable textures ID[1],ID[4]
    5- Do 1st pass mapping ID[1] & ID[4] on a quad
    6- readback results
    7- clear buffers (COLOR_BIT)
    (until here everything is fine)
    7- Create Dynamic Texture 2 ID[5] from results
    8- Create Dynamic Texture 3 ID[6] from results
    9- Select draw buffers (GL_FRONT_LEFT, GL_BACK_LEFT)
    10- load CG fragment shader2
    11- Activate/enable Textures ID[5],ID[6],ID[1],ID[3]
    12- Do 2nd pass mapping textures on a quad
    13- readback from GL_FRONT_LEFT
    14- readback from GL_BACK_LEFT
    Texture are messed up.

    so, with this configuration I get:
    - instead of ID[5] I get ID[6]
    - instead of ID[6] I get ID[3]
    - ID[1] == ID[1]
    - instead of ID[3] I get ID[5]

    I have tried different settings with glMultiTexCoord2dARB and glActiveTexture (going through GL_TEXTURE0-3), but it just seems to get worst.
    I'm using the latest Cg 1.4 beta release, with a dual GeForce 6600GT (SLI NOT ENABLED), OpenGL and 77.72 drivers release.

    If anyone can point me in the right direction, I'd be very grateful.

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2005
    Location
    Norwich, UK
    Posts
    3

    Re: OpenGL, Cg, MRT and Multitexturing issue

    Ooohh! very silly of me, I forgot the semantics on the 2nd shader!!
    Funny enough though, the first pass shader works perfectly without the semantics (only two texture, maybe is not enough to mess things up )

Posting Permissions

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