Important functions in GL

Source: Internet
Author: User
Tags constant time interval valid
A Initialization
void Glutinit (int* argc, char** argv)
This function is used to initialize the glut library. The form corresponding to the main function should be: int main (int argc, char* argv[]);
This function obtains its two arguments from the main function.
void glutinitwindowsize (int width, int height);
void glutinitwindowposition (int x, int y);
These two functions are well understood to be the size and position (upper left) of the window to be created by the GLUT program. In pixels.
void Glutinitdisplaymode (unsigned int mode);
Sets the graphical display mode. The optional values for the parameter mode are:
Glut_rgba: Is the default mode used when Glut_rgba or Glut_index are not specified. Indicates the window in which you want to establish the RGBA mode.
Glut_rgb: The same as the Glut-rgba function.
Glut_index: Indicates the color index mode.
Glut_single: Use only single cache
Glut_double: Use dual cache. In order to avoid the process of drawing the computer to show, or to smooth the implementation of animation.
Glut_accum: Let the window use an additive cache.
Glut_alpha: Let the color buffer use the ALPHA component.
Glut_depth: Use deep cache.
Glut_stencil: Use template caching.
Glut_multisample: Allows the window to support multiple routines.
Glut_stereo: Enables the window to support stereoscopic.
Glut_luminace:luminance is the meaning of brightness. Unfortunately, on most OpenGL platforms, it is not supported.
Two Event handling (processing)
void Glutmainloop (void)
Let the GLUT program enter the event loop. Can be called at most once in a glut program. Once called, it is not returned until the end of the program.
Three Window management (Windows Management)
int Glutcreatewindow (char* name);
Produces a top-level window. Name is the name of the window, which is what the window title bar displays.
The return value is the marker for the generated window and can be referenced by the function Glutgetwindow ().
int Glutcreatesubwindow (int win, int x, int y, int width, int height);
Creates a child window. Win is the marker for its parent window. X, Y is the displacement relative to the parent window, expressed in pixels.
Width,height is the width and height of the child window.
void Glutsetwindow (int win);
int Glutgetwindow (void);
The function is: Set the tag to win the window is the current window, return the current window of the marker.
void Glutdestroywindow (int win);
Destroys the window with the win tag.
void Glutpostredisplay (void);
Mark the current window and mark it to be displayed again.
void glutswapbuffers (void);
When the window mode is double-cached, the function is to swap the contents of the background cache to the foreground display. Of course, with only a single cache, it is used with the same functionality as Glflush ().
A double cache is used to display a complete picture at once on a window, or to animate.
void Glutpositionwindow (int x, int y);
Change the position of the current window: when the current window is the top-level window, x, Y is the offset from the screen, and X, Y is the displacement relative to the origin of the parent window when the current window is a child window.
void Glutreshapewindow (int width, int height);
Changes the size of the current window.
Width,height is the new width and height value of the current window, which can only be positive.
void Glutfullscreen (void);
Make the current window display full screen. The current window is only valid if it is a top-level window.
void Glutpopwindow (void);
void Glutpushwindow (void);
Valid for both the top-level window and the child window. Changes the order of the current window in the stack relative to other windows.
void Glutshowwindow (void);
void Gluthidewindow (void);
void Gluticonifywindow (void);
These three functions are to change the display state of the current window.
Glutshowwindow makes the current window visible (it may still be blocked by other windows).
Gluthidewindow makes the current window non-visual.
Gluticonifywindow makes the current window an icon, which is also minimized.
Glutsetwindowtitle (char* name);
Glutseticontitle (char* name);
Sets the title of the current window (which must be the top-level window) and the caption when it is being parameterized.
Glutsetcursor (int cursor);
Sets the cursor style for the current window.
There are a number of cursor selectable values: such as glut_cursor_right_arrow pointing to the right of the cursor, glut_cursor_left_arrow pointing to the left of the cursor, glut_cursor_info become a hand-shaped.
The Glut_cursor_destroy is forked and glut_cursor_help the shape of the question mark.
Wait a minute.
Four Overlay Management for Windows
void Glutestablishoverlay (void);
Creates an overlay layer on the current window. The pattern of the overlay diagram is determined by the initialization display mode function Glutdisplaymode (). Glutlayerget (glut_overlay_possible) can be used to set whether the current window is allowed to produce an overlay layer that specifies its pattern by the Initialize display mode function.
void Glutuserlayer (Glenum layer);
The enumeration layer optional value is: Glut_normal,glut_overlay. Select the normal bit plane or overlay plane, respectively.
void Glutremovelayer (void);
Remove the overlay map. When the layer is not covered, it is safe to call this statement, and the system does nothing.
void Glutpostoverlayredisplay (void);
Mark the overlay layer as a state that needs to be re-displayed.
void Glutshowoverlay (void);
void Gluthideoverlay (void);
Displays the overlay layer for the current window, and hides the overlay layer. These two statements are executed immediately. Note that only when the window is visible, you use Glutshowoverlay to make it overlay the layer's visual. When a window is obscured by another window, its overlay layer is obscured so that it is not visible.

int Glutget (glenum state); Retrieves the specified glut state

