Using BCB to prepare OpenGL applications

Source: Internet
Author: User
Tags prepare win32

First, Introduction

OpenGL is an open three-dimensional graphics software package, it is independent of the window system and the operating system, the application based on it can be easily ported between various platforms, and convenient two-dimensional, three-dimensional graphics algorithm, to ensure the correctness and reliability of the algorithm.

There are two dynamic link libraries in the Windows\System directory of WIN98 or WIN95: Opengl32.dll and Glu32.dll. This is required for the OpenGL application to run correctly.

Second, the WIN32 under the OpenGL programming skill

Under WIN32 The window program must first process the device Description table, and the OpenGL program must also use the device Description table, which is similar to other WIN95 programs. However, OpenGL must use a special graphical operation description table, the use of OpenGL calls must use a graphical Operation description table, an OpenGL graphics Operation description Table has OpenGL and Windows window System related to the various information. The application creates an OpenGL graphical operation description table based on the specified device description table, as follows:

HDC HDC; Device Description Table

HGLRC HRC; OpenGL Graphical Operation Description Table

HDC=GETDC (HWND);

Hrc=wglcreatecontext (HDC);

The OpenGL graphical Operations Description table contains information about OpenGL. An OpenGL application must create a graphical operation description table, then start it, and finally, in the defined window, call the OpenGL function to draw the graph in the usual way.

Third, the specific preparation

1. Add a member variable and a member function to the header file of the main form (see example). At the beginning of the plus preprocessing is as follows:

#include <gl/gl.h>

#include <gl\glu.h>

2, in the main form file to add color initialization.

3. Draw the function of drawing.

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.