Re: Simple Test Program issues

Alejandro Segovia <[email protected]>
Newsgroups gmane.comp.python.opengl.user
Message-ID <CAAXrc9PXDaFvun01Dq_LtSBFEHmKLNH9P03CwMjQfEStvt_5dA@mail.gmail.com>
Hello Gerald,

2012/4/28 Gerald Escobar <[email protected]>

> Hello,
>
> I'm trying to learn to use pyopengl in a more modern context (not relying
> on fixed function/deprecated functionality INCLUDING built-in vertex shader
> attributes)
>
> Here is my source:
> http://pastebin.com/fd7KQthA
>
> When I run the program I simply get a black screen instead of a white
> triangle.
>
> I'm not entirely sure what I am doing wrong however there I encountered
> quite a few problems whilst writing this code snippet
> 1) When trying to bind the buffer to an attribute I kept getting some sort
> of type error. So instead I resorted to passing the matrix straight
> 2) I'm not entirely sure about whether I'm multiplying the matricies
> correctly.
>
> I apologize if this question seems very broad,
>

About 1), it's hard to be able to tell without seeing the error message and
what line actually generates it.

Regarding 2), this is for the most part a numpy thing, which I think seems
correct :)

Other than that, I see a couple of potential problems in your code. You are
using an Identity as the projection matrix, yet you seem to supply your
triangle coordinates in pixels. This is a semantics issue. When using an
Identity as the projection matrix, you are asking OpenGL to render using
device normalized coordinates. These span from [-1,-1] to [1,1], where
these points (-1,-1) denote the lower-left corner of the screen and (1,1)
the top-right corner. If you want to use pixels, you should create an
Orthogonal projection matrix with left and bottom zero and right and top
width and height (in pixels) respectively.

Also, OpenGL matrices are column-major. Make sure you transpose your
matrices when supplying them to your shader.

Hope this helps,
Alejandro.-




>
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> PyOpenGL Homepage
> http://pyopengl.sourceforge.net
> _______________________________________________
> PyOpenGL-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyopengl-users
>
>


-- 
http://alejandrosegovia.net

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
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.