Results 1 to 2 of 2

Thread: How to shade a flat surface? Very Noobie

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2002
    Location
    CA
    Posts
    5

    How to shade a flat surface? Very Noobie

    If I have a room and a light in the center...how do I shade the walls correctly?

    Do I have to compose the walls as many pieces so that there are lots of vertices? (like square jigsaw pieces)

    If so, how do I easily draw a wall like this?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: How to shade a flat surface? Very Noobie

    Hi !

    You just create youir walls and define the material it should have, OpenGL will calculate the color at each pixel using a simple local lighting algorithm.

    You will not get any shadows though, you have do some extra work to get that.

    Also if you have large "walls" you might want to tesselate it into a higher number of triangles because that would improve lighting a bit.

    So a wall could be done like:
    glBegin( GL_QUADS)
    glVertex...
    glVertex...
    glVertex...
    glVertex...
    glEnd()

    Make sure you enable GL_LIGHTING and GL_LIGHT0 first and set the materials attributes to what you want.

    Mikael

Similar Threads

  1. Replies: 9
    Last Post: 09-14-2015, 05:44 AM
  2. [help] Noobie on Isosurface
    By johncsl82 in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 07-05-2005, 10:23 AM
  3. Flat and Smooth Shade
    By Louis Wychkraft in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-07-2004, 05:19 AM
  4. openGL Noobie
    By CoolHandLuke in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-23-2004, 10:38 AM
  5. Lights on a flat surface..!
    By iNsaNEiVaN in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-16-2001, 11:54 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