Change the error code after qt4 In the QT OpenGL Chinese tutorial (1)

Source: Internet
Author: User

The code is not analyzed here because it is enough in the tutorial. If you are interested, you can check the code yourself. This tutorial comes from the original neheopengl Chinese tutorial (http://www.yakergong.net/nehe/), but it has a bad place, that is, when I go to see, it can not download the code ~~~~ Maybe my character is poor. It can be used as a reference.

So I chose the following Tutorial:

Tutorial address:Qt OpenGL Chinese tutorialHttp://www.qiliang.net/old/nehe_qt/index.html)

I am studying this tutorial, but I found it takes too long:

According to the version changes of QT, some of the content is now incorrect. During this learning process, we will sort out the errors in learning as follows, all the code has been changed before it can run normally. For details about the content change and environment configuration of the first tutorial, see the previous blog post: Configure OpenGL in QT In ubuntu. [Note, you do not need to use Mesa during configuration! Use the configuration in the previous tutorial]

My environment:Ubuntu13.10 + qt5.3 + QT creator3.1.1 + freeglut3(For the configuration process, refer to the previous blog)

Correction 1: As in the previous tutorial, it is the most basic correction. Basically, the code of each tutorial must be corrected with error 1.

Correction 2: the first three tutorials only need to be corrected by correction 1. All of the following tutorials need to be checked for correction 1:

Lesson 1: Create an OpenGL window

Lesson 2: Your first Polygon

Lesson 3: coloring

From http://www.qiliang.net/old/nehe_qt/index.html>

Correction 3:Lesson 4: rotatingAfter running, my result cannot be rotated. After thinking, it is because the Code does not add a signal to receive rotation (each time the full screen and non-full screen switch back are rotated), so in the function: add a line of code in keypressevent:

Switch (e-> key ())

{

........

Case QT: key_r:

Update ();

Break;

........

}

When you press the "r" key, the rotation is displayed. To ensure the obvious rotation, we recommend that you increase the cumulative and progressive values of rtri and rquad by at least 1, it will be obvious.

Correction 4: Lesson 5: To enter 3D, needless to say, change all the previous changes.

Correction 5: Lesson 6: texture ing first, change the previous correction. Then an error is prompted during the build:

Qimage dummy (128,128, 32)The third parameter is incorrect. After qt4, the third parameter isQimage: FormatIn the format of Enum, the value ranges from 0 to 18, where 32 should be changed:Qimage: format_rgb32. (For more information, see the QT documentation ). At the same time, the following line:Dummy. Fill (QT: Green. RGB ()), Changed:Dummy. Fill (QT: Green). Second, to run successfullyCopy a copy of the data folderPut it in the file you just created, so that you can use the nehe.bmp file. OK. After running, press the "r" key to see the rotation.

OK. Let's take the Sixth lesson today. I have to study the functions and other things in it. I will make some corrections in the next blog post.

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.