从 Cygwin 下的 OpenGL 开始 [英] Starting off with OpenGL under Cygwin

查看:14
本文介绍了从 Cygwin 下的 OpenGL 开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Cygwin 下编译和运行 OpenGL 程序?如果是,如何?

Is it possible to compile and run OpenGL programs from under Cygwin? If yes, how?

推荐答案

可以在 Cygwin 下编译和运行 OpenGL 程序.我在这里说明了基本步骤:

It is possible to compile and run OpenGL programs under Cygwin. I illustrate the basic steps here:

  1. 我假设您了解 OpenGL 编程.如果没有,请获取红皮书(OpenGL 编程指南).无论如何,这是 OpenGL 的必读内容.

  1. I assume you know OpenGL programming. If not, get the Red Book (The OpenGL Programming Guide). It is mandatory reading for OpenGL anyway.

我假设你已经安装了 Cygwin.如果没有,请访问 cygwin.com 并安装它.

I assume you have Cygwin installed. If not, visit cygwin.com and install it.

要编译和运行 OpenGL 程序,您需要名为 opengl 的 Cygwin 包.在 Cygwin 安装程序中,可以在 Graphics 部分下找到它.请安装此软件包.

To compile and run OpenGL programs, you need the Cygwin package named opengl. In the Cygwin installer, it can be found under the Graphics section. Please install this package.

编写一个简单的 OpenGL 程序,比如 ogl.c.

Write a simple OpenGL program, say ogl.c.

使用标志-lglut32 -lglu32 -lopengl32编译程序.(这会将您的程序与 GLUT、GLU 和 OpenGL 库链接起来.一个 OpenGL 程序通常可能使用所有这三个库中的函数.)例如:

Compile the program using the flags -lglut32 -lglu32 -lopengl32. (This links your program with the GLUT, GLU and OpenGL libraries. An OpenGL program might typically use functions from all the 3 of them.) For example:

$ gcc ogl.c -lglut32 -lglu32 -lopengl32

$ gcc ogl.c -lglut32 -lglu32 -lopengl32

  • 运行程序.就这么简单!

  • Run the program. It's as simple as that!

    这篇关于从 Cygwin 下的 OpenGL 开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