TEXT 31
Opengl.txt Guest on 10th February 2021 12:42:17 AM
  1.  
  2. Entry: Shaders
  3. Date: Tue Feb 24 02:09:35 EST 2015
  4.  
  5. I left OpenGL before the shader business.  A lot has happened in 10
  6. years, so maybe time to rethink / relearn a couple of things.
  7.  
  8. Bascially, what I want to do is visualize audio data, as spectra,
  9. waveforms or other kinds of control curves.  It seems more appropriate
  10. these days to push the raw data arrays to the GPU and have it do
  11. processing.
  12.  
  13. Recap
  14.  
  15. - Vertex shaders[2]
  16.  
  17. compute vertices based on vertices (and textures?)
  18.  
  19. - Pixel (Fragment) shaders[3]
  20.  
  21. compute pixels based on vertices and textures.
  22.  
  23.  
  24. In OpenGL ES, all the core functionality is removed, so nothing can be
  25. rendered without shaders[1].
  26.  
  27.  
  28. [1] http://glslstudio.com/primer/#gl2prog
  29. [2] https://www.opengl.org/wiki/Vertex_Shader
  30. [3] https://www.opengl.org/wiki/Fragment_Shader
  31.  
  32.  
  33.  
  34. Entry: Today's the day
  35. Date: Fri Feb 27 12:21:07 EST 2015
  36.  
  37. To get it to work.
  38.  
  39. Yeah maybe not :)
  40. Running into some OpenGL (version) errors.
  41. Man this never really worked well did it?
  42.  
  43. GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES
  44.  
  45.  
  46. Stuck at 1.20
  47. Is that a problem?
  48.  
  49. Maybe the GPU is just too simple?
  50.  
  51. Also trouble on an AMD card.
  52.  
  53. https://www.reddit.com/r/opengl/comments/1gjl7e/how_can_i_get_glsl_shaders_version_150_to_work_on/
  54. http://www.lighthouse3d.com/tutorials/glsl-tutorial/?pipeline
  55. https://www.reddit.com/r/archlinux/comments/1efhw8/opengl_not_working_on_intel_hd_4000_is_working_on/
  56. http://cgit.freedesktop.org/mesa/mesa/tree/docs/GL3.txt
  57.  
  58.  
  59. Entry: Gui
  60. Date: Fri Feb 27 21:09:24 EST
  61.  
  62. Widgets are a grid.  That seems simplest.  Need mouse clicks.
  63.  
  64. Basically, a widget is a rectangle and needs to be able to draw
  65. itself.
  66.  
  67. I need to stick to glsl 1.2 for now due to HW limitations.
  68.  
  69.  
  70. So does this really all need to be done with shaders now?
  71. In ES 2.0 shaders are mandatory.
  72. Projection and modelview are removed
  73.  
  74. What goes into the shader?
  75.  
  76. From [2] it seems that uploading a matrix to the GPU is what's done
  77. these days.
  78.  
  79. So if there is no default pipeline, why are coordinates still -1 to 1?
  80. Seems so. glViewPort() and normalized device coordinates are still used[3].
  81.  
  82.  
  83.  
  84. Variables:
  85. - uniform: (global) all shaders can access as long as they declare
  86. GLint myLoc = glGetUniformLocation(p, "myVar");
  87. glProgramUniform4f(p, myLoc, 1.0f, 2.0f, 2.5f, 2.7f);
  88.  
  89. - attribute: stuff is fed into the shader
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. [1] https://stackoverflow.com/questions/16106854/opengl-es-2-0-and-shaders
  97. [2] https://stackoverflow.com/questions/2713417/which-opengl-functions-are-not-gpu-accelerated
  98. [3] https://www.opengl.org/sdk/docs/man/html/glViewport.xhtml
  99.  
  100.  
  101.  
  102.  
  103. Entry: Vertex Attributes
  104. Date: Sat Feb 28 02:29:24 EST
  105.  
  106. Let me see if I understand this.
  107.  
  108. The vertex shader takes attributes and produces gl_Position
  109. ( Can it produce more attributes? )
  110.  
  111. Attributes are passed to the renderer by:
  112. glGenBuffers()  // generate a buffer obect
  113. glBindBuffer(GL_ARRAY_BUFFER) // bind buffer to vertex attributes
  114. glBufferData() // copy data, set usage pattern[1]
  115. glDrawArrays() // draw the enabled arrays, interpreting as sequence of primitives
  116.  
  117. [1] https://stackoverflow.com/questions/8281653/how-to-choose-between-gl-stream-draw-or-gl-dynamic-draw

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.