Announcement

Collapse
No announcement yet.

Open GL shading/lighting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Open GL shading/lighting

    I have created a Open GL display list mapped with colorized geophysical data. In one application I present this data 2D dataset in a 3D surface map. I want to apply shading to the surface which has been colorized. Is it possible to apply shading and lighting to a display list?

    I have implemented the following snipet with lighting commands followed by the display list creation. The only thing I get is a solid surface which alternates from black to a light gray when I rotate the 3D surface and no colors are shown
    :
    DIM LightAmbient(3) AS SINGLE
    DIM LightDiffuse(3) AS SINGLE
    DIM LightPosition(3) AS SINGLE

    LightAmbient(0) = 0.5 : LightAmbient(1) = 0.5 : LightAmbient(2) = 0.5 : LightAmbient(3) = 1.0
    LightDiffuse(0) = 1.0 : LightDiffuse(1) = 1.0 : LightDiffuse(2) = 1.0 : LightDiffuse(3) = 1.0
    LightPosition(0) = 0.0 : LightPosition(1) = 0.0 : LightPosition(2) = 2.0 : LightPosition(3) = 1.0

    glClearColor 0.0,0.0,0.0,0.0
    glClearDepth 1.0
    glDepthFunc GL_LESS
    glEnable GL_DEPTH_TEST
    glShadeModel GL_SMOOTH

    glMatrixMode GL_PROJECTION
    glLoadIdentity

    gluPerspective (45.0,lxl/lyl,0.1,100.0)

    glMatrixMode GL_MODELVIEW

    glLightfv GL_LIGHT1, GL_AMBIENT, LightAmbient(0)
    glLightfv GL_LIGHT1, GL_DIFFUSE, LightDiffuse(0)
    glLightfv GL_LIGHT1, GL_POSITION, LightPosition(0)

    glEnable GL_LIGHT1
    7
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    twodcreatescene ' generate display list of geophysical data

    glenable gl_lighting



    -------

    Any help on whether Open Gl shading can be implemented into a display list or not would be helpful...
Working...
X