Results 1 to 4 of 4

Thread: Environment Mapping!?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Graz, Styria, Austria
    Posts
    9

    Environment Mapping!?

    Has anyone got an idea how to do Environment Mapping on Polygons?
    Can it be obtained only by using OpenGL Extensions or is there any other way!

    Thanks for your Help in advance!
    Martin

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: Environment Mapping!?

    you can easily obtain environment mapping with the opengl sphere map.
    however, it is not a real EM... much like chrome effects in old demos.

    try this:

    // activate sperical EM texture coord generation
    // for this to work properly, you need to specify almost one normal per face
    // since the sphere mapping algorythm need to know how your faces are oriented about the viewer (origin)
    glEnable(GL_TEXTURE_GEN_S);
    glEnable(GL_TEXTURE_GEN_T);
    glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
    glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);

    // activate screen blending mode, don't light primitives
    glDisable(GL_LIGHTING);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE,GL_ONE);

    // make texture ready
    glEnable(GL_TEXTURE_2D);
    glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MO DULATE);
    glBindTexture(GL_TEXTURE_2D,<texture id> );

    // white
    glColor3f(1,1,1);

    <draw your primitives w/normals>

    should be everything you need to start...
    Dolo/\/\ightY

  3. #3

    Re: Environment Mapping!?

    I have an example of doing environment mapping with and without an OpenGL extension on my webpage. The examples are on my programming page, they are the first two programs at the top of the page.

    Nate http://nate.scuzzy.net

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Graz, Styria, Austria
    Posts
    9

    Re: Environment Mapping!?

    Thanks a lot for your Help!!

Similar Threads

  1. environment mapping
    By mikemor in forum OpenGL: Advanced Coding
    Replies: 22
    Last Post: 10-07-2002, 05:00 AM
  2. Environment mapping
    By tdavie in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 10-01-2002, 01:07 PM
  3. Environment mapping problem
    By MarkOner in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-22-2001, 02:10 AM
  4. environment mapping over a texture
    By Arath in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-15-2000, 02:34 PM
  5. Environment mapping
    By ico in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-09-2000, 12:59 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