Post by (X) on Jan 12, 2024 14:59:57 GMT 1
A new clip to inspire you:
To get this nice earth version, you can use this image.
Just load it in the Files section and give it a fitting name, like "Welt2", then, search for and update the Welt's Load texture statement to reflect the new name.
This is a BING commented Earth animation procedure 'DEMO10' of Peter Heinzig's OpenGL demo.
As you can see, each statement has it's own background of meaning and implications.
I've started watching OpenGL tutorials on YouTube to pick up the lingo.
As they say:"When the student is ready the teacher will appear."
I am hoping I am ready to start playing around with this increadible OpenGL stuff.
Please read and memorize all of this carefully. There will be a Quiz at the end of the class. :P
Sub DEMO10
Local a!
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glMatrixMode" function in OpenGL is used to specify which matrix is the
' current matrix. It has four possible modes:
'
' 1. "GL_MODELVIEW": This is the default mode. It applies subsequent matrix
' operations to the modelview matrix stack. This mode is typically used for
' transforming objects within your scene.
'
' 2. "GL_PROJECTION": This mode applies subsequent matrix operations to the
' projection matrix stack. It's used for setting up how your scene is projected
' onto the screen, such as defining perspective (with "gluPerspective") or
' orthographic (with "glOrtho") projections.
'
' 3. "GL_TEXTURE": This mode applies subsequent matrix operations to the
' texture matrix stack.
'
' 4. "GL_COLOR": This mode applies subsequent matrix operations to the
' color matrix.
'
' When you call "glMatrixMode(GL_PROJECTION)", you're telling OpenGL that
' subsequent matrix operations (like "gluPerspective") should affect the
' projection matrix. This is typically done when setting up your camera's
' view frustum.
'
' Please note that the use of "glMatrixMode" and other fixed-function pipeline
' functions are deprecated in modern OpenGL. In newer versions, it's recommended
' to use shader programs and handle matrices (like model, view, projection) manually.
'
glMatrixMode(GL_PROJECTION)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "gluPerspective" function in OpenGL is used to specify a viewing
' frustum into the world coordinate system. It takes four parameters:
'
' 1. "fovy": This is the field of view angle in the y direction, in degrees.
' It's the angle between a plane passing through the camera position and the
' top of your screen, and another plane passing through the camera position
' and the bottom of your screen. The larger this angle, the more you can see
' of the world, but the objects you see will become smaller¹.
'
' 2. "aspect": This is the aspect ratio that determines the field of view
' in the x direction. This is typically the ratio of "width" to "height" for
' your viewport. For example, an aspect ratio value of "aspect = 2.0" means
' the viewer's angle of view is twice as wide in x as it is in y³4.
'
' 3. "zNear": This is the distance from the camera to the _near clipping
' plane. Nothing that's closer to the camera than "zNear" will be visible¹.
'
' 4. "zFar": This is the distance from the camera to the far clipping plane.
' Nothing that's farther away from the camera than "zFar" will be visible¹.
'
' Both "zNear" and "zFar" must be greater than zero, and "zFar" should be
' greater than "zNear". These values are used to create a view frustum, and
' anything outside this frustum will not be visible on the screen¹.
'
' Please note that setting "zNear" too close to the camera or "zFar" too
' far away can lead to depth buffer precision issues, causing a flickering
' effect known as z-fighting¹.
'
gluPerspective(45, SV, 1, 1000)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glMatrixMode(GL_MODELVIEW)" function in OpenGL is used to specify which
' matrix is the current matrix¹². The "GL_MODELVIEW" parameter indicates
' that the modelview matrix is the current matrix¹².
'
' ' The modelview matrix is used to transform vertices from object space to eye
' ' space¹². This matrix is typically used for setting up the view of
' ' your scene, including both the camera position and the objects in the
' ' scene¹².
'
' ' All subsequent matrix operations (like "glTranslate", "glRotate", etc.)
' ' affect the current matrix¹². So after calling
' ' "glMatrixMode(GL_MODELVIEW)", all subsequent matrix operations will affect
' ' the modelview matrix¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "Why is there a glMatrixMode in OpenGL?" - Stack Overflow¹.
' (2) "glMatrixMode - OpenGL 3 - docs.gl"².
' (3) "CS 481/681 Lecture - University of Alaska Fairbanks"³.
' (4) "glMatrixMode : PyOpenGL 3.1.0 GL Man Pages - SourceForge"4.
' (5) "glmatrixmode(3) - Linux man page"5.
'
' Source: Conversation with Bing, 2024-01-12
' (1) Why is there a glMatrixMode in OpenGL? - Stack Overflow. https://stackoverflow.com/questions/4566558/why-is-there-a-glmatrixmode-in-opengl.
' (2) glMatrixMode - OpenGL 3 - docs.gl. https://docs.gl/gl3/glMatrixMode.
' (3) CS 481/681 Lecture - University of Alaska Fairbanks. https://www.cs.uaf.edu/2007/spring/cs481/lecture/01_23_matrices.html.
' (4) glMatrixMode : PyOpenGL 3.1.0 GL Man Pages - SourceForge. https://pyopengl.sourceforge.net/documentation/manual-3.0/glMatrixMode.html.
' (5) glmatrixmode(3) - Linux man page. https://linux.die.net/man/3/glmatrixmode.
'
glMatrixMode(GL_MODELVIEW)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The glEnable(GL_ALPHA_TEST) function in OpenGL is used to enable alpha testing.
' Alpha testing is a process that allows OpenGL to discard certain fragments
' (potential pixels) based on their alpha value, which represents opacity.
'
' When alpha testing is enabled, OpenGL will perform a comparison between the alpha
' value of each incoming fragment and a reference alpha value. This comparison is
' specified by the glAlphaFunc function. If the incoming fragment’s alpha value
' passes the test, the fragment is rendered (i.e., written to the color buffer).
' If it fails the test, the fragment is discarded and not drawn.
'
' For example, you might see code like this:
'
' glAlphaFunc(GL_GREATER, 0.5);
' glEnable(GL_ALPHA_TEST);
'
' In this case, only fragments with an alpha value greater than 0.5 will be rendered.
' This can be useful for implementing certain effects, such as making parts of a
' texture transparent.
'
' Please note that the use of glEnable(GL_ALPHA_TEST) and other fixed-function
' pipeline functions are deprecated in modern OpenGL. In newer versions, it’s
' recommended to use shader programs and handle alpha testing manually.
'
glEnable(GL_ALPHA_TEST)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glShadeModel(GL_SMOOTH)" function in OpenGL is used to specify the
' shading model for polygons (1).
' It takes one argument, which can be either "GL_FLAT" or "GL_SMOOTH" (1).
' When you call "glShadeModel(GL_SMOOTH)", you're telling OpenGL to use smooth
' shading, which is the default shading model (2).
' In smooth shading, the colors of vertices are interpolated across the primitive,
' typically assigning different colors to each resulting pixel fragment (2)(3).
' This can result in a smooth gradient of colors across the surface of the
' primitive, which can give a more realistic appearance (4).
' Please note that the use of "glShadeModel" and other fixed-function pipeline
' functions are deprecated in modern OpenGL (1).
' In newer versions, it's recommended to use shader programs and handle shading
' manually (1).
'
glShadeModel(GL_SMOOTH)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' "glClearDepth" specifies the depth value used when the depth buffer
' is cleared. The argument is a depth value, clamped to the range [0, 1].
'
' When you call "glClearDepth(1.0)", you're setting the clear value for
' the depth buffer to 1.0. This means that every time the depth buffer
' is cleared, every pixel's depth value is set to 1.0.
'
' In the context of a depth buffer, a value of 1.0 usually represents
' the farthest possible depth. Therefore, calling "glClearDepth(1.0)"
' effectively sets every pixel's depth to the maximum possible value.
'
' All subsequent rendered pixels will be closer and thus will not be
' discarded by the depth test. You typically clear the depth buffer at
' the beginning of each frame, often along with the color buffer, using
' the "glClear" function with the "GL_DEPTH_BUFFER_BIT" flag.
'
' Remember to always test your code thoroughly to ensure it behaves as
' expected.
'
glClearDepth(1.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glEnable(GL_DEPTH_TEST)" function in OpenGL is used to enable
' depth testing. Depth testing is a process that allows OpenGL to
' discard certain fragments (potential pixels) based on their depth
' value (1).
'
' When depth testing is enabled, OpenGL tests the depth value of each
' incoming fragment against the content of the depth buffer. If the
' depth test passes, the fragment is rendered and the depth buffer is
' updated with the new depth value. If the depth test fails, the
' fragment is discarded (1).
'
' Depth testing is disabled by default, so to enable depth testing, we
' need to enable it with the "GL_DEPTH_TEST" option: "glEnable
' (GL_DEPTH_TEST)". Once enabled, OpenGL automatically stores fragments'
' z-values in the depth buffer if they passed the depth test and
' discards fragments if they failed the depth test accordingly (1).
'
' If you have depth testing enabled, you should also clear the depth
' buffer before each frame using "GL_DEPTH_BUFFER_BIT"; otherwise,
' you're stuck with the depth values from the last frame (1).
'
' Remember to always test your code thoroughly to ensure it behaves as
' expected.
'
' Source: Conversation with Bing, 2024-01-12
' (1) LearnOpenGL - Depth testing. https://learnopengl.com/Advanced-OpenGL/Depth-testing.
' (2) glEnable(GL_DEPTH_TEST) - nothing rendered - Stack Overflow. https://stackoverflow.com/questions/10042412/glenablegl-depth-test-nothing-rendered.
' (3) Depth Test - OpenGL Wiki - The Khronos Group. https://www.khronos.org/opengl/wiki/Depth_Test.
'
glEnable(GL_DEPTH_TEST)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glDepthFunc(GL_LEQUAL)" function in OpenGL is used to specify the
' depth comparison function that is used for the depth buffer's depth
' test (1).
'
' The argument "GL_LEQUAL" stands for "less than or equal to". When
' "GL_LEQUAL" is set as the depth function, OpenGL passes the depth test
' if the incoming depth value of a fragment is less than or equal to the
' depth value currently stored in the depth buffer (3)(5).
'
' This means that if a fragment's depth is equal to the depth already
' stored in the depth buffer, or is closer to the viewer, then the
' fragment will pass the depth test and be drawn. If the fragment is
' farther away, it fails the depth test and is discarded (1).
'
' This function is particularly useful when you're rendering transparent
' objects or doing multiple passes over the same geometry with different
' effects, as it allows fragments with the same depth value to be drawn
' (1).
'
' Remember, to use "glDepthFunc", you must first enable depth testing
' with "glEnable(GL_DEPTH_TEST)". Also, always test your code thoroughly
' to ensure it behaves as expected.
'
' Source: Conversation with Bing, 2024-01-12
' (1) Why is GL_LEQUAL recommended for the GL depth function (and why doesn't .... https://stackoverflow.com/questions/9057401/why-is-gl-lequal-recommended-for-the-gl-depth-function-and-why-doesnt-it-work.
' (2) glDepthFunc - OpenGL 4 Reference Pages - Khronos Group. https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDepthFunc.xhtml.
' (3) glDepthFunc(3G) — Arch manual pages. https://man.archlinux.org/man/glDepthFunc.3G.en.
' (4) FAQ/Depth Buffer - OpenGL Wiki - The Khronos Group. https://www.khronos.org/opengl/wiki/FAQ/Depth_Buffer.
' (5) GLAPI/glDepthFunc - OpenGL Wiki - The Khronos Group. https://www.khronos.org/opengl/wiki/GlDepthFunc.
'
glDepthFunc(GL_LEQUAL)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)" function in
' OpenGL is used to specify implementation-specific hints for the
' quality of color and texture coordinate interpolation (1).
'
' ' The argument "GL_PERSPECTIVE_CORRECTION_HINT" indicates the behavior
' ' to be controlled. It suggests the quality of color and texture
' ' coordinate interpolation. If perspective-corrected parameter
' ' interpolation is not efficiently supported by the OpenGL
' ' implementation, hinting "GL_DONT_CARE" or "GL_FASTEST" can result in
' ' simple linear interpolation of colors and/or texture coordinates (1).
'
' ' The second argument "GL_NICEST" is a symbolic constant indicating the
' ' desired behavior. It suggests that the highest quality option should
' ' be chosen (1).
'
' ' Generally, "glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)" will
' ' activate perspective-correct interpolation on all varyings, while
' ' "glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)" will generally
' ' turn it off (2).
'
' ' Please note that these are driver hints and nothing more; drivers
' ' don't have to react this way. The interpretation of the hints depends
' ' on the implementation (1). Always test your code thoroughly to ensure
' ' it behaves as expected.
' Source: Conversation with Bing, 2024-01-12
' (1) glHint function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glhint.
' (2) glsl & perspective correction of varying values - Stack Overflow. https://stackoverflow.com/questions/10018905/glsl-perspective-correction-of-varying-values.
' (3) GLAPI/glHint - OpenGL Wiki - The Khronos Group. https://www.khronos.org/opengl/wiki/GlHint.
' (4) OpenGL 1.1 Reference: glHint - Talisman. http://www.talisman.org/opengl-1.1/Reference/glHint.html.
'
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The glEnable(GL_COLOR_MATERIAL) function in OpenGL is used to enable the
' tracking of the current color to one or more material parameters. When
' GL_COLOR_MATERIAL is enabled, the material parameters specified by
' glColorMaterial will track the current color at all times. This means that
' the material color will change according to the current color set in your
' OpenGL program.
'
' Here's a simple example of how it works:
'
' ' glEnable(GL_COLOR_MATERIAL); // Enable color tracking
' ' glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); // Specify what will
' ' track the current color
'
' ' // Now any call to glColor3f will change the ambient and diffuse material
' ' properties
' ' glColor3f(1.0f, 0.0f, 0.0f); // This will set the ambient and diffuse
' ' material to red
'
' In this example, after enabling GL_COLOR_MATERIAL and setting
' GL_AMBIENT_AND_DIFFUSE to track the current color, any subsequent call to
' glColor3f will change the ambient and diffuse material properties.
'
' Remember to refer to the official OpenGL documentation for more detailed
' information. It's always a good practice to understand how these functions
' work when you're programming with OpenGL.
'
glEnable(GL_COLOR_MATERIAL)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glEnable(GL_TEXTURE_2D)" function in OpenGL is used to enable two-
' dimensional texturing4. When "GL_TEXTURE_2D" is enabled, a portion of a
' specified texture image is mapped onto each graphical primitive for which
' texturing is enabled4.
' ' Here's a simple example of how it works:
' '
' ' glEnable(GL_TEXTURE_2D); // Enable 2D texturing
' ' glBindTexture(GL_TEXTURE_2D, textureID); // Bind the texture to GL_TEXTURE_2D
'
' ' In this example, after enabling "GL_TEXTURE_2D", any subsequent call to
' ' "glBindTexture" with "GL_TEXTURE_2D" will bind the specified texture to the
' ' 2D texturing target5.
'
' ' It's important to note that if you're using GLSL shaders in OpenGL, the call
' ' to "glEnable(GL_TEXTURE_2D)" has no influence¹. Furthermore, if you
' ' intend to move on to the OpenGL 3.x core profile keep in mind that
' ' "glEnable(GL_TEXTURE_2D)" is deprecated¹.
'
' ' Remember to refer to the official OpenGL documentation for more detailed
' ' information. It's always a good practice to understand how these functions
' ' work when you're programming with OpenGL²³.
' ¹: Stack Overflow discussion on "Should glEnable(GL_TEXTURE_2D) be applied
' per texture unit"
' ²: Microsoft Learn documentation on "glEnable function (Gl.h)"
' ³: OpenGL Wiki by The Khronos Group on "Fixed Function Texture Binding"
' 4: Microsoft Learn documentation on "glTexImage2D function (Gl.h)"
' 5: ICS blog post on "Fixed Function to Modern OpenGL (Part 4 of 4)"
'
glEnable(GL_TEXTURE_2D)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glAlphaFunc(GL_GREATER, 0)" function in OpenGL is used to specify the
' alpha test function²4. The "GL_GREATER" parameter sets the alpha test
' to pass if the incoming alpha value is greater than the reference value²4.
'
' ' In this case, the reference value is "0". This means that the alpha test will
' ' pass if the incoming alpha value is greater than 0²4. If the alpha
' ' test passes, the fragment is processed normally. If it fails, the fragment
' ' is discarded and the frame buffer is not updated¹.
'
' ' Here's a simple example of how it works:
' '
' ' glAlphaFunc(GL_GREATER, 0); // Set the alpha test to pass if alpha > 0
' ' glEnable(GL_ALPHA_TEST); // Enable alpha testing
'
' ' In this example, after setting the alpha test function with "glAlphaFunc",
' ' any subsequent fragments with an alpha value greater than 0 will pass the
' ' alpha test¹.
'
' ' Remember to refer to the official OpenGL documentation for more detailed
' ' information. It's always a good practice to understand how these functions
' ' work when you're programming with OpenGL²³.
' ¹: Stack Overflow discussion on "How to achieve the effect being the same
' as using glAlphaFunc(GL_GREATER, 0.99f)?"
' ²: OpenGL 3 documentation on "glAlphaFunc"
' ³: uni-freiburg.de documentation on "glAlphaFunc Reference Manual"
' 4: Microsoft Learn documentation on "glAlphaFunc function (Gl.h)"
' Source: Conversation with Bing, 2024-01-12
' (1) glAlphaFunc - OpenGL 3 - docs.gl. https://docs.gl/gl3/glAlphaFunc.
' (2) glAlphaFunc function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glalphafunc.
' (3) How to achieve the effect being the same as using glAlphaFunc(GL .... https://stackoverflow.com/questions/29370156/how-to-achieve-the-effect-being-the-same-as-using-glalphafuncgl-greater-0-99f.
' (4) glAlphaFunc Reference Manual - uni-freiburg.de. https://lmb.informatik.uni-freiburg.de/people/reisert/opengl/doc/glAlphaFunc.html.
'
glAlphaFunc(GL_GREATER, 0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glBindTexture(GL_TEXTURE_2D, Textur(6))" function in OpenGL is used to
' bind a named texture to a texture target¹². The first parameter,
' "GL_TEXTURE_2D", is the target to which the texture is bound¹². The
' second parameter is the name of the texture¹².
'
' ' In this case, "Textur(6)" is the name of the texture. When you call
' ' "glBindTexture" with "GL_TEXTURE_2D" and "Textur(6)", it binds the texture
' ' named "Textur(6)" to the 2D texturing target¹². Once a texture is
' ' bound, the previous binding for that target is no longer in effect¹².
'
' ' It's important to note that when a texture is first bound, it assumes the
' ' dimensionality of its texture target³. So in this case, the texture
' ' "Textur(6)" becomes a 2D texture³.
'
' ' Remember to refer to the official OpenGL documentation for more detailed
' ' information. It's always a good practice to understand how these functions
' ' work when you're programming with OpenGL¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "glBindTexture function (Gl.h)" - Win32 apps | Microsoft Learn¹.
' (2) "glBindTexture - OpenGL 4 Reference Pages" - Khronos Group².
' (3) "Differences and relationship between glActiveTexture and glBindTexture" -
' Stack Overflow³.
' Source: Conversation with Bing, 2024-01-12
' (1) glBindTexture function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glbindtexture.
' (2) glBindTexture - OpenGL 4 Reference Pages - Khronos Group. https://registry.khronos.org/OpenGL-Refpages/gl4/html/glBindTexture.xhtml.
' (3) opengl - Differences and relationship between glActiveTexture and .... https://stackoverflow.com/questions/8866904/differences-and-relationship-between-glactivetexture-and-glbindtexture.
'
glBindTexture(GL_TEXTURE_2D, Textur(6))
'Global drawmod% = GLU_SILHOUETTE
Global drawmod% = GLU_FILL
'Global drawmod% = GLU_LINE
'Global drawmod% = GLU_POINT
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "Global q% = gluNewQuadric()" statement in OpenGL is used to create a new
' quadric object and assign it to the global variable "q%"¹². The
' "gluNewQuadric()" function creates a quadric object and returns a pointer to
' it¹².
'
' ' A quadric object in OpenGL is a shape that can be described with a second-
' ' degree polynomial¹². Examples of quadric objects include spheres,
' ' cylinders, and disks¹².
'
' ' Once the quadric object is created, you can refer to it using the variable
' ' "q%" when calling quadric rendering and control functions¹². If the
' ' function cannot allocate enough memory for the new quadric object, it will
' ' return a value of zero¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "gluNewQuadric function (Glu.h)" - Win32 apps | Microsoft Learn¹.
' (2) "Import and use openGL GLUQuadric?" - Stack Overflow².
' Source: Conversation with Bing, 2024-01-12
' (1) gluNewQuadric function (Glu.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glunewquadric.
' (2) c# - Import and use openGL GLUQuadric? - Stack Overflow. https://stackoverflow.com/questions/37017238/import-and-use-opengl-gluquadric.
' (3) gluQuadricNormals function (Glu.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/gluquadricnormals.
'
Global q% = gluNewQuadric()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "gluQuadricNormals(q, GL_SMOOTH)" function in OpenGL is used to specify
' the type of normals that are desired for quadrics rendered with the quadric
' object "q"¹². The "GL_SMOOTH" parameter indicates that one normal
' should be generated for every vertex of a quadric¹².
'
' ' This means that the shading of the quadric will appear smooth, as the
' ' normals at the vertices are used to interpolate the normals of interior
' ' points of the quadric¹². If you were to use "GL_FLAT" instead, one
' ' normal would be generated for every facet of a quadric, resulting in a
' ' faceted appearance¹².
'
' ' Here's a simple example of how it works:
' '
' ' GLUquadric* q = gluNewQuadric(); // Create a new quadric object
' ' gluQuadricNormals(q, GL_SMOOTH); // Set the normals to be smooth
'
' ' In this example, after creating a new quadric object with "gluNewQuadric",
' ' the call to "gluQuadricNormals" with "GL_SMOOTH" sets the normals of the
' ' quadric object to be smooth¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "gluQuadricNormals function (Glu.h)" - Win32 apps | Microsoft Learn¹.
' (2) "gluQuadricNormals : PyOpenGL 3.1.4 GLU Man Pages" - PyOpenGL².
' Source: Conversation with Bing, 2024-01-12
' (1) gluQuadricNormals function (Glu.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/gluquadricnormals.
' (2) gluQuadricNormals : PyOpenGL 3.1.4 GLU Man Pages. https://mcfletch.github.io/pyopengl/documentation/manual/gluQuadricNormals.html.
' (3) gluQuadricNormals(3gl) - specify what kind of normals are de. https://sarata.com/manpages/gluQuadricNormals.3gl.html.
' (4) OpenGL - 3D Shapes - UVic.ca. https://webhome.cs.uvic.ca/~blob/courses/305/html/OpenGL2withQuadric.html.
'
gluQuadricNormals(q, GL_SMOOTH)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "gluQuadricTexture(q, GL_TRUE)" function in OpenGL is used to specify
' whether texture coordinates should be generated for quadrics rendered with
' the quadric object "q"¹²³4. The "GL_TRUE" parameter indicates
' that texture coordinates are to be generated¹²³4.
'
' ' When "GL_TRUE" is passed as the second parameter, texture coordinates are
' ' generated¹²³4. If "GL_FALSE" is passed, texture coordinates
' ' are not generated¹²³4. The default value is "GL_FALSE"¹
' ²³4.
'
' ' The manner in which texture coordinates are generated depends upon the
' ' specific quadric rendered¹²³4.
' Source: Conversation with Bing, 2024-01-12
' (1) "gluQuadricTexture function (Glu.h)" - Win32 apps | Microsoft Learn¹.
' (2) "gluQuadricTexture - OpenGL 4 Reference Pages" - Khronos Group².
' (3) "gluQuadricTexture Reference Page" - cs.ubc.ca³.
' (4) "gluQuadricTexture Subroutine" - IBM4.
'
' Source: Conversation with Bing, 2024-01-12
' (1) gluQuadricTexture function (Glu.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/gluquadrictexture.
' (2) gluQuadricTexture | Microsoft Learn. https://learn.microsoft.com/en-us/previous-versions/ms537296%28v=vs.85%29.
' (3) gluQuadricTexture Reference Page. https://www.cs.ubc.ca/~tmm/courses/cpsc414-03-fall/opengl/gluQuadricTexture.html.
' (4) gluQuadricTexture Subroutine - IBM. https://www.ibm.com/docs/en/aix/7.1?topic=library-gluquadrictexture-subroutine.
'
gluQuadricTexture(q, GL_TRUE)
Do
a += .1
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glClear(GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT)" function in OpenGL
' is used to clear buffer(s) to preset values¹²4. The argument to
' "glClear" is the bitwise OR of several values indicating which buffer is to
' be cleared¹²4.
'
' ' In this case, "GL_COLOR_BUFFER_BIT" indicates the buffers currently enabled
' ' for color writing¹²4, and "GL_DEPTH_BUFFER_BIT" indicates the
' ' depth buffer¹²4. Therefore, this function call will clear both
' ' the color buffers and the depth buffer¹²4.
' Source: Conversation with Bing, 2024-01-12
' (1) "GLAPI/glClear - OpenGL Wiki - The Khronos Group"¹.
' (2) "glClear(3G) — Arch manual pages"².
' (3) "why do i need glClear(GL_DEPTH_BUFFER_BIT) - Stack Overflow"³.
' (4) "glClear - OpenGL 3 - docs.gl"4.
' (5) "glClear function (Gl.h) - Win32 apps | Microsoft Learn"5.
'
' Source: Conversation with Bing, 2024-01-12
' (1) GLAPI/glClear - OpenGL Wiki - The Khronos Group. https://www.khronos.org/opengl/wiki/GlClear.
' (2) glClear(3G) — Arch manual pages. https://man.archlinux.org/man/glClear.3G.en.
' (3) glClear - OpenGL 3 - docs.gl. https://docs.gl/gl3/glClear.
' (4) why do i need glClear(GL_DEPTH_BUFFER_BIT) - Stack Overflow. https://stackoverflow.com/questions/28137027/why-do-i-need-glcleargl-depth-buffer-bit.
' (5) glClear function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glclear.
'
glClear(GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glLoadIdentity()" function in OpenGL is used to replace the current
' matrix with the identity matrix¹²³4. This function is
' semantically equivalent to calling "glLoadMatrix" with the identity matrix³.
'
' ' The identity matrix, in terms of the projection and modelview matrices,
' ' essentially resets the matrix back to its default state¹. As you may
' ' know, "glTranslate" and "glRotate" are always relative to the matrix's
' ' current state¹. So for instance, if you call "glTranslate", you are
' ' translating from the matrix's current 'position', not from the origin¹.
'
' ' But if you want to start over at the origin, that's when you call
' ' "glLoadIdentity()", and then you can "glTranslate" from the matrix which is
' ' now located at the origin, or "glRotate" from the matrix which is now
' ' oriented in the default direction¹.
' Source: Conversation with Bing, 2024-01-12
' (1) "What does glLoadIdentity () do in OpenGL?" - Stack Overflow¹.
' (2) "glLoadIdentity and glPushMatrix/glPopMatrix, why not just use ..." -
' Stack Overflow².
' (3) "glLoadIdentity function (Gl.h)" - Win32 apps | Microsoft Learn³.
' (4) "Why does glLoadIdentity have to be called after every call to ..." -
' Stack Overflow4.
'
' Source: Conversation with Bing, 2024-01-12
' (1) What does glLoadIdentity () do in OpenGL? - Stack Overflow. https://stackoverflow.com/questions/628796/what-does-glloadidentity-do-in-opengl.
' (2) opengl - glLoadIdentity and glPushMatrix/glPopMatrix, why not just use .... https://stackoverflow.com/questions/11697583/glloadidentity-and-glpushmatrix-glpopmatrix-why-not-just-use-the-former.
' (3) glLoadIdentity function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glloadidentity.
' (4) c - Why does glLoadIdentity have to be called after every call to .... https://stackoverflow.com/questions/6949954/why-does-glloadidentity-have-to-be-called-after-every-call-to-glmatrixmode.
' (5) undefined. https://www.allegro.cc/forums/thread/595000.
'
glLoadIdentity()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glPushMatrix()" function in OpenGL is used to push the current matrix
' stack down by one, duplicating the current matrix¹²³4. That
' is, after a "glPushMatrix()" call, the matrix on the top of the stack is
' identical to the one below it¹²³4.
'
' ' All transformation functions (like "glScaled", "glTranslated", etc.)
' ' function on the top matrix, and the top matrix is what all rendering
' ' commands use to transform their data¹. By pushing and popping matrices,
' ' you can control what transformations apply to which objects, as well as
' ' apply transformations to groups of objects, and easily reverse the
' ' transformations so that they don't affect other objects¹.
' Source: Conversation with Bing, 2024-01-12
' (1) "Understanding glPushMatrix() and glPopMatrix()" - Stack Overflow¹.
' (2) "glPushMatrix - OpenGL 3" - docs.gl².
' (3) "glPushMatrix function (Gl.h)" - Win32 apps | Microsoft Learn³.
' (4) "glpushmatrix(3): push/pop current matrix stack" - Linux man page4.
' Source: Conversation with Bing, 2024-01-12
' (1) Understanding glPushMatrix() and glPopMatrix() - Stack Overflow. https://stackoverflow.com/questions/23971752/understanding-glpushmatrix-and-glpopmatrix.
' (2) glPushMatrix - OpenGL 3 - docs.gl. https://docs.gl/gl3/glPushMatrix.
' (3) glPushMatrix function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glpushmatrix.
' (4) glpushmatrix(3): push/pop current matrix stack - Linux man page. https://linux.die.net/man/3/glpushmatrix.
glPushMatrix()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glTranslatef(0, 0, -5)" function in OpenGL is used to translate the
' current matrix¹². The three parameters specify the x, y, and z
' coordinates for the translation vector¹².
'
' ' In this case, the translation vector is (0, 0, -5). This means that the
' ' current matrix will be translated along the negative z-axis by 5 units¹
' ². As a result, all subsequent rendering operations will be affected by
' ' this translation¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "glTranslatef function (Gl.h)" - Win32 apps | Microsoft Learn5.
' (2) "What is the purpose of glTranslatef () method?" - Stack Overflow¹.
' (3) "glTranslate, how exactly does it work?" - Game Development Stack
' Exchange³.
' (4) "OpenGL glTranslatef translation transformation function detailed ..." -
' programmerall.com4.
' (5) "how to use glTranslatef,glScalef,glRotatef in openGL" - Stack
' Overflow².
' Source: Conversation with Bing, 2024-01-12
' (1) What is the purpose of glTranslatef () method? - Stack Overflow. https://stackoverflow.com/questions/34480765/what-is-the-purpose-of-gltranslatef-method.
' (2) how to use glTranslatef,glScalef,glRotatef in openGL. https://stackoverflow.com/questions/48236120/how-to-use-gltranslatef-glscalef-glrotatef-in-opengl.
' (3) glTranslatef function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/gltranslatef.
' (4) opengl - glTranslate, how exactly does it work? - Game Development .... https://gamedev.stackexchange.com/questions/30290/gltranslate-how-exactly-does-it-work.
' (5) OpenGL glTranslatef translation transformation function detailed .... https://programmerall.com/article/5544542724/.
' (6) undefined. http://nehe.gamedev.net/.
' (7) undefined. https://youtu.be/dGWtdYlryQQ.
' (8) undefined. https://drive.google.com/file/d/14HHRiCbOHK9ZSZtDOqSl4GP4aSy7UQLh/view?usp=sharing.
'
glTranslatef(0, 0, -5)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glRotatef(360 * MouseY / _Y, 1, 0, 0)" function in OpenGL is used to
' apply a rotation transformation to the current matrix¹². The first
' parameter is the angle of rotation in degrees¹². The next three
' parameters specify the x, y, and z coordinates of the vector around which to
' rotate¹².
'
' ' In this case, the angle of rotation is calculated as "360 * MouseY / _Y",
' ' which means the rotation angle depends on the mouse's Y-coordinate¹².
' ' The rotation is around the x-axis, as indicated by the "1" in the second
' ' parameter¹².
'
' ' This function multiplies the current matrix by a rotation matrix with the
' ' product replacing the current matrix¹². This means that "glRotatef"
' ' does a rotation around the origin of the current local system¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "how to use glTranslatef,glScalef,glRotatef in openGL" - Stack Overflow¹.
' (2) "OpenGL: What does glRotatef rotate?" - Stack Overflow².
' Source: Conversation with Bing, 2024-01-12
' (1) how to use glTranslatef,glScalef,glRotatef in openGL. https://stackoverflow.com/questions/48236120/how-to-use-gltranslatef-glscalef-glrotatef-in-opengl.
' (2) c++ - OpenGL: What does glRotatef rotate? - Stack Overflow. https://stackoverflow.com/questions/25293370/opengl-what-does-glrotatef-rotate.
' (3) undefined. https://youtu.be/dGWtdYlryQQ.
' (4) undefined. https://drive.google.com/file/d/14HHRiCbOHK9ZSZtDOqSl4GP4aSy7UQLh/view?usp=sharing.
'
glRotatef(360 * MouseY / _Y, 1, 0, 0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'glRotatef(360 * MouseX / _Y, 0, 1, 0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
glRotatef(a, 0, 0, 1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "gluQuadricDrawStyle(q, drawmod)" function in OpenGL is used to specify
' the draw style desired for quadrics¹². The first parameter "q" is the
' quadric object (created with "gluNewQuadric")¹². The second parameter
' "drawmod" is the desired draw style¹².
'
' ' The following values are valid for "drawmod"¹²:
' ' - "GLU_FILL": Quadrics are rendered with polygon primitives¹².
' ' - "GLU_LINE": Quadrics are rendered as a set of lines¹².
' ' - "GLU_SILHOUETTE": Quadrics are rendered as a set of lines, except that
' ' edges separating coplanar faces will not be drawn¹².
' ' - "GLU_POINT": Quadrics are rendered as a set of points¹².
' Source: Conversation with Bing, 2024-01-12
' (1) "gluQuadricDrawStyle function (Glu.h)" - Win32 apps | Microsoft Learn¹.
' (2) "gluQuadricDrawStyle Reference Page" - cs.ubc.ca².
' (3) "gluQuadricDrawStyle | Microsoft Learn"³.
'
' Source: Conversation with Bing, 2024-01-12
' (1) gluQuadricDrawStyle function (Glu.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/gluquadricdrawstyle.
' (2) gluQuadricDrawStyle Reference Page. https://www.cs.ubc.ca/~tmm/courses/cpsc414-03-fall/opengl/gluQuadricDrawStyle.html.
' (3) gluQuadricDrawStyle | Microsoft Learn. https://learn.microsoft.com/en-us/previous-versions/ms537458%28v=vs.85%29.
'
gluQuadricDrawStyle(q, drawmod)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "gluSphere(q, 1.5, 48, 48)" function in OpenGL is used to draw a sphere
' with the quadric object "q"¹. The second parameter "1.5" is the radius of
' the sphere¹. The third and fourth parameters "48" specify the number of
' subdivisions around the z-axis (similar to lines of longitude) and along the
' z-axis (similar to lines of latitude), respectively¹.
'
' ' This function draws a sphere of the given radius centered around the origin.
' ' The sphere is subdivided around the z-axis into slices and along the z-axis
' ' into stacks¹.
' Source: Conversation with Bing, 2024-01-12
' (1) "gluSphere function (Glu.h)" - Win32 apps | Microsoft Learn¹.
' (2) "gluSphere - OpenGL 3 - docs.gl"².
' (3) "gluSphere - Instituto de Computação"³.
' (4) "visual c++ - correct error code to trace a sphere - Stack Overflow".
'
' Source: Conversation with Bing, 2024-01-12
' (1) gluSphere function (Glu.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glusphere.
' (2) visual c++ - correct error code to trace a sphere - Stack Overflow. https://stackoverflow.com/questions/20724062/correct-error-code-to-trace-a-sphere.
' (3) gluSphere - Instituto de Computação. https://ic.ufal.br/professor/thales/cgi/Aula12.pdf.
'
gluSphere(q, 1.5, 48, 48)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "glPopMatrix()" function in OpenGL is used to pop the current matrix stack,
' replacing the current matrix with the one below it on the stack¹².
' OpenGL keeps a stack of matrices to quickly apply and remove transformations.
' All transformation functions (like "glScaled", "glTranslated", etc.) function
' on the top matrix, and the top matrix is what all rendering commands use to
' transform their data¹. By pushing and popping matrices, you can control
' what transformations apply to which objects, as well as apply transformations
' to groups of objects, and easily reverse the transformations so that they
' don't affect other objects¹.
' Source: Conversation with Bing, 2024-01-12
' (1) "Understanding glPushMatrix() and glPopMatrix()" - Stack Overflow¹.
' (2) "glPopMatrix function (Gl.h)" - Win32 apps | Microsoft Learn².
' (3) "glPushMatrix, glPopMatrix" - Microsoft Learn³.
'
' Source: Conversation with Bing, 2024-01-12
' (1) Understanding glPushMatrix() and glPopMatrix() - Stack Overflow. https://stackoverflow.com/questions/23971752/understanding-glpushmatrix-and-glpopmatrix.
' (2) glPopMatrix function (Gl.h) - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/glpopmatrix.
' (3) glPushMatrix, glPopMatrix | Microsoft Learn. https://learn.microsoft.com/en-us/previous-versions/ms537150%28v=vs.85%29.
'
glPopMatrix()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The "SwapBuffers(OpenGL_DC)" function in OpenGL is used to swap the front and
' back buffers of the specified device context "OpenGL_DC"³4. This
' function is typically called at the end of a sequence of drawing commands4.
'
' ' By default, the Microsoft implementation of OpenGL in Windows draws to the
' off-screen buffer; when drawing is complete, you call the "SwapBuffers"
' function to copy the off-screen buffer to the on-screen buffer4. This
' allows for smooth transitions between frames and can help to prevent screen
' tearing².
'
' ' It's important to note that the current pixel format for the specified
' device context must include a back buffer³.
' Source: Conversation with Bing, 2024-01-12
' (1) "Understanding buffer swapping in more detail" - Stack Overflow¹.
' (2) "Avoid waiting on SwapBuffers" - Stack Overflow².
' (3) "Buffer Functions" - Win32 apps | Microsoft Learn³.
' (4) "Drawing with Double Buffers" - Win32 apps | Microsoft Learn4.
' Source: Conversation with Bing, 2024-01-12
' (1) Buffer Functions - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/buffer-functions.
' (2) Drawing with Double Buffers - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/opengl/drawing-with-double-buffers.
' (3) c++ - Avoid waiting on SwapBuffers - Stack Overflow. https://stackoverflow.com/questions/5829881/avoid-waiting-on-swapbuffers.
' (4) opengl - Understanding buffer swapping in more detail - Stack Overflow. https://stackoverflow.com/questions/61196969/understanding-buffer-swapping-in-more-detail.
'
SwapBuffers(OpenGL_DC)
Until MouseK
EndSub