glteximage* parameter explanation

Source: Internet
Author: User

Glteximage2d (m_texturetarget, 0, Gl_rgba, M_image.columns (), M_image.rows (), 0, Gl_rgba, Gl_unsigned_byte, M_blob.data ());


This is the code in the Ogldev, the author in the tutorial proposed to change the 3rd parameter to gl_red test, the results show that only the output of red.

I changed the 7th parameter to gl_red, and it turned out to be a complete change.


First, the last three parameters represent the format, type, and pointer of the source data passed in to the texture object, respectively.

Secondly, the author calls the Magick library when reading the texture, and magick::image the data in the format "RGBA" into the Magick::bolb, if the Bolb format is set here, So why do you need to write a second Gl_rgba in glteximage2d?

The author describes the Blob as a certain description:

The BLOB (Binary Large Object) is a useful mechanism for storing an encoded image in memory in a-the-it can be used B y external programs. (BLOB is an effective mechanism that can be called by an external program to store encoded images in memory) However, this is only a description of the function, without stating the substance. The answer to the mother's degree is as follows:

BLOB (Binary large object), binary large, is a container that can store binary files.

If the bolb is just a bunch of binary numbers, then it needs to specify the format and type when it is used as the data source for the image.

Finally, I understand that:

The 7th parameter describes the texture object to establish several color channels, such as: gl_red 1, Gl_rgb 3

The 3rd parameter describes the values of which channels the texture object passes to pipeline.


(There is no further verification, it is probably wrong, and then perfect it.) )


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.