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

btw… can the opengl source code be procured anywhere?

Originally posted by wildeyedboyfromfreecloud:
btw… can the opengl source code be procured anywhere?

OpenGL is just a spec these days. Most implementations are hardware drivers and not available as source. You should try to get a hold of the Mesa sources, that’s the only open source implementation that comes to mind right now. Maybe even the sources for the old SGI software implementation are still floating around, but I doubt it.

hey that looks really cool. i will look into it. so much to do so little time . i’ve heard and read of mesa in the past. well honestly thats about all i have to say about that. thanks i really apreciate. is the opengl liscense not really free. or is it just discontinued?

yes, the SGI OpenGL Sample Implementation is still online, and it’s probably the best place to look if you want to get a glimpse inside the API:
http://oss.sgi.com/projects/ogl-sample/

Michael

michael:
I don’t mean to be rude or anything but maybe it is you who doesn’t completely understand the difference between GL_TRIANGLE_STRIP and GL_TRIANGLES.See no matter what primitive(as in GL_TRIANGLE_STRIP,GL_TRIANGLES,GL_QUADS,etc.)you use all you do is supply vertices and possibly normal and tex. coordinate data.Every time you issue a glNormal* command you change the state of the current normal(hence the state machine stuff).All vertices you supply in the future with glVertex* will now use the normal you supplied untill you issue another glNormal* command and change the state again.Same goes for glTexCoord*.Do no think of glNormal* as supplying a normal.A normal by itself would be useless.Rather when you issue a glVertex command a vertex is supplied with the coords you give,the current normal and current texcoords.In the case of GL_TRIANGLES you have to supply 3 vertices per triangle.With GL_TRIANGLE_STRIPS you supply 3 vertices for the first and after that every vertex tyou supply will create a triangle together with two of the previous vertices you supplied.That means that the normals you supplied for these previous vertices will also be used.If you need to supply new normals then you mustn’y use a strip.That’s why,as someone else said,you can only use vertex normals(1 per vertex) and not face normals.
This is the best explanation I can give you.I thought you propably new all this,that’s why I didn’t say it to begin with.I can’t afford to buy any books either,with the prices they have, but there’s a lot of info online,like the red book,and a lot of links in the documentation section here on opengl.org(IIRC there’s one about the opengl as a state machine).
Anyway I hope this helped.

ok… lets try it like this:

struct OPENGLVERTEX {
vector4d position;
vector4d normal;
vector4d texturecoord0;
vector4d texturecoord1;
vector4d color0;
vector4d color1;
};

now you have a queue where you add your current vertices you want to draw:

Queue<OPENGLVERTEX> vertex_queue;

and you have a current vertex:
OPENGLVERTEX current;

implementation of glTexcoord, glColor and glNormal are all the same:

glColor3f(float r,float g,float b) {
current.color0 = vector4d(r,g,b,1); // is it one, i dunno
}

glNormal3f(float x,float y,float z) {
current.normal = vector4d(x,y,z,0);
}

and glVertex IS THE MAGICAL FUNCTION:

glVertex3f(float x,float y,float z) {
current.position = v4(x,y,z,1);
vertex_queue.push_back(current);
}

only glVertex adds a new vertex to the list, and it uses the last settings of glNormal,glTexcoord,glColor etc…

now what does the driver do?

depends on what he has to do… if he has GL_POINTS, he simply takes out every vertex for its own:

driverRenderPoints() {
while(!gl_end) { //as long as we are between glBegin and glEnd…
OPENGLVERTEX cur_to_draw = vertex_queue.pop_front(); //waits if there is nothing coming…
gpuDrawThisPoint(cur_to_draw);
}
}

others are driverRenderTriangles (started with glBegin(GL_TRIANGLES);

driverRenderTriangles() {
while(!gl_end) {
OPENGLVERTEX cur[3];
cur[0] = vertex_queue.pop_front();
cur[1] = vertex_queue.pop_front();
cur[2] = vertex_queue.pop_front();
gpuDrawTriangle(cur);
}
}

now as you know the GL_TRIANGLE_STRIPS and GL_TRIANGLE_LISTS or FANS or what ever do reuse vertices… but its simply another function like this one above…

the vertex-queue is the same, it will only pop_front some of them and save them for reusing… i’ll think about how this function could be written, but i hope it helped…

oh, and, for any others… the pop_front function automatically calls the vertex_program/vertex_shader for this vertex, and if there is no one, it sends it to the hardware or software t&l unit with its matrix-transforms, texgens etc…

writing a pseudo opengl-architecture is somehow funny and helps alot

Michael,

I understand the books could be too expensive for students(I was a full time student once!).
Even many people always refer to Red book as their ultimate guide, it is the OpenGL spec itself the ultimate resource of OpenGL.
The spec has an online version and it is absolutely legal.
Please look at: http://www.opengl.org/developers/documentation/specs.html

i never had a book myself. only a mathbook, wich is very useful. webresources are terribly just because of the nice notations… once you got them in a book its just so nice to read. and math takes loooong to understand.

the web has everything. i started at nehe.gamedev.net and never really moved away. the sources i used the most are:
nehe.gamedev.net and its links
flipcode.com
opengl.org and its lots of nice links at the mainpage, and the forums of course
developer.nvidia.com, tons of pdf’s and powerpoint presentations about lighting,shading,and other stuff grafics/opengl/dx etc related…
ati.com (is it developer.ati.com? dunno, always use the link there ), great resource, too, not that big as nvidia, but by far the most advanced gpu today…

i don’t know what assumptions you guys are operating upon regarding my character. and i unfortunately i hate saying this but i don’t have time to defend myself. i don’t understand why you all insist on expounding upon these rudamentary facets of opengl architecture. i hope it isn’t for my sake no offense but just please don’t exert yourselves on my behalf. personally if i would have written opengl i would’ve provided some means of passing normals to triangles strips. if you insist that verticies are pushed back on a queue. then why not push back normals for future use. not that it matters. listen say what you will in light of me. i could care less honestly. cheers.

my apologies for
always apologing,

michael

jesus michael,noone’s accusing you of anything,we’re just trying to help.We’re typing tons of stuff here and you think we’re doing this to somehow punish you for not knowing your opengl architecture stuf???
What I and davepermen are trying to tell you is that you don’t specify normals.Normals on their own are useless.With glNormal* you specify the normal to be used for the next vertex.Thus when you issue a glVertex* command a vertex is added to your scene(pushed down the stack) complete with normals and texture coords.When vertices are reused with strips or whatever they’re resused together with their normals,etc.That’s why strips are faster.If you need to assing new normals don’t use strips or use multiples strips.
I don’t like the attitude of these forums either.So instead of trying to defend yourself please read what we’re posting to get the answer to your question,and not with the prejudice that it is just another flame.That architecture stuff is the answer to what you’re asking ,we’re not posting it for kicks.

Also:

personally if i would have written opengl i would’ve provided some means of passing normals to triangles strips

Normals are passed to vertices and vertices are passed to strips.Therefore normals are passed to strips.

i understand opengl architecture perfectly well. i can’t believe i’m typing this but. know i want type this. and i will opt to not state the truth here so not to damage anyones ego or offend. lets drop it. i’m in a corner i have nothing nice to say so i will say nothing at all. actually i’m applying for a computer science/graphics patent in about a week and computer science is just a hobby of mine. i think it is you who misunderstands the cituation. please don’t hold it against me. take a breath and assess the situation. you are speaking well below my programming level. i’ve just tried to accomodate you pleasantly. now lets just let any reference to me end. if you’ve ever been between a rock and a hard place. please forgive my words.

michael

You don’t know what a statemachine is, nor do you know how to munge one to meet your needs, but everyone else is below your programming level?

Didn’t I see someone post a paper here with SIGGRAPH plastered in a picture?

i’ve made it this far without knowing what a state machine is i imagine. i imagine a lot of things. or maybe i’m using a state machine right now??? if i can’t speak chinese then should a chinese man assume i know nothing. if i need a state machine i’ll make one if i don’t find one first. but why look if i have no function for it. there is useful knowledge and useless knowledge. thats not to say that all knowledge is useful or useless but you can’t seperate the function from the context. what is a state machine… in all reality it is a string of characters which may or may not mean anything intelligible to the reader. you must seperate the symbols from the symbolized. blah blah blah you don’t know what a jaberwawky is thats rather humiliating. what if i told you it is right under your nose. no not that. the other thing. ha ha look at the fool. never seen a jaberwawky. its humbling isn’t it. now imagine what you would ever do without a jaberwawky. sorry i got no time for games. back to work.

later gator

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

by the pickles on my sandwich, what the hell more could you want?!

I have followed this thread with what started as amusement… amusement slowly turned to confusion… then it kicked back towards a nice combination of incredulity and amusement.

Don’t take this as a personal attack (I don’t know enough about you to warrant that), but I imagine that many posters on this thread are a hair’s breadth away from having the men in white coats come and drag them away… you have asked a question (the initial phrasing was somewhat poor, but you seemed to ‘justify’ that), and a veritable ****load of replies have flowed in, most of which are re-iterating the same points…

Surely if you have such a phenomenal grasp of graphics and OpenGL architecture, you would have seen the logic behind what they were saying, and (dare I say it) tried it out for yourself. Instead you fell over yourself apologising on behalf of everyone who ‘misunderstood’ you… wouldn’t it have been easier to rephrase your question in the hope of enlightening us to your purpose?

In answer to your question (so that this post is not completely off-topic and pointless):

In OpenGL, it is not possible to specify “face normals”. Normals are specified per-vertex, as this allows polygonal surfaces to better simulate smooth/parametric surfaces, but face normals can be simulated by specifying the same normal for each vertex of a face. In immediate mode, this means one glNormal call before the vertices of a face. Using vertex arrays, this means having a corresponding normal array with the normal for each vertex being the face normal (the equivalent of calling glNormal with the same value for each glVertex call of the face).

In the case of a triangle strip, because each vertex (following the inital three) defines a new face, you cannot even simulate a face normal, as the normal you specified for the previous vertices are retained… specifying a new normal will only affect the next defined vertex.

Sorry if this was not clear, or was ‘too far below your programming level’ (a comment that I’m sure was received none too favourably by most people who took the time to reply to you, I’m sure). This is mostly just my interpretation of the same thing everyone else has been trying to tell you.

If you have question in future, don’t be afraid post it, but remember that the clearer you make your question (and that includes giving a short background/context if need be), the more chance you have of getting a useful reply…
People are also generally much more helpful if you give some indication that you have already tried to solve a problem on your own…

well… back to work ‘fore I get an ass-whupin’ from the boss

well i didn’t try anything they suggsted because i’ve done it somewhere in the ball park of a million times. i agree this is all madness. but such is life on planet earth. wish i had some words of wisdom that applies to this situation. but i’m coming up blank and i don’t think its my fault. i take it all back. ok folks theres nothing to see here. just go back to whatever you were doing before.

i think its best

micahle

ps: well i will definately think twice if not 4 or 5 times before posing a question on this board.

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

I’m really tired of all that crap. When i post an advanced question into this forum, i’m lucky if i get one reply. I see why now… everybody’s busy answering newbies’s questions. I’m seriously starting to wonder if i will post again.

Y.

well i will definately think twice if not 4 or 5 times before posing a question on this board

Halleluiah! Some good has come out of this thread.
BTW, I hope english isn’t your first language, otherwise you’re in real trouble.

maybe you guys should open an irc channel for such threads … ?!

Originally posted by knackered:
Halleluiah! Some good has come out of this thread.

Have a look at this thread…

Sigh… where are those moderators when you need them…

Mmm, I’ve had one eye on that thread too. I think PK gave him good advice.
There must be something wrong with me, because I can’t help but read this drivel - it’s like watching a car accident scene - rubbernecking, I believe it’s called.