OpenGL 第12-14 Talk Summary

Source: Internet
Author: User

First of all, why did you not write the 10th lecture on the control 3D scene and the 11th to tell the red flag to float? Because didn't look ah haha, and I try to run the red flag fluttering when the computer blue screen (probably not its pot), temporarily skipped.

Well, from 12 to 14, I've learned a lot about these things, one that uses lists to create duplicate objects in batches, and a display of the text.

Create a list: (Easy to write your own code directly, is actually lazy)

glvoid buildlists () {box= Glgenlists (2);//Create a name for two display listsglnewlist (Box,gl_compile); //Create a first display list
Glbegin (gl_quads);//start drawing a quadrilateral/* drawing polygon
*
*/
Glend (); Glendlist ();
Top=box+1;//start drawing a second listGlnewlist (Top,gl_compile);//Display list at the top of the boxGlbegin (gl_quads);//Start Drawing quadrilateral//above Glend (); //End Drawing quadrilateralGlendlist ();//The second display list is created}

So get the list, give me the feeling is to save the code between Glnewlist (,) and Glendlist (), the effect of the later use of Glcalllist () is to put the code stored here to go to do it again, the tune once to execute once.

And about the effect of 3D text:

glvoid Buildfont (glvoid) {Base=glgenlists ( the);                        Hfont font; //Font handleHfont Oldfont;//Old font handleFont = CreateFont (- -,//Font height             0,//Font Width             0,//font Rotation angle Angle of escapement             0,//the rotation angle of the font bottom orientation AngleFw_bold,//weight of the fontFALSE,//whether to use italic bodyFALSE,//whether to use underscoresFALSE,//whether to use strikethroughAnsi_charset,//Set character setsOut_tt_precis,//Output AccuracyClip_default_precis,//Clipping accuracyAntialiased_quality,//Output Qualityff_dontcare| Default_pitch,//Family and Pitch             "Courier New");//Font nameOldfont = (hfont) SelectObject (HDC, font);//Choose the fonts we need//Wglusefontbitmaps (HDC, +, +, base); //Create 96 display lists and draw characters from ASCII code 32-128Wglusefontoutlines (HDC,//sets the handle of the current Window device Description table        0,//the ASCII value used to create the first character of a display list font        255,//Number of characters        Base,//name of the first display list        0.0f,//the smoothness of the font, the smaller the smoother, 0.0 for the smoothest state        0.2f,//The distance protruding in the z directionWgl_font_polygons,//use polygons to generate characters with separate normals for each vertexGMF);//an address of an array that receives glyph metric data, with each array element populated with data that corresponds to the display list characterSelectObject (HDC, Oldfont); //Select the original fontDeleteObject (font);//Delete Font}

The evolution from 2D to 3D is to change the annotation to the back of the Wglusefontoutlines (), and to be able to see that it is 3D, you need to rotate some angle.

As for the other words there seems to be nothing special, today there is no state, do not see how much, come here.

By the way, there is also a point, the example of why the use of Sin,cos and the like, and later thought, maybe because with sin (x), cos (x) of the constant growth of x, its value will only fluctuate between -1~1, and then the graph will not be out of the screen, this should be the reason.

OpenGL 第12-14 Talk Summary

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.