Re: Problems with simple pyopengl program

James Gao <[email protected]>
Newsgroups gmane.comp.python.opengl.user
Message-ID <CAH6daNyVf9xtNqz9JQq872vW0qWzw+w-Yaq+0ad2LKS1mph2Lw@mail.gmail.com>
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?

-James

On Wed, Feb 22, 2012 at 6:58 PM, Mike C. Fletcher <[email protected]>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);
>     glDrawElements(
>         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.
>
> HTH,
> Mike
>
> --
> ________________________________________________
>   Mike C. Fletcher
>   Designer, VR Plumber, Coder
>   http://www.vrplumber.com
>   http://blog.vrplumber.com
>
>
>
> ------------------------------------------------------------------------------
> 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.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> PyOpenGL Homepage
> http://pyopengl.sourceforge.net
> _______________________________________________
> PyOpenGL-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyopengl-users
>

------------------------------------------------------------------------------
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.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
_______________________________________________
PyOpenGL-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyopengl-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.