PDA

View Full Version : should i use vertex arrays???



jalani26
03-22-2001, 01:59 PM
I'm working on making a 3-D room, to experiement with lighting and objects and I've been using a generic makeWall (l,w,h) function that takes the dimensions of the desired cubic object and then draws them with some texture coordinates. I've recently run into the problem of using spotlights, because I don't have enough vertices to get the desired effect of actually seing the spotlight on the wall rather than seeing the whole wall light up. I've been trying to figure out a way to add more verticies and polygons to the wall. I've been thinking of using a struct, but then got to figuring that it wouldn't help me as much due to the amount of different information i'd have to store. I've been reading some of your guys's posts and have been wondering if i should use vertex arrays. I don't know anything about them or what openGL functions use them, so i'd appreciate any and all suggestions. Thanks!

mango
03-22-2001, 07:41 PM
You need a book like the red book. It can be downloaded from gamedev but it is better to buy it since you get the latest edition.

outlander78
03-23-2001, 06:56 AM
I would strongly suggest ordering the red book - it's useful for solving problems, and is a good learning text as well.

As to your vertex array - that is just one way of creating your room's walls.

Instead of a cube, draw six quads. If you want a spotlight on a wall, it needs more vertices, as you noted. You could write a function to subdivide the quad. Pass in the corners, and it could create as many sub-sections as you like, based on performance vs visual appeal trade offs.

To do this, you would have to specify the normals for all the vertices - if you don't know how to do that, the red book is the best place to look.

cheers,
Andrew

[This message has been edited by outlander78 (edited 03-23-2001).]