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

Thread: texture_env_dot3 result in alpha buffer

  1. #1
    Guest

    texture_env_dot3 result in alpha buffer

    I want to use the alpha buffer to store some
    intermidiate results,with the following code using a RBGA color buffer:


    //----------------------------
    glActiveTexture(GL_TEXTURE0_ARB);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D,nmapId);
    glTexEnv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REP LACE);

    glActiveTexture(GL_TEXTURE1_ARB);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D,lmapid);
    glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
    glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT);

    glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE0_RGB_EXT,GL_TEX TUR);
    glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB_EXT,GL_SR C_COLOR);
    glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT,GL_PRE VIOUS_EXT);
    glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);

    render_poly();

    //----------------------------

    will the result of the dotproduct be stored
    in rgb and the alpha buffer?

    If not in alpha, how do I do that? Can I "transfer" the result in the rgb buffer to the alpha buffer somehow(assuming the rgb values are the same of course).

    Thanks in advance

    /Peter

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    612

    Re: texture_env_dot3 result in alpha buffer

    Dont know about the DOT3_EXT, but the ARB version has a GL_DOT3_RGBA_ARB that puts the result in both RGB (greyscale) and Alpha(single channel)

  3. #3
    Guest

    Re: texture_env_dot3 result in alpha buffer

    Thanks I didn't see that. I tried it but it still didn't work though.

    Many hours of debugging later I found it.
    Most people using GLUT probably know this already:

    SPECIFYING GLUT_RGBA DOES NOT GIVE YOU AN ALPHA BUFFER!!!!!! USE GLUT_ALPHA!

    Stupid rookie mistake.
    /Peter

Posting Permissions

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