OpenGL Learning (6) discrete elements

Source: Internet
Author: User

Bitmap

Bitmap display. The following code displays an 8x8 chessboard:

 
Glubyte WB [2] = {0x00, 0xff}; glubyte check [64*8]; for (INT I = 0; I <64; I ++) for (Int J = 0; j <8; j ++) Check [I * 8 + J] = WB [(I/8 + J) % 2]; glbitmap (64, 64, 220.0, 220.0, check );

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/48/10/wKioL1QFg__Bxp0fAACqcedUSYo765.jpg "Title =" qq20140902164614.png "alt =" wkiol1qfg1_bxp0faacqcedusyo765.jpg "/>

Void glbitmap (glsizei width, glsizei height, glfloat x0, glfloat y0, glfloat XI,

Glfloat Yi, glubyte * bits)

// Draw a bitmap with width and height based on the array bits. The offset from the starting position of the bitmap to the current position of the grating is x0 and Y0. After the bitmap is displayed, the current position increases with Xi and Yi as coordinates.

Void glrasterpos * () is used to set the grating position.

Note: after this function is called, the color of the grating will be locked, and glcolor will not work for the color of the bitmap.


Drawing Mode

When a pixel is drawn, if a pixel already exists at the position of the pixel to be drawn, the new value of the target pixel is the result of the source color and the target color following certain rules. You can use the following function settings to perform operations:

Void gllogicop (glenum OP)

// If the logic operation (gl_color_logic_op) is enabled, this function can be used to integrate the source and target pixels in the frame cache into which one of the 16 logical operations is used. The parameter value can be set to gl_copy (default), gl_or, or gl_xor.

You must use the following functions to enable logical operations:

Glable (gl_color_logic_op)

OpenGL Learning (6) discrete elements

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.