set_attribute   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm

Implementation

;; where size is number of components for vertex
(bind-func set_attribute
  (lambda (vao:VAO* vbo:VBO* type index size stride:GLsizei offset instance_attr:i1)
    ;; (if (not (aref (attribs vao) index))
    (begin
      (glBindVertexArray (id vao))
      (gl_print_error "Error binding VAO")
      (glBindBuffer GL_ARRAY_BUFFER (id vbo))
;      (println 'vbo vbo)
      (gl_print_error "Error binding VBO")
      (let ((component_size 4)) ;; four for GL_FLOAT and GL_INT
        (if (= size 16) ;; i.e. if a mat4
            (begin ;; this is a pain but matrix is simply 4 * vec4
              (glEnableVertexAttribArray (+ index 0)) ;; i dn't know if i need these enables
              (glVertexAttribPointer (+ index 0) 4 type GL_FALSE (* stride component_size)
                                     (pref-ptr (cast null GLvoid*) (* component_size (+ offset 0))))
              (glEnableVertexAttribArray (+ index 1))
              (glVertexAttribPointer (+ index 1) 4 type GL_FALSE (* stride component_size)
                                     (pref-ptr (cast null GLvoid*) (* component_size (+ offset 4))))
              (glEnableVertexAttribArray (+ index 2))
              (glVertexAttribPointer (+ index 2) 4 type GL_FALSE (* stride component_size)
                                     (pref-ptr (cast null GLvoid*) (* component_size (+ offset 8))))
              (glEnableVertexAttribArray (+ index 3))
              (glVertexAttribPointer (+ index 3) 4 type GL_FALSE (* stride component_size)
                                     (pref-ptr (cast null GLvoid*) (* component_size (+ offset 12)))))
            (begin
              (glEnableVertexAttribArray index)
              (glVertexAttribPointer index
                                     size
                                     type ;;(type vbo)
                                     GL_FALSE
                                     (* component_size stride)
                                     (pref-ptr (cast null GLvoid*) (* component_size offset))))))
      (gl_print_error "Error binding VAO attribute")
      (if (= size 16)
          (begin
            (aset! (attribs vao) (+ index 0) #t)
            (aset! (attribs vao) (+ index 1) #t)
            (aset! (attribs vao) (+ index 2) #t)
            (aset! (attribs vao) (+ index 3) #t)))
      (if (<> size 16)
          (aset! (attribs vao) index #t))
      (aset! (buffers vao) index vbo)
      (glBindBuffer GL_ARRAY_BUFFER 0)
      (if (and instance_attr (<> size 16))
          (begin (glVertexAttribDivisor index 1)
                 (gl_print_error "Error setting VAO attribute divisor")))
      (if (and instance_attr (= size 16))
          (begin (glVertexAttribDivisor (+ index 0) 1)
                 (glVertexAttribDivisor (+ index 1) 1)
                 (glVertexAttribDivisor (+ index 2) 1)
                 (glVertexAttribDivisor (+ index 3) 1)
                 (gl_print_error "Error setting VAO attribute divisor")))
      (glBindVertexArray 0))
    void))


Back to Index

Similar Entries

  • *midioffset*    scheme
  • AudioBuffer_set_data_b64    xtlang
  • CefColorSetARGB    xtlang
  • GSL_SET_COMPLEX    xtlang
  • GSL_SET_IMAG    xtlang
  • GSL_SET_REAL    xtlang
  • GUI_set_root    xtlang
  • VAO_bind_attribute    xtlang
  • VAO_bind_attribute    xtlang
  • Vset    xtlang
  • Vsetall    xtlang
  • Widget_set_cb    xtlang
  • Widget_set_left_child    xtlang
  • Widget_set_parent    xtlang
  • Widget_set_right_child    xtlang
  • Widget_set_split    xtlang
  • Widget_set_type    xtlang
  • _dsp:set!    scheme
  • analogue-load-preset    scheme
  • analogue-reset    scheme
  • analogue-save-preset    scheme
  • analogue_reset    xtlang
  • analogue_set_mod_matrix    xtlang
  • arrows_set_head_vert    xtlang
  • attrib_set_p    xtlang
  • cef_string_set    xtlang
  • cell_set_value    xtlang
  • cerberus-load-preset    scheme
  • cerberus-reset    scheme
  • cerberus-save-preset    scheme
  • cerberus_get_noisetype    xtlang
  • cerberus_reset    xtlang
  • cerberus_reset_lfos    xtlang
  • cerberus_set_mod_matrix    xtlang
  • cl:set-difference    scheme
  • cl:subset?    scheme
  • clock-set-bpm    scheme
  • clock-set-cycle    scheme
  • clock:offset-from-server    scheme
  • curl_setopts_authenticate    xtlang
  • curl_setopts_basic    xtlang
  • curl_setopts_header    xtlang
  • curl_setup    xtlang
  • dict_set    xtlang
  • dsp:set!    macro
  • fleet_set_unit_state    xtlang
  • fleet_set_unit_state    xtlang
  • fluid-cube-set-column    xtlang
  • fluid-cube-set-first-column    xtlang
  • fluid-cube-set-first-row    xtlang
  • fluid-cube-set-last-column    xtlang
  • fluid-cube-set-last-row    xtlang
  • fluid-cube-set-row    xtlang
  • fluid-set-boundary    xtlang
  • fluid-set-boundary    xtlang
  • fluid-set-boundary    xtlang
  • fluid_set_boundary    xtlang
  • get_noisetype    xtlang
  • ghttp_perform_request_with_setup_fn    xtlang
  • ghttp_set_content_type_html    xtlang
  • ghttp_set_content_type_json    xtlang
  • ghttp_set_content_type_octet_stream    xtlang
  • ghttp_set_content_type_plaintext    xtlang
  • ghttp_set_extempore_user_agent    xtlang
  • gl_set_proc_address    xtlang
  • gl_set_view    xtlang
  • gl_setup    xtlang
  • glfw_set_compatibility_profile    xtlang
  • glfw_set_core_profile    xtlang
  • godot_color_set_r    xtlang
  • godot_vector2_set_x    xtlang
  • godot_vector2_set_y    xtlang
  • gui_reset    xtlang
  • gui_set_default_theme    xtlang
  • gui_set_monokai_color_theme    xtlang
  • gui_set_monokai_opensans_theme    xtlang
  • icr:set-zone    scheme
  • icr:set-zone-default    scheme
  • impc:compiler:reset-jit-compilation-queue    scheme
  • impc:ir:compiler:array-set    scheme
  • impc:ir:compiler:closure-set    scheme
  • impc:ir:compiler:closure-set    scheme
  • impc:ir:compiler:pointer-set    scheme
  • impc:ir:compiler:set!    scheme
  • impc:ir:compiler:tuple-set    scheme
  • impc:ir:compiler:vector-set    scheme
  • impc:ir:genericfunc-type-setup    scheme
  • impc:ti:array-set-check    scheme
  • impc:ti:closure-set-check    scheme
  • impc:ti:multicset    scheme
  • impc:ti:pointer-set-check    scheme
  • impc:ti:reset-builtin-cache    scheme
  • impc:ti:reset-closure-cache    scheme
  • impc:ti:reset-genericfunc-cache    scheme
  • impc:ti:reset-generictype-cache    scheme
  • impc:ti:reset-globalvar-cache    scheme
  • impc:ti:reset-namedtype-cache    scheme
  • impc:ti:reset-nativefunc-cache    scheme
  • impc:ti:reset-polyfunc-cache    scheme
  • impc:ti:reset-polytype-cache    scheme
  • impc:ti:reset-typealias-cache    scheme
  • impc:ti:reset-xtmacro-cache    scheme
  • impc:ti:reverse-set-bangs-from-reified    scheme
  • impc:ti:set-builtin-args    scheme
  • impc:ti:set-builtin-docstring    scheme
  • impc:ti:set-builtin-type-str    scheme
  • impc:ti:set-check    scheme
  • impc:ti:set-closure-body    scheme
  • impc:ti:set-closure-docstring    scheme
  • impc:ti:set-closure-type    scheme
  • impc:ti:set-closure-zone-size    scheme
  • impc:ti:set-globalvar-docstring    scheme
  • impc:ti:set-namedtype-docstring    scheme
  • impc:ti:set-nativefunc-arg-names    scheme
  • impc:ti:set-nativefunc-docstring    scheme
  • impc:ti:set-nativefunc-type    scheme
  • impc:ti:set-typealias-docstring    scheme
  • impc:ti:set-xtmacro-docstring    scheme
  • impc:ti:tuple-set-check    scheme
  • impc:ti:vector-set-check    scheme
  • ipc:set-local-remote-mapping    scheme
  • llvm:get-closure-setter    scheme
  • nnsock_set_recv_timeout    xtlang
  • nnsock_set_send_timeout    xtlang
  • nnsock_set_timeout    xtlang
  • ocv_set    xtlang
  • offset_momentum    xtlang
  • psystem-set-particle    xtlang
  • psystem-set-particle    xtlang
  • reset-zone    xtlang
  • reset_view_matrix    xtlang
  • reset_zone    xtlang
  • sampler-set-slot-offset    scheme
  • set-chord    scheme
  • set-data-arrays-lines    xtlang
  • set-data-arrays-points    xtlang
  • set-data-particles    xtlang
  • set-mouse-pos    xtlang
  • set-offset-x    xtlang
  • set-offset-y    xtlang
  • set-scale-x    xtlang
  • set-scale-y    xtlang
  • set-signal!    macro
  • set_amp_env    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_beta    xtlang
  • set_bg    xtlang
  • set_cairo_source_with_colour    xtlang
  • set_car    xtlang
  • set_cdr    xtlang
  • set_delay    xtlang
  • set_dl_core    xtlang
  • set_dl_envs    xtlang
  • set_dl_filter    xtlang
  • set_dl_fm    xtlang
  • set_dl_main    xtlang
  • set_dl_osc    xtlang
  • set_filter    xtlang
  • set_filter_env    xtlang
  • set_flanger    xtlang
  • set_float_nans_    xtlang
  • set_instance_matrices    xtlang
  • set_lfo1    scheme
  • set_lfo1_type    scheme
  • set_lfo2    scheme
  • set_lfo2_type    scheme
  • set_lfo3    scheme
  • set_lfo3_type    scheme
  • set_lfo4    scheme
  • set_lfo4_type    scheme
  • set_midi_in    xtlang
  • set_midi_out    xtlang
  • set_mod_matrix    xtlang
  • set_monophonic    xtlang
  • set_noise_amp    xtlang
  • set_noise_type    xtlang
  • set_osc    xtlang
  • set_peq_hmid    xtlang
  • set_peq_hmid    xtlang
  • set_peq_hshelf    xtlang
  • set_peq_hshelf    xtlang
  • set_peq_lmid    xtlang
  • set_peq_lmid    xtlang
  • set_peq_lshelf    xtlang
  • set_peq_lshelf    xtlang
  • set_pitch_env    xtlang
  • set_polyphonic    xtlang
  • set_polyphony    xtlang
  • set_range    xtlang
  • set_reverb    xtlang
  • set_sample_data_    xtlang
  • set_sample_offset_    xtlang
  • set_sampler_audiobuffer    xtlang
  • set_slide    xtlang
  • set_slide_texture    xtlang
  • set_speed    xtlang
  • set_trigger    xtlang
  • set_up_reply_socket    xtlang
  • set_up_request_socket    xtlang
  • set_up_sockets    xtlang
  • set_width_and_height    xtlang
  • set_window_wndproc    xtlang
  • sf_set_channels    xtlang
  • sf_set_format    xtlang
  • sf_set_frames    xtlang
  • sf_set_samplerate    xtlang
  • sf_set_sections    xtlang
  • sf_set_seekable    xtlang
  • shader_set_grid_offsets    xtlang
  • shader_setup_convolution_filter    xtlang
  • sys_env_set    xtlang
  • texture_setup    xtlang
  • unset_attribute    xtlang
  • world_reset    xtlang
  • world_set_generation    xtlang
  • world_set_to_checkerboard    xtlang
  • world_set_to_inverse    xtlang
  • world_texture_setup    xtlang
  • xtm-setup-and-start-gl-loop    scheme
  • xtm_paint_set_color    xtlang
  • xtm_paint_set_fill    xtlang
  • xtm_paint_set_pattern    xtlang
  • xtm_paint_set_stroke    xtlang
  • xtm_set_color32    xtlang
  • xtm_set_color32_alpha    xtlang
  • xtm_set_color32_blue    xtlang
  • xtm_set_color32_green    xtlang
  • xtm_set_color32_red    xtlang
  • xtm_set_vgimage_subdata    xtlang
  • xtm_vg_reset_matrices    xtlang
  • xtmtest-reset-results    scheme
  • xtmtest-reset-results    scheme