opengl

Using OpenGL shaders for math calculation (C++)

只愿长相守 提交于 2021-02-08 06:35:35
问题 I have a matrix (for example 100x100 dimantion): I need to do calculation with each element ( matrix[i,j]*tt/8+5 for example) I have huge matrix and I want to implement the algorithm using OpenGL shaders. I want to use shader like: uniform float val; uniform float tt; void main() { gl_Position.x = val*tt/8+5 } How I can implement the program? How I can get matrix after calculation(I do not want to show any windows\pictures? 回答1: It is possible if you create a fake window frame buffer. See my

webgl推荐书籍

扶醉桌前 提交于 2021-02-08 05:25:44
网址:https://www.douban.com/doulist/45940373/ webgl 来自: Pasu 2017-04-17创建 2017-07-25更新 推荐 关注 2 人关注 全部(8) · 图书(8) 来自:豆瓣读书 OpenGL Insights (8人评价) 作者: Patrick Cozzi / Christophe Riccio 出版社: A K Peters/CRC Press 出版年: 2012-6-26 2017年7月25日 赞 回复 来自:豆瓣读书 WebGL Insights (2人评价) 作者: Patrick Cozzi 出版社: A K Peters/CRC Press 出版年: 2015-8-3 2017年7月25日 赞 回复 来自:豆瓣读书 3D Engine Design for Virtual Globes (6人评价) 作者: Patrick Cozzi / Kevin Ring 出版社: A K Peters/CRC Press 出版年: 2011-6-21 2017年4月17日 赞 回复 来自:豆瓣读书 图形着色器 7.3 (17人评价) 作者: 贝利 (Mike Bailey) / 坎宁安 (Steve Cunningham) 出版社: 清华大学出版社 出版年: 2013-4-1 2017年4月17日 赞 回复 来自

推荐几本对于学习WebGL有帮助的书籍

血红的双手。 提交于 2021-02-08 05:16:09
本人是今年准备毕业的大四学生,算是快进入社会的编程小白一枚,大学期间自己在网上搜集资料自学完了有关于WebGL的相关基础课程,现在在这里分享一下我学习用到的书籍,希望帮助到许多想学但又不知道如何下手的人,大家一起进步。 1.首先对于有一定javascript基础的人可以看 《[JavaScript权威指南(第六版)].(美)David.Flanagan》 ,写的很细,而且不是很难。熟读之后自己的能力会有很大的提高,没有一定基础的话可以去w3cschol了解相关知识,再回头来看这本书。 2.有 一定基础 且消除了对于js的 陌生感 之后,就可以开始WebGL的学习了。首先因为WebGL本身是有一定难度的,所以学习过程中一定要静下心,我推荐的书籍是 《WebGL编程指南.》 ,这本书比较详细的讲述了相关的运行原理,对打基础很有帮助。但就像前面说的,WebGL本身具有一定难度,所以在阅读本书时难免会感觉很吃力,有些部分学习起来感觉很生硬,这都是正常的,遇到不懂得点可以上网多查查,不要着急。 3.在自己有一定把握之后,就可以开始接下来的学习。 《THREE.JS开发指南》 ,这本书会教你如何搭建相关场景,当你熟读之后就可以做出自己喜欢的场景了。 注 :当初有一段时间我觉得WebGL很难,陷入瓶颈,就在网上翻大佬们的贴,看到有人说学习WebGL最好先了解OpenGL之后在学

Meaning of “index” parameter in glEnableVertexAttribArray and (possibly) a bug in the OS X OpenGL implementation

依然范特西╮ 提交于 2021-02-08 04:48:47
问题 1) Do I understand correctly that to draw using vertex arrays or VBOs I need for all my attributes to either call glBindAttribLocation before the shader program linkage or call glGetAttribLocation after the shader program was successfully linked and then use the bound/obtained index in the glVertexAttribPointer and glEnableVertexAttribArray calls? To be more specific: these three functions - glGetAttribLocation, glVertexAttribPointer and glEnableVertexAttribArray - they all have an input

Draw IOSurfaces to another IOSurface

眉间皱痕 提交于 2021-02-08 04:39:43
问题 How can I draw a series of IOSurfaces to another then draw it to the screen? I've played around with some source from apple in the MultiGPU sample project, but the best I managed to do is draw a white screen or get tons of artifacts and crash the app. I'm very new to openGL and I don't quite understand the binding of framebuffers and textures and how they interact with IOSurfaces. This is what I have to create a texture from an IOSurface (directly from Apple's source) // Create an IOSurface

How to rotate a 2D line in PyOpenGL?

社会主义新天地 提交于 2021-02-08 01:28:31
问题 I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) glVertex2f(0,500) glVertex2f(0,-500) glEnd() glFlush() Now I'm trying to rotate the line. I'm trying to follow this documentation but can't understand. According to the documentation the rotating function is defined as follows: def glRotate( angle , x , y , z ): I've no z-axis. So I'm

How to rotate a 2D line in PyOpenGL?

泄露秘密 提交于 2021-02-08 01:21:10
问题 I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) glVertex2f(0,500) glVertex2f(0,-500) glEnd() glFlush() Now I'm trying to rotate the line. I'm trying to follow this documentation but can't understand. According to the documentation the rotating function is defined as follows: def glRotate( angle , x , y , z ): I've no z-axis. So I'm

How to rotate a 2D line in PyOpenGL?

孤者浪人 提交于 2021-02-08 01:20:13
问题 I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) glVertex2f(0,500) glVertex2f(0,-500) glEnd() glFlush() Now I'm trying to rotate the line. I'm trying to follow this documentation but can't understand. According to the documentation the rotating function is defined as follows: def glRotate( angle , x , y , z ): I've no z-axis. So I'm

gluPerspective vs. gluOrtho2D

匆匆过客 提交于 2021-02-07 20:12:35
问题 I have looked at the documentation on MSDN about these 2 functions. However, I don't exactly understand the difference between these 2 functions, other than one is for setting camera view for 3D, and the other one is for setting camera view for 2D. It would be great if it can be answered. Thanks in advance for comments. 回答1: An orthographic projection is basically a 3D projection that does not have perspective. Essentially it means that a given position does not get closer to the centre of

gluPerspective vs. gluOrtho2D

女生的网名这么多〃 提交于 2021-02-07 20:09:43
问题 I have looked at the documentation on MSDN about these 2 functions. However, I don't exactly understand the difference between these 2 functions, other than one is for setting camera view for 3D, and the other one is for setting camera view for 2D. It would be great if it can be answered. Thanks in advance for comments. 回答1: An orthographic projection is basically a 3D projection that does not have perspective. Essentially it means that a given position does not get closer to the centre of