# is it possible to have vertex normals or even face normals using triangle strips nt

nt

yip.

i don’t suppose you would care to elaborate by any chance, would you?

some of us are not so priveledged to afford textbooks like they grow on trees. be a lamb and ablige me. or tell me something i don’t know. no offense… i’ll never understand people. forget it.

You know the internet is an amazing resource too.

so can people be if they want to. i really apreciate the link btw.

michael

ps: money causes money trouble. i’d rather do without more or less

[This message has been edited by wildeyedboyfromfreecloud (edited 03-16-2002).]

i’ve never seen an online textbook. a professor of mine told me it was illegal. i’m a real textbook nut. can’t get enough of them. but the price tags keep me at bay. is there anywhere online with other types of textbooks.

i honestly couldn’t find my answer there. can we be a little less esoteric and just spill the beans so to speak. a hint maybe. or is someone mocking me?

All right. You need to read between the lines.

The type of primitive you use has nothing to do with normals.

In Opengl, you can have one normal per-vertex you send.

//METHOD 1
glBegin(GL_WHATEVER);
glNormal3f( nx,ny,nz );
glVertex3f( x, y, z );
glEnd();

//METHOD 2
float* arrayOfVertices = { x, y, z, … };
float* arrayOfNormals = { nx, ny, nz };

glVertexPointer( …, arrayOfVertices );
glNormalPointer( …, arrayOfNormal );

glDrawArrays( GL_WHATEVER ) ;

METHOD3
ushort* indices = { i1, i2 … }float* arrayOfVertices = { x, y, z, … };
float* arrayOfNormals = { nx, ny, nz };

glVertexPointer( …, arrayOfVertices );
glNormalPointer( …, arrayOfNormal );

glDraw*Elements( GL_WHATEVER, …, indices ) ;

Not sure why I typed all this. I must be too nice.

And if it is not already obvious : This really is basic understanding of the API.

[This message has been edited by Gorg (edited 03-16-2002).]

[This message has been edited by Gorg (edited 03-16-2002).]

you don’t have to patronize me.
so you are saying what exactly. you can pass in an array of normals. and it will just go down the list for each vertex. like

glNormalfv(a)
glNormalfv(b)

glVertex3f(a)
glVertex3f(b)

so if i passed that down the glpipeline they would be matched with their respective character? or have i misinterperted you.

couldn’t you just have shown me what it would look like for a triangle strip? like where you define a triangle. and then just the unique verticies from then on. where would you stick the normals? i’m having difficulty understanding how your code relates to triangle strips as in
glBegin(GL_TRIANGKE_STRIPS);

If you don’t use vertex arrays all you have to do is supply one normal per vertex as usual.
like:
glBegin(GL_TRIANGLE_STRIPS);
glNormal3f( nx,ny,nz );
glVertex3f( x, y, z );
.
.
.
glEnd();

Did you try that allready?As Gorg said the primitive you use is irrelevant.

What you need to realize, Michael, is that OpenGL is a state machine. For example:

``````glNormal3f(nx, ny, nz);

glBegin(GL_TRIANGLE_STRIP);
for( ... ) {
// draw a bunch of vertices
}
glEnd();
``````

The first normal I passed at the beginning of that block of code will be used for each vertex i passed in the for() loop. It will only change if I submit another normal to OpenGL, and draw some more primitives. So for face/surface normals, you would pass GL the surface normal, and then draw the verts for the surface. Or for vertex normals, pass a normal for each vertex like:

``````glBegin(GL_TRIANGLE_STRIP);
for( ... ) {
glNormal3f(nx, ny, nz);
glVertex3f(vx, vy, vz);
}
``````

Hope that helps.

i don’t think anyone here understands at all what i am asking. i hate to be rude. but your replys are all very elementary and rather insulting to my intelligence. have any of you ever used triangle strips. for instance. say you provide 25 verts. that yield say oh around 23~24 faces. do the math. now ask yourself where in the code you are going to fit in say 75 normals… now maybe i hope you understand the delimma.

This is not what I understood from your question and it seems like everybody else did not either. So maybe your question was not that clear.

For your problem, you have 2 solutions :

1. You repeat the vertices when the normals are different.
2. You average the normals. Example : if you vertex is part of 3 faces, you average the normal of the 3 faces use it has the vertex normal.

Originally posted by wildeyedboyfromfreecloud:
i don’t think anyone here understands at all what i am asking. i hate to be rude. but your replys are all very elementary and rather insulting to my intelligence.

The reason I replied with ‘yip’ is because you did the same in your first post.

When asking a question on a forum it’s usually normal to use the message body itself to explain what you’d like to know.
(in more than one line please)

I really don’t understand why people are doing these ‘no text’ posts…
Are they just lazy?
Well, if that’s the case, they should also expect a lazy answer.

I hope you can understand that.

well my apologies. no text posting is typical on most more casual boards i’ve frequented in the past. its actually an atempt to be considerate to the readers on the front end so that they are not required to follow up just to find that the subject has been reiterated and their time wasted. now richardve if you havet he answer i’m looking for i’d apreciate it. i assumed that anyone replying to the origional post would be familiar with triangle strips and have successfully utilized proper lighting normals in tandum with the triangle strip or even texture coordinates. i’m currently using the triangle strip. because it seems a highly effecient construct over the redundant vertex calls to opengl. but i’m not sure where to stick normals. and i can’t find any documentation on the matter. and i really don’t have the time to experiment with it to find an answer. if it is possible i would even consider writing a file exporter that saves my geometry in triangle strip format if possible. because i’m always trying to speed up my performance. i suppose i could just try in the case taht no one seems to know. i know glut uses triangle strips sometime for tesselation so the library must have some convention for applying normals. on that note. i’m just curious. how open is opengl. is the uncompiled source code available somewhere. i would really like to see that.
my sincerest apologies par usual

michael

not the time or not interested in finding it out yourself?

think about it again, its a statemachine.
what you wanna set in the states is your problem, and its ****in simple to find the solution

not the time to reinvent the wheel unnecesarrily. my apogies. i can only imagine what a state machine is. but i just don’t see how it can be done. there is only one solution i can think of. and i don’t think it could work.

glBegin(GL_TRIANGLE_STRIP)

//first triangle

glVertex()
glVertex()
glVertex()

//second triangle

glVertex()

//3rd triangle

glVertex()

//4th triangle

glVertex()

//5th triangle

glVertex()…

thats how it works. now tell me where to put the normals. i happen to think this is a very legitamate question.
never meant to offend,

michael

[This message has been edited by wildeyedboyfromfreecloud (edited 03-17-2002).]