OpenGL hacking Entry: Shaders Date: Tue Feb 24 02:09:35 EST 2015 I left OpenGL before the shader business. A lot has happened in 10 years, so maybe time to rethink / relearn a couple of things. Bascially, what I want to do is visualize audio data, as spectra, waveforms or other kinds of control curves. It seems more appropriate these days to push the raw data arrays to the GPU and have it do processing. Recap - Vertex shaders[2] compute vertices based on vertices (and textures?) - Pixel (Fragment) shaders[3] compute pixels based on vertices and textures. In OpenGL ES, all the core functionality is removed, so nothing can be rendered without shaders[1]. [1] http://glslstudio.com/primer/#gl2prog [2] https://www.opengl.org/wiki/Vertex_Shader [3] https://www.opengl.org/wiki/Fragment_Shader Entry: Today's the day Date: Fri Feb 27 12:21:07 EST 2015 To get it to work. Yeah maybe not :) Running into some OpenGL (version) errors. Man this never really worked well did it? GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES Stuck at 1.20 Is that a problem? Maybe the GPU is just too simple? Also trouble on an AMD card. https://www.reddit.com/r/opengl/comments/1gjl7e/how_can_i_get_glsl_shaders_version_150_to_work_on/ http://www.lighthouse3d.com/tutorials/glsl-tutorial/?pipeline https://www.reddit.com/r/archlinux/comments/1efhw8/opengl_not_working_on_intel_hd_4000_is_working_on/ http://cgit.freedesktop.org/mesa/mesa/tree/docs/GL3.txt Entry: Gui Date: Fri Feb 27 21:09:24 EST 2015 Widgets are a grid. That seems simplest. Need mouse clicks. Basically, a widget is a rectangle and needs to be able to draw itself. I need to stick to glsl 1.2 for now due to HW limitations. So does this really all need to be done with shaders now? In ES 2.0 shaders are mandatory. Projection and modelview are removed What goes into the shader? From [2] it seems that uploading a matrix to the GPU is what's done these days. So if there is no default pipeline, why are coordinates still -1 to 1? Seems so. glViewPort() and normalized device coordinates are still used[3]. Variables: - uniform: (global) all shaders can access as long as they declare GLint myLoc = glGetUniformLocation(p, "myVar"); glProgramUniform4f(p, myLoc, 1.0f, 2.0f, 2.5f, 2.7f); - attribute: stuff is fed into the shader [1] https://stackoverflow.com/questions/16106854/opengl-es-2-0-and-shaders [2] https://stackoverflow.com/questions/2713417/which-opengl-functions-are-not-gpu-accelerated [3] https://www.opengl.org/sdk/docs/man/html/glViewport.xhtml Entry: Vertex Attributes Date: Sat Feb 28 02:29:24 EST 2015 Let me see if I understand this. The vertex shader takes attributes and produces gl_Position ( Can it produce more attributes? ) Attributes are passed to the renderer by: glGenBuffers() // generate a buffer obect glBindBuffer(GL_ARRAY_BUFFER) // bind buffer to vertex attributes glBufferData() // copy data, set usage pattern[1] glDrawArrays() // draw the enabled arrays, interpreting as sequence of primitives [1] https://stackoverflow.com/questions/8281653/how-to-choose-between-gl-stream-draw-or-gl-dynamic-draw