Click here to Skip to main content
16,005,149 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Unresolved token error Pin
73Zeppelin18-Jan-07 2:43
73Zeppelin18-Jan-07 2:43 
GeneralRe: Unresolved token error Pin
jhwurmbach18-Jan-07 2:47
jhwurmbach18-Jan-07 2:47 
GeneralRe: Unresolved token error Pin
73Zeppelin18-Jan-07 3:04
73Zeppelin18-Jan-07 3:04 
QuestionDereferencing an normal array [modified] Pin
zqueezy18-Jan-07 0:36
zqueezy18-Jan-07 0:36 
AnswerRe: Dereferencing an normal array Pin
Iain Clarke, Warrior Programmer18-Jan-07 1:54
Iain Clarke, Warrior Programmer18-Jan-07 1:54 
GeneralNONONO need still help! Pin
zqueezy18-Jan-07 4:35
zqueezy18-Jan-07 4:35 
GeneralRe: NONONO need still help! Pin
El Corazon18-Jan-07 4:58
El Corazon18-Jan-07 4:58 
AnswerRe: Dereferencing an normal array Pin
El Corazon18-Jan-07 5:20
El Corazon18-Jan-07 5:20 
zqueezy wrote:
a little clearer what the problem is??


it looks relatively correct. the issue is actually in the storage structures of subfaces[] verses normals. Notice you are using an index offset to the vertex:

index = subFaces[i]; // pointer to first vector of triangle<br />
_tempArray=(float*)(((char*)k) + index * 12); // 12 = size of 3 floats<br />


but when you get to the normal, you don't reference the fact that there is 3 floats

_tempArray=&(pNormal[i]); // <---- Here must be something wrong<br />


you have a normal for every vertex, so you can reference it similarly to the vertex information from above:

index = subFaces[i]; // pointer to first vector/normal (pair) for triangle<br />
_tempArray=(float*)(((char*)pNormal) + index * 12); // 12 = size of 3 floats<br />


or if you don't like the pointer math you are using which is rather confusing, try this:
_tempArray=&pNormal[index*3]; // normals are 3 floats
and
_tempArray=&pVertex[index*3]; // vertexes are 3 floats

this reads much nicer and helps match the vertex/normal pairs. Generally speaking for vertex array buffers there is one normal per vertex. You can specify one normal per face, but not easily with a vertex array. A vertex array uses an interleaved or separate memory buffer to reference each color, vertex, normal in matching form. If you have 100 vertices, you have 100 color references, and you have 100 normals. Color reference can be 4 units, vertices 2,3 or 4 units, and normals are always 3 units. The units can be float, double, etc.

_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

GeneralWow Pin
zqueezy18-Jan-07 11:24
zqueezy18-Jan-07 11:24 
GeneralRe: Wow Pin
El Corazon18-Jan-07 11:43
El Corazon18-Jan-07 11:43 
QuestionHow to create nice toolbar in CDialog app Pin
PatrykDabrowski18-Jan-07 0:04
PatrykDabrowski18-Jan-07 0:04 
AnswerRe: How to create nice toolbar in CDialog app Pin
Nibu babu thomas18-Jan-07 0:28
Nibu babu thomas18-Jan-07 0:28 
AnswerRe: How to create nice toolbar in CDialog app Pin
Hamid_RT18-Jan-07 0:41
Hamid_RT18-Jan-07 0:41 
AnswerRe: How to create nice toolbar in CDialog app Pin
Hamid_RT18-Jan-07 6:27
Hamid_RT18-Jan-07 6:27 
AnswerRe: How to create nice toolbar in CDialog app Pin
Mark Salsbery18-Jan-07 6:32
Mark Salsbery18-Jan-07 6:32 
Questionthe exception breakpoint... Pin
shivapriyak18-Jan-07 0:03
shivapriyak18-Jan-07 0:03 
AnswerRe: the exception breakpoint... Pin
toxcct18-Jan-07 0:11
toxcct18-Jan-07 0:11 
QuestionNeed to help in file reading in win32 Pin
amitmistry_petlad 17-Jan-07 23:54
amitmistry_petlad 17-Jan-07 23:54 
AnswerRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 0:23
Roger Stoltz18-Jan-07 0:23 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 0:30
amitmistry_petlad 18-Jan-07 0:30 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 0:41
Roger Stoltz18-Jan-07 0:41 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 1:10
amitmistry_petlad 18-Jan-07 1:10 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 2:05
Roger Stoltz18-Jan-07 2:05 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 16:36
amitmistry_petlad 18-Jan-07 16:36 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 21:19
Roger Stoltz18-Jan-07 21:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.