Re: [PyOpenGL-Users] glVertexAttribPointer Problem
Brought to you by:
mcfletch
From: Alejandro S. <as...@gm...> - 2011-01-30 19:27:40
|
Hello Thomas, On Jan 30, 2011, at 3:19 PM, Thomas <p_t...@gm...> wrote: > Hello, > > I'm trying to use glVertexAttribPointer and interleaved vertex data. > > // simple coordinate cross: vertex0, color0, ... > data = [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, # x0 > 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, # x1 > 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, # y0 > 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, # y1 > 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, # z0 > 0.0, 0.0, 1.0, 0.0, 0.0, 1.0] # z1 > > buffer = glGenBuffers(1) > glBindBuffer(GL_ARRAY_BUFFER, buffer) > glBufferData(GL_ARRAY_BUFFER, numpy.array(cross, numpy.float32), > GL_STATIC_DRAW) > > # attributes are queried by glGetAttribLocation after shaders are linked > glVertexAttribPointer(attributes['coord'], GLint(3), GL_FLOAT, GL_FALSE, > GLsizei(6 * 4), ctypes.c_void_p(0)) > glVertexAttribPointer(attributes['color'], GLint(3), GL_FLOAT, GL_FALSE, > GLsizei(6 * 4), ctypes.c_void_p(3)) I'm not 100% sure, but shouldn't this last call to c_void_p receive 3*4 instead of 3? Please check whether a byte offset is expected here by OpenGL. Good luck, Alejandro.- > > for index in attributes.values(): > glEnableVertexAttribArray(index) > > In my vertex shader I have: > attribute vec3 coord; > attribute vec3 color; > > Vertex data is correct, but "vec3 color" is always (0.0, 0.0, 0.0) > > Is it a problem with pyopengl or did I miss something in my setup? > > -Thomas > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |