We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Technology

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is an OpenGL® Function?

By Eugene P.
Updated: Feb 03, 2024
Views: 5,391
References
Share

An OpenGL® function is a block of executable code that is called from within a computer program by using the name of the function and any associated parameters. A function parameter is some variable or information that needs to be added after the name of the OpenGL® function to direct the action that will be taken. OpenGL® has a large array of functions that are used to draw, manipulate and render a three-dimensional (3D) scene and to change the values of different variables that can affect the appearance or speed of the rendering. All of the functions in the OpenGL® function library use a strict naming convention that described what parameters are expected and in what library the function is contained.

The naming convention for an OpenGL® function consists of four parts that form the actual name of a function. The first part is called the prefix and indicates the library to which the function belongs. For core functions, this prefix is "gl", standing for "graphics library". Other prefixes include "glut" for "graphics library utility tools", and two-letter codes that represent the manufacturers of graphics hardware that require special functions for their specific cards to access features unavailable to other devices.

The second part of an OpenGL® function name is the name itself. This can refer directly to a value to be changed or an action to be taken. Examples of the name portion of a function include "color", "vertex", "clear" and "deleteTextures". The name immediately follows the prefix and is usually capitalized to distinguish it from the prefix and make the code more readable.

The third element of an OpenGL® function name is the number of parameters the function accepts. These also can be called arguments. This is simply a number. So a function that requires three arguments will have the numeral 3 in this position, directly after the function name.

The final element of an OpenGL® function name is the data type of the variable expected as a parameter. This is an abbreviation that helps to remind the programmer what data are expected and also allows a single function to have multiple predictable variations that accept arguments of a different data type. Examples of this are "f" for a floating point number, "i" for an integer or "b" for a byte.

By these rules, a full OpenGL® function name for creating a vertex point at a 3D location defined in floating point numbers would be "glVertex3f". The function can be logically changed to accept integers by simply modifying the last part so it reads glVertex3i. One part of the success of OpenGL® is the strict adherence to standards such as the function-naming conventions.

Share
WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Link to Sources

Editors' Picks

Discussion Comments
Share
https://www.wise-geek.com/what-is-an-opengl-function.htm
Copy this link
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.