zoukankan      html  css  js  c++  java
  • opengl:初次接触

    1.概述

    OpenGL(Open Graphics Library),开放的图形程序接口,是编程接口的规范,并不是像OpenCV那样是库。GLFW是开源的基于opengl标准的库,并且是跨平台的。其开源协议是zlib/libpng,也是一种很宽松的协议。

    opengl-tutorial是一个很好的入门学习网站。

    2.GLFW安装

    下载官方的编译好的二进制文件,然后设置VS的相关路径就可以使用的,当然也可以按照tutorial编译源码然后使用。

    3.绘制窗口

    下面是使用glfw绘制一个简单的窗口,顺便检测环境是否正常。

    #include <GLFWglfw3.h>
    
    int main(void)
    {
    	GLFWwindow * window;
    	if (!glfwInit()) //使用glfw之前需要先初始化
    	{
    		glfwTerminate(); //任何情况下退出使用glfw需要调用终止接口来释放资源,并且终止后再次使用仍然需要初始化
    		return -1;
    	}
    
    	window = glfwCreateWindow(640, 480, "hhh", NULL, NULL);
    
    	if (window == NULL)
    	{
    		glfwTerminate();
    		return -1;
    	}
    
    	glfwMakeContextCurrent(window);
    
    	while (!glfwWindowShouldClose(window))
    	{
    
    		// draw smt
    
    		glfwSwapBuffers(window);
    
    		glfwPollEvents();
    
    	}
    
    	glfwTerminate();
    
    	return 0;
    
    }
    
    ------------ 转载请注明出处 ------------
  • 相关阅读:
    织梦开发——相关阅读likeart应用
    织梦标签教程
    织梦专题调用代码
    HIT 2543 Stone IV
    POJ 3680 Intervals
    HIT 2739 The Chinese Postman Problem
    POJ 1273 Drainage Ditches
    POJ 2455 Secret Milking Machine
    SPOJ 371 Boxes
    HIT 2715 Matrix3
  • 原文地址:https://www.cnblogs.com/whlook/p/8053466.html
Copyright © 2011-2022 走看看