State to specify the type of status to retrieve, and for the following constants The glut_window_x describes the X-coordinate of the current window, in pixels glut_window_y the current window's Y-coordinate, in pixels glut_window_width Glut_window_height the height of the current window, in pixels, glut_window_buffer_size the current window, the number of bits occupied by the color component, that is, how many bit to represent the color component, when the width of its window is in pixels glut_window_ Stencil_size the number of bits occupied by the mask component in the current window, that is, how many bits are used to represent the mask component glut_window_depth_size the number of digits occupied by the depth component in the current window, that is, how many bit to represent the depth component Glut_window_red_ The number of bits that the red component occupies in the current window, that is, how many bits are used to represent the red component glut_window_green_size the number of digits that the green component occupies in the current window, that is, how many bit to represent the green component glut_window_blue_size the current window , the number of bits that the blue component occupies, that is, how many bits are used to represent the blue component glut_window_alpha_size the number of digits occupied by the Alpha color component in the current window, that is, how many bit to represent the alpha color component Glut_window_accum_red_size The number of bits occupied by the red component in the current window's cumulative cache, that is, how many bits are used to represent the red component glut_window_accum_green_size the number of digits occupied by the green component in the current window's cumulative cache, that is, how many bit to represent the green component Glut_window_ Accum_blue_size the number of bits that the blue component occupies in the current window's cumulative cache, that is, how many bits are used to represent the blue component glut_window_accum_alpha_size the number of digits occupied by the ALPHA color component in the current window's cumulative cache, That is, the number of bits to represent the alpha color component Glut_window_doublebuffer if windowed dual-cache mode, returns 1, otherwise 0 Glut_window_rgba if the window is RGBA mode, returns 1, otherwise returns 0 Glut_window_ Parent queries the current window's number of parents, if the top-level window returns 0 Glut_window_num_children query the number of child windows of the current window Glut_window_num_samples query the number of sample points for multiple samples Glut_window_stereo whether the query uses stereoscopic mode, returns 1, otherwise returns 0 Glut_window_cursor returns the integer of the cursor indicating the height of the glut_screen_height screen, in pixels glut_screen_ width, in pixels, glut_screen_width_mm the width of the screen, glut_screen_height_mm the height of the screen in millimeters, in millimeters glut_menu_num_items Queries the current menu contains the number of menu items glut_display_mode_possible the Query window system supports the current display mode, 1 indicates support, and 0 indicates that the display mode of the Glut_init_display_mode Initial window is not supported Glut_ Init_window_x the X-coordinate of the initial window glut_init_window_y the Y-coordinate of the initial window glut_init_window_width the width of the initial window glut_init_window_height the height of the initial window GLUT _elapsed_time returns the time interval of two calls to Glutget (Glut_elapsed_time) in milliseconds

The return value returns the corresponding value based on the contents of the query, and the invalid state name returns-1. int Glutlayerget (glenum info), querying the status of overlapping layers belonging to the current window

Info indicates that the overlapping layer state constant of the query is glut_overlay_possible to create overlapping layers for the current window in the given initial display mode. If it can, return 1; if not, return 0 glut_layer_in_use to return to the current usage layer for Glut_ NORMAL or Glut_overlay Glut_has_overlay determines whether the current window creates overlapping layers Glut_normal_damaged returns true if the image layer of the current window has been corrupted since the last time the callback function call was displayed Glut_ Overlay_damaged returns True int glutdeviceget (glenum info) If the overlapping layer of the current window has been corrupted since the last time the callback function call was displayed; retrieving device information

Info is the name of the device information to retrieve, for the following constants Glut_has_keyboard if the keyboard is available, return a non-0 value, otherwise, return 0 Glut_has_mouse if the mouse is available, return a non-0 value, otherwise, return 0 Glut_num_mouse_ BUTTONS returns the number of keys supported by the mouse, and returns a value of 0 if the mouse is not available, 0 means that the retrieved device does not exist, and not 0 indicates that the device is available with an int glutgetmodifiers (void); Returns the state return value of the combined function key as a constant defined by the following glut_active _shift when the SHIFT key is pressed Glut_active_ctrl when the CTRL key is pressed Glut_active_alt when the ALT key is pressed
The entity draws all of the following functions, radius represents the radius of the sphere, slices represents the number of spheres that the sphere splits around the z-axis, and stacks represents the number of spheres that are split along the z-axis.

The

Draw Center is in the model coordinate origin, radius is radius of the sphere, the sphere is divided slices times around the z axis, the sphere is divided stacks times void glutwiresphere (gldouble radius, glint slices, glint Stacks); Wireframe ball
Void Glutsolidsphere (gldouble radius, glint slices, glint stacks); solid ball void Glutwirecube (gldouble size); wireframe Cube
void Glutsolidcube (gldouble size); Solid cube void Glutwiretorus (gldouble Innerradius, gldouble Outerradius, glint nsides, glint rings); Wireframe ring
Void Glutsolidtorus (gldouble Innerradius, gldouble Outerradius, glint nsides, glint rings); Solid ring void Glutwireico Sahedron (void); wireframe 20 polygon
void Glutsolidicosahedron (void), solid 20 polygon void Glutwireoctahedron (void), wireframe 8 face body  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.