Haskell opengl attrib is not active -


i trying render data vertex buffer object. little using glutil , raw. when program runs stuck in infinite loop , errors see down below.

vertex shader

#version 150 core  in vec4 position;  void main (void) {     gl_position = position;  } 

fragment shader

#version 150 core  out vec4 color;  void main (void) {     color = vec4(0.0, 0.8, 1.0, 1.0); } 

i have tried using 430 didn't work. tried using 150 saw lot people using it. furthermore have tried using layout while using raw didn't work.

instance of use

mesh :: [glfloat] mesh = [ 0.25, -0.25, 0.5        ,-0.25, -0.25, 0.5        , 0.25,  0.25, 0.5]  premainloop :: g.window -> io () premainloop window =     p <- loadshaderprogram [ ( vertexshader,   "frag.fs")                            , ( fragmentshader, "vert.vs")]     myvbo <- makebuffer arraybuffer mesh     vao <- makevao $ let vad = vertexarraydescriptor 3 float stride offset0"                      in                          printerrormsg "something else"                          currentprogram $= (program p)                          printerrormsg "program"                          bindbuffer arraybuffer $= myvbo                          printerrormsg "buffer"                          enableattrib p "position"                          printerrormsg "attriblocation"                          setattrib p "position" tofloat vad                          bindbuffer arraybuffer $= nothing     mainloop window vao p 

errors

program warning: attrib position not active   gl: error invalidoperation "invalid operation" 

so tried testing code opengl raw , caused yield desired results.

loc <- withcstring "position" $ \pos -> glgetattriblocation p pos bindbuffer arraybuffer $= buffer glenablevertexattribarray (fromintegral loc) glvertexattribpointer (fromintegral loc) 3 gl_float (fromintegral gl_false) 8 nl 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -