OpenGL 专栏
黑不溜秋的
3D图形-程序哥。
展开
-
OpenGL_ES- 状态查询
一: 查询关于OpenGL2.0实现信息: 1: 原型: const GLubyte* glGetString(GLenum name) 参数: GL_VENDOR, GL_RENDERER, GL_VERSION;二: 查询关于OpenGL2.0实现依赖限制: 1:原型: void glGetBoolean原创 2015-04-07 17:22:25 · 1283 阅读 · 0 评论 -
OpenGL_ES-纹理
OpenGL_ES2.0 -纹理一:纹理基础: 1: 纹素的概念: 一个二维纹理在OpenGLES2.0中是很常见的,二维纹理就是一个二维数组,每个数据元素称为纹素,具体格式如下:GL_RGB (Red, Green, Blue)GL_RGBA (Red, Green, Blue, Alpha)GL_LUM原创 2015-06-08 22:53:49 · 1592 阅读 · 0 评论 -
STATIC_DRAW, DYNAMIC_DRAW, STREAM_DRAW的区别
VBO允许usage标示符取以下9种值:GL_STATIC_DRAW_ARBGL_STATIC_READ_ARBGL_STATIC_COPY_ARBGL_DYNAMIC_DRAW_ARBGL_DYNAMIC_READ_ARBGL_DYNAMIC_COPY_ARBGL_STREAM_DRAW_ARBGL_STREAM_READ_ARB原创 2015-07-30 10:09:52 · 11470 阅读 · 0 评论 -
Per-fragment operations
原创 2015-07-30 15:24:34 · 1017 阅读 · 0 评论 -
OpenGL 获取当前屏幕坐标对应的三维坐标,使用很简单glu库中的一个函数
#include #include #include void display(void){ glClear(GL_COLOR_BUFFER_BIT); glFlush();}/* Change these values for a different transformation */void reshape(int w, int h){原创 2015-08-17 08:46:50 · 6895 阅读 · 1 评论 -
OpenGL 顶点数组的使用
#include #include #include #ifdef GL_VERSION_1_1#define POINTER 1#define INTERLEAVED 2#define DRAWARRAY 1#define ARRAYELEMENT 2#define DRAWELEMENTS 3int setupMethod = POINTER;原创 2015-08-17 08:29:07 · 1081 阅读 · 0 评论 -
OpenGLShader 编程系列 - 顶点缓冲区的使用
void initVertexBufferObjects(GLfloat *vertexBuffer, GLushort *indices, GLuint numVertices, GLuint numIndices, GLuint *vboIds){ glGenBuffers(2, vboIds); glBindBuffer(GL_ARRAY_BUFF原创 2014-12-10 16:35:48 · 799 阅读 · 0 评论 -
用模板类封装OpenGL Shader 的Uniform变量
struct UniformTypeName { std::string name; E_UniformType type; }; static UniformTypeName _datatypeToGlsl[17] = { {"float", UT_FLOAT}, {"vec2", UT_FLOAT_VEC2}, {原创 2015-01-04 19:16:40 · 1225 阅读 · 0 评论 -
用模板类封装OpenGL Shader Uniform 变量2
enum E_UniformType { UT_INT = 0x1404, UT_INT_VEC2 = 0x8B53, UT_INT_VEC3 = 0x8B54, UT_INT_VEC4 = 0x8B55, UT_FLOAT原创 2015-01-05 09:01:44 · 919 阅读 · 0 评论 -
OpenGL_ES-窗口环境
一:OpenGL_ES怎么和操作系统原生窗口联系的? OpenGL_ES应用程序运行linux,windows,MacOS或其他操作系统上的,这些操作系统都有自己的窗口系统,这些窗口都有一些配置参数,比如当前画刷颜色,窗口尺寸,状态信息等,这叫做窗口环境,Windows上又叫设备环境,同样OpenGL_ES要向窗口绘制内容,也需要有一个和应用程序窗口环境相匹配的渲染环境,叫Op原创 2015-01-25 04:44:53 · 1936 阅读 · 0 评论 -
OpenGL和Mesa的关系
Mesa3D provides an OpenGL implementation, just like NVidia's, AMD's, or Intel's drivers provide an OpenGL implementation. They are all OpenGL implementations. Like Ford, Buick, and Toyota are all type原创 2015-09-07 14:42:55 · 12464 阅读 · 0 评论 -
OpenGL 驱动 与 扩展的关系
为什么驱动是OpenGL 4.3 的实现, 而却找不到glTextureStorage2D的定义呢。 那是因为GLEW版本较旧, 升级下GLEW就可以了。驱动是OpenGL的实现。 而扩展是调用驱动的接口, 两回事, 一个是面向底层硬件, 一个是面向开发者。GLEW封装了OpenGL的扩展, 从1.1 到 4.5 。原创 2016-11-28 10:09:22 · 984 阅读 · 0 评论 -
opengl opengles 版本对应的时间
1992: OpenGL1.0~OpenGL 1.5是经典的固定管线时代; (1): 顶点数组 (2): 显示列表 (3): 纹理对象 (4): 帧缓冲区 (5): 缓冲对象 2004: OpenGL 2.0~OpenGL2.原创 2017-05-23 17:53:29 · 4459 阅读 · 0 评论 -
Summary of OpenGL ES 3.0 Programming Guide
零:OpenGLES简介: OpenGLES 是用于嵌入式系统的一个3D图形编程接口规范,支持IOS,Android,Linux,Windows,WebGL。一:渲染管线: 1: VertexBufferArrayObject 2:VertexShader (坐标变换和光照) 3:Primitive Assembly(Clipping, Per原创 2017-05-25 12:34:01 · 609 阅读 · 0 评论 -
Android上的OpenGLES程序--开发环境介绍
我觉得这篇文章思路是对的, 随着项目的积累, 我发现这里面有些细节描述是不对的, 希望不要误导大家! 几年前搞过一个Android项目, 对Android开发有个简单了解, OpenGLES 是嵌入式三维图形规范, 如果不在Android上做点东西,感觉有点遗憾。 从现在开始, 尝试写一套OpenGLES 的 Android 开发教程.一: Android 开发环境和流程介原创 2017-07-05 09:13:07 · 2658 阅读 · 0 评论 -
理解OpenGLSuperbible7-窗口和GLContext
#pragma once#include #include #include #include #include #include #include #include #include class GLApplication{public: GLApplication(); virtual ~GLApplication原创 2016-12-06 17:28:14 · 1592 阅读 · 0 评论 -
OpenGL 实用程序框架设计实现-Windows上的小框架:
1: OpenGL窗口管理 2:摄像机3:数学函数4:图片载入5:日志二:OpenGL窗口管理 1:渲染前, 创建 OpenGL 窗口 1):首先创建一个Windows窗口,我叫DC,怎么创建不说,这是Windows窗口程序的事情,此处略。 2):其次OpenGL自身有个渲染上下文,叫RC,实际渲原创 2016-01-25 19:29:49 · 1980 阅读 · 1 评论 -
glfw 如何 在创建 context 指定 opengl 版本
1: if (ctxconfig->major != 1 || ctxconfig->minor != 0) { setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major); setGLXattrib(GLX_CONTEXT_MINOR_VERSIO原创 2016-11-20 11:34:20 · 1772 阅读 · 0 评论 -
OpenGLShader 编程系列-属性变量,一致变量的传递
int Init ( ESContext *esContext ){ esContext->userData = malloc(sizeof(UserData)); UserData *userData = esContext->userData; GLbyte vShaderStr[] = "uniform mat4 u_mvpMatri原创 2014-12-08 16:08:19 · 1237 阅读 · 0 评论 -
OpenGLShader 编程系列- glUniform*的使用
//------------gluniform------------------ glUniform2f(location, 1.0f, 0.0f); glUniform2i(location, 1, 0); GLfloat coord[4] = {1.0f, 0.75f, 0.25f, 0.0f}; glUniform4fv(locatio原创 2014-12-08 15:40:00 · 2118 阅读 · 0 评论 -
opengl入门系列2- 模型视图矩阵变换
一:基础知识: openGL原创 2014-09-12 17:06:27 · 1799 阅读 · 1 评论 -
opengl入门系列-Bezier曲线
#include #include #include GLfloat ctrlpoints[4][3] ={ {-4.0, -4.0, 0.0}, {-2.0, 4.0, 0.0}, {2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}};void init(void){ glClearColor(0.0,原创 2014-09-23 09:33:08 · 1015 阅读 · 0 评论 -
opengl入门系列3-裁剪平面
#include #include void init(void){ glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT);}void display(void){ GLdouble eqn[4] = {0.0, 1.0, 0.0, 0.0}; GLdouble e原创 2014-09-16 09:22:30 · 1253 阅读 · 0 评论 -
OpenGL入门系列- OpenGL_ES 在 本地操作系统窗口上绘制的过程过程
EGL 是 Opengl_ES 和 本地操作系统窗口的粘合剂,原创 2014-09-27 20:26:05 · 1597 阅读 · 0 评论 -
opengl入门系列4-颜色索引模式
#include #include #include #define RAMPSIZE 16#define RAMP1START 32#define RAMP2START 48static float rotAngle = 0.;void init(void){ int i; for(i = 0; i {原创 2014-09-18 13:29:08 · 2205 阅读 · 2 评论 -
opengl入门系列-glVertexAttribPointer的解释
glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *ptr);原创 2014-09-28 22:49:56 · 6769 阅读 · 0 评论 -
OpenGL入门系列6 - 累积缓冲区用法例子
#include #include //#include "jitter.h"void init(void){ GLfloat mat_ambient[] = {1.0, 1.0, 1.0, 1.0}; GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0}; GLfloat light_position[] =原创 2014-09-20 20:29:13 · 1019 阅读 · 0 评论 -
opengl入门系列5-视景体定义
#include #include #include #include "jitter.h"#define PI_ 3.14159265358979323846/* accFrustum() * The first 6 arguments are identical to the glFrustum() call. * * pixdx and pixdy a原创 2014-09-19 13:35:28 · 2256 阅读 · 0 评论 -
opengl: 编程指南例子解析 opengl_wrap
#include using namespace std;#include #include #include #define checkImageWidth 64 //图片宽度#define checkImageHeight 64 //图片高度static GLubyte checkImage[checkImageWidth][checkImageH原创 2014-06-26 13:49:02 · 990 阅读 · 0 评论 -
opengl: 颜色立方体
// ccube.c// OpenGL SuperBible// Demonstrates primative RGB Color Cube// Program by Richard S. Wright Jr.#include "../../Common/OpenGLSB.h" // System and OpenGL Stuff/* 颜色立方体 *///旋转角度st原创 2013-09-05 19:47:15 · 2391 阅读 · 0 评论 -
opengl: Opengl的扩展
一: 概述:OpenGL和Direct3D比较起来,最大的一个长处就是其扩展机制。硬件厂商开发出一个新功能,可以针对新功能开发OpenGL扩展,软件开发人员通过这个扩展就可以使用新的硬件功能。所以虽然显卡的发展速度比OpenGL版本更新速度快得多,但程序员仍然可以通过OpenGL使用最新的硬件功能。而Direct3D则没有扩展机制,硬件的新功能要等到微软发布新版DirectX后才可能支持。原创 2014-06-15 01:25:41 · 1471 阅读 · 0 评论 -
opengl: Opengl ES 网站社区
官方:http://www.khronos.org/原创 2014-04-29 11:27:59 · 872 阅读 · 0 评论 -
opengl: 太阳地球和月亮
// Solar.c// OpenGL SuperBible// Demonstrates OpenGL nested coordinate transformations// and perspective// Program by Richard S. Wright Jr./*原作者: Richard S. Wright Jr, 我在这里学习翻译一下 */#inclu原创 2013-08-30 21:44:02 · 5943 阅读 · 1 评论 -
opengl: -- 飞机
// Ambient.c// OpenGL SuperBible// Beginning of OpenGL lighting sample// Demonstrates Ambient Lighting// Program by Richard S. Wright Jr./* OpenGL 超级宝典例子, 翻译*/#include "../../Common/OpenGL原创 2013-09-05 13:46:27 · 3449 阅读 · 1 评论 -
opengl入门系列1- OpenGL纹理环绕
//在Ubuntu12.04 QT 上编译通过;先上代码:原创 2014-09-11 10:23:52 · 1061 阅读 · 0 评论 -
opengl入门系列- 颜色混合
#include #include void init(void){ glClearColor(1.0, 1.0, 0.0, 0.0); glBlendFunc(GL_ONE, GL_ONE); glEnable(GL_BLEND);}void display(void){ glClear(GL_COLOR_BUFFER_BI原创 2014-10-23 12:46:08 · 615 阅读 · 0 评论 -
opengl入门系列-位图字体
#include #include #include using namespace std;GLubyte rasters[24] = { 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0原创 2014-10-07 23:36:55 · 1219 阅读 · 0 评论 -
获取 OpenGL 常用信息
void Context::getGLExtension() { const char* sVersion = (const char*)glGetString(GL_VERSION); this->_version = std::string(sVersion); const char* sShadingLang原创 2014-12-01 18:32:01 · 4414 阅读 · 0 评论 -
获取opengl_es函数扩展的方法
如果标准里没有定义一个函数, 可以用扩展的形式取得函数指针, 然后判断函数指针是否为空, 不为空就可以使用这个函数了. 例如: 获取 VAO的扩展, 这个在OpenGL2.0标准里没有定义, 只能通过扩展的形式取得. #include /* VAO 获取VAO扩展 in opengl2.0 PFNGLGENVERTEXAR原创 2014-12-03 13:26:01 · 3078 阅读 · 2 评论 -
OpenGL_ES-光照(光照基础,漫反射,镜面反射)
一:基础定义 1:颜色定义: 对于大多数计算机显示器来说,颜色信息的显示只是依靠三种光波的组合:红,绿,蓝.所以颜色可以用红,绿,蓝三元素表示,每个 分量都在0到1区间,颜色即能够代表光的光谱成分,也能代表光的强度.颜色可用和一个三维向量表示,有加法和乘法. 2:光源: 1):环境光:环境光是一种低强度的光,由光线原创 2015-01-27 19:17:34 · 9156 阅读 · 1 评论