opengl icon indicating copy to clipboard operation
opengl copied to clipboard

How to create GLSL shader with thid OpenGL bindings?

Open ghost opened this issue 7 years ago • 2 comments
trafficstars

Program -just creating a variable for the vertex shader: require 'opengl' require 'glu' require 'glut'

$vertexShader = glCreateShader(GL_VERTEX_SHADER)

Result from Jetbrains Rubymine: C:\Ruby24-x64\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/Andrew/Desktop/task3.rb C:/Users/Andrew/Desktop/task3.rb:7:in <top (required)>': uninitialized constant GL_VERTEX_SHADER (NameError) from -e:1:inload' from -e:1:in `

'

Process finished with exit code 1

ghost avatar Apr 28 '18 13:04 ghost

1

ghost avatar Apr 28 '18 13:04 ghost

You must include the GL namespace or prefix the constants like: GL::GL_VERTEX_SHADER .

Apart from this, I recommend to use the ruby-opengl library for new projects. There is a shader example: https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/OrangeBook/brick.rb

larskanis avatar Apr 28 '18 14:04 larskanis