Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  glNormalPointer  (Read 2345 times)
0 Members and 1 Guest are viewing this topic.
Offline Mojomonkey

JGO Ninja
***

Posts: 540
Medals: 3


ooh ooh eee eeee


« on: 2003-10-31 06:09:51 »

Ok, this probably a simple problem, but I'm having trouble wrapping my head around it.

I understand that if I have a complex model I have my vertex array and my normal array (as well as texture, color etc). Each normal entry corresponds to a vertex. That's fine, I understand that....

but, now I have a simple box. 6 vertices. However, each vertex has three possible normals (where the normal depends on which side I'm rendering.)

Is this not doable using pointers? Do I need to seperate my box into 6 seperate sides and render them independantly?


Don't send a man to do a monkey's work.
Offline Orangy Tang

JGO Kernel
*****

Posts: 2960
Medals: 37


Monkey for a head


« Reply #1 on: 2003-10-31 06:29:01 »

A box is about the worst possible case for vertex arrays since you've got plenty of shared vertices but no shared normals. The only way to do it is to duplicate your vertices so you end up with 4 vertices and 4 associated normals for each face. Theres no pointer magic you can do to get around this, since GL will just read the data in in continuous blocks.

It would be nice to have separate indices for vertex, normal, texture coords etc. but I don't think that'd be as hardware friendly for caching. Plus you'd have so many more indices the actual data to move around would greatly increase.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Online princec
« League of Dukes »

JGO Kernel
*****

Posts: 8086
Medals: 94


Eh? Who? What? ... Me?


« Reply #2 on: 2003-10-31 07:10:48 »

And when you delve deeper into 3D rendering you'll gradually realise why there is no sensible way to specify the vertex coordinates just once and the normals separately 3 times.

Cas Smiley

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.06 seconds with 20 queries.