Hi,
I have written a small library using cl-opengl to do skeletal animation which works great. I use vertex arrays in the process. As outlined in opengl-array.lisp under examples, I have a gl array of vertices.
To the vertex object in the gl array I added texture coordinates: (gl:tex-coord :type float :components (u v))
In my code, (just like enable vertex and color array); I enable tex coord array
; all texture loading code and creating gl vertices/indices code
(gl:enable-client-state :texture-coord-array) ....... (gl:bind-gl-vertex-array gl-vertices) (gl:draw-elements :triangles gl-indices) ........ (gl:enable-client-state :texture-coord-array)
However it leads to a memory segment address error.
If I go the primitive route, rendering the triangle vertices and texture coordinates, things work fine.
Obviously, as for texture coordinates with draw elements; I am missing something. I tried looking up into the source/examples but could not find. [PS: i am no C expert, so am stuck here]
Any help appreciated,
Let me know in case of any questions, Thanks and Regards, Deepak
Hello Deepak,
On Fri, Mar 30, 2012 at 9:51 AM, Deepak Surti dmsurti@gmail.com wrote:
However it leads to a memory segment address error.
Did you manage to figure out a solution to your problem?
Cheers,
Hi Louis,
With some more opengl experience under the hood, I think this could be a problem: (I have not tried it though):
This was my array definition:
;for textures (gl:define-gl-array-format mesh-tvertex (gl:vertex :type :float :components (x y z)) (gl:tex-coord :type :float :components (u v)))
I think I should keep a separate array for vertices and textures. Then things should work out fine. Is this correct? This is what I currently do when using Lispworks with its opengl ffi library.
I will try keep a separate textures array and let you know how it goes. Thanks, Deepak
On Wed, May 16, 2012 at 5:13 AM, Luís Oliveira luismbo@gmail.com wrote:
Hello Deepak,
On Fri, Mar 30, 2012 at 9:51 AM, Deepak Surti dmsurti@gmail.com wrote:
However it leads to a memory segment address error.
Did you manage to figure out a solution to your problem?
Cheers,
-- Luís Oliveira http://r42.eu/~luis/
cl-opengl-devel@common-lisp.net