Ahh, that did it, thank you so much! I had written a much larger program based on a shader tutorial. I spent the last day and a half slowly paring down the program until I got to that stub. I copied all of it to C, saw that it worked, and finally had to ask someone...

Perhaps a very large note in the documentation would be good? 


On Wed, Feb 22, 2012 at 6:58 PM, Mike C. Fletcher <mcfletch@vrplumber.com> wrote:
On 12-02-22 07:47 PM, James Gao wrote:
> Hi everyone,
> I'm trying to get a very very simple pass-through shader to work in
> pyopengl. I compiled and tested a simple C program, available here:
> http://pastebin.com/FGVxUUXH
> This program works exactly as expected -- a red plane is drawn,
> completely covering the screen.
> I tried to make the *exact* duplicate of this C program here:
> http://pastebin.com/dYbbXTY1
> This apparently does not work. Only the gray glClear color is
> displayed, and the two triangles are never drawn.
> Any insight into why this isn't working?

You need to modify the calls which are using voidp offsets to explicitly
create GLvoidp instances, the integer 0 values are being interpreted as
single-value arrays and the result is a useless offset:

    glVertexAttribPointer( posidx, 2, GL_FLOAT, GL_FALSE, 4*2, GLvoidp(0))

    # Draw the two triangles
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebuf);
        GL_TRIANGLES,           # mode
        6,           # count
        GL_UNSIGNED_SHORT,      # type
        GLvoidp(0)                       # element array buffer offset

This is a mis-feature of the wrapping in PyOpenGL allowing you to pass
in an integer where an array is expected.


  Mike C. Fletcher
  Designer, VR Plumber, Coder

Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
PyOpenGL Homepage
PyOpenGL-Users mailing list