PDA

View Full Version : lighting, textrue mapping, drawing method, easy stuff



dhoffman
05-09-2001, 12:55 PM
OK, I made a scene wherre everything was covered with texture maps. Then I added lighting, and then I realized that I needed to have more vertexes so that the lighting would look more correct. For example, the ceiling of my scene was made with one single quad, and I pasted one texture map onto it, however it did not reflect light correctly because the four vertices were too far from the light source. So apparently I need to subdivide the ceiling into more quads, correct? Is that the only thing to do here? and I assume I just need to be careful to paste the four corners of the texture map onto the certain four outer most corners of the ceiling all the while defineing the extra vertices for lighting inbetween?

Another question: Say I were to draw a cube where each side is the same. I could either a) draw each side originally at the exact same location using the same coordinates and then transfer it to the correct place with a transfer and rotate, or I could b) draw each section originally with the coordinates that actually belong to it.
To me, a) looks better in code, since you could just use a single function call to draw each cube side at the starting location. However I am guessing that b) would be faster since opengl isn't performing the extra matrix multiplications. Now I have never used display lists yet, but from what I understand, If I used a display list with a), then method a) should run just as quickly as method b), right?

ffish
05-09-2001, 04:23 PM
Q1: You could use a lightmap if your lighting is static. Then you only need your single quad = reduced geometry. Do a search of the discussion boards for links.

Q2: Display lists are probably just as fast for the two methods. Personally I would always define all the vertices for simple objects like cubes. If the object was static I might put it in a display list but there are other options (esp. for dynamic geometry) like vertex arrays, CVAs, VAR. I would think that unless you're drawing heaps of cubes, this won't be the framerate bottleneck anyway.

Display lists are very simple and worth learning anyway. It will pay off to experiment with them. If you're unsure, benchmark both methods.

[This message has been edited by ffish (edited 05-09-2001).]