The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Attn: OpenGL gurus by ataraxia2009-05-08 15:25:15
  Not a guru, but I'm not sure you can do that here. by bwkaz 2009-05-08 19:54:23
For one, you can't initialize normals[] to an array whose elements are function calls; you'll have to give it a static size and insert the CrossProduct() return values in code. (Unless this is some screwy non-C, non-C++ language, or I'm misremembering what you can use as an array initializer. Either is possible.)

But second, if I understand what you're trying to do, you're trying to pass OpenGL a separate array of vertices, then a separate array of indices into that vertex array, instead of passing a huge array of (repeated) vertices? In that case, you don't have the CrossProduct() results in your vertexes[] array, so you can't do that. Since CrossProduct(vertexes[0], vertexes[4]) (for instance) is not in vertexes[], you can't put its index into faceData.

I'd take your normals[] array (after normalization), append its elements into vertexes[] (this is where STL comes in handy in C++, though you might be able to figure out a good way to do it statically), and then put the appropriate indices into faceData in the proper place (wherever OpenGL is expecting the normal vectors).
[ Reply ]

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)