Advertisement

OpenGL Tutorial

Started by July 23, 2003 01:20 PM
1 comment, last by SigSeg 21 years, 7 months ago
I have completed the first 9 chapters of NeHe''s tutorial, and am starting to pretty much understand how everything works. I am a busy baker so I only get to work on them once or twice a week on my days off. It''s actually pretty unusual for me to use something where programming is concurrent, as in: you specify what it is you are doing, then issue a bunch of functions, then tell it your finished, IE: between glBegin and glEnd and perhaps in other areas of GL too. The way I would have done it had I been the OpenGL architect would have been to create a GLSocket or something of that nature which would be specified every time you make a call to something like glVertex, etc.. this way you could work on multiple faces at a time. IE: (these functions do not exist): GLPolySocket sock_square, sock_triangle; glBind(&sock_square, GL_QUAD); glBind(&sock_triangle, GL_TRIANGLE); glVertex3f(sock_square, ...) glVertex3f(sock_triangle, ...) glVertex3f(sock_square, ...) if(something is true) { glvertex3f(sock_square, one direction); glvertex3f(sock_square, one_direction); } else { glvertex3f(sock_square, other_direction); glvertex3f(sock_triangle, other_direction); } etc ... then, every call to create each face, you''d specify which one you were working on, etc... you wouldn''t have to work on 1 at a time.. It''s difficult to wrap my head arround these new concepts but I do follow. As I continue through the tutorial, I like to know what every function really does and why it needs to do it rather than simply doing it because "it has to be done". It''s easier to understand the steps that are taken for GL systematically from start to finish for manipulation later. It''s almost necessary to know how everything works in order & systematically if one ever wanted to engineer a data engine. What I wonder is (in this case, for lesson09) when you call glGenTexture, glTexParameteri() (for minification & magnification filters) glTexImage2D() (to assign data) how does each function know what it is working on, what texture, etc... I think I have the flow wrong or I am thinking the functions are doing something else that they aren''t supposed to. How did and how do the previous functions no they are working on TextureImage[0] (before calling glTexImage2D)??????????? Anyways, thanks for listening!
ERROR (1) SIGSEG RECIEVED
Open GL is a state machine. Any states you set using the open GL functions will continue to take affect until you change them. So, when you bind a texture, specify a tex coord, or a vertex color, all of the faces created afterwards will use those exact same properties unless you specify otherwise.
Oh, and glBegin/glEnd isn''t exactly the fastest way to do things either, instead you should batch large amounts of faces using vertex / index arrays. This provides a certain level of ''grouping'' that you are looking for, and is faster. You must also remember that the rendering pipeline is linear.
Advertisement
Your awesome! I am actually just following lesson 9 (which NeHe did an excellent job writing!), but after reading on to lesson 10 and so forth, I am sort of reviewing everything. The idea is that I don''t intend to go on to the next chapters until I can write what I''ve done so far without paper in front of me aiding me along. It''s easy to look at a paper and write what you see, it''s called data-entry the challenge is understanding that which you are reading, i am going to work on that a bit before continuing. Several of the functions (for instance the ones you just mentioned) haven''t peeked into the tutorials yet so as always, posting a comment was likely jumping the gun. There probably are alternative ways of doing things not mentioned yet for the purpose of this tutorial. The functions I mentioned in the previous post don''t exist, they were sort of concieved to give a conceptual understanding of how i''d like to be able to do things eventually.

Thanks!
-SigSeg


ERROR (1) SIGSEG RECIEVED
ERROR (1) SIGSEG RECIEVED

This topic is closed to new replies.

Advertisement