[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] getting setup to use PyOpenGL for 2D



------ Original Message ------
> On Mon, Nov 28, 2005 at 01:53:25PM -0500, Matt Bailey wrote:
> What resources would you recommend for learning how to work with OpenGL?  
> Everything I've seen so far I've really had a hard time wrapping my brain 
> around, and I'd like to think I'm a fair to middlin' programmer and I'm 
> certainly not a math-o-phobe (though my linear algebra is a mite bit 
> rusty).  I've tried to teach myself OpenGL and each time I only feel like 
> I half get it.  I just haven't had any "aha!" moments with it yet.
> 
I learned to use it in C++ from source code, using reference docs with web
searches for questions I had... (I never had an aha moment BTW, just a serious
of progressively smaller and less frequent struggles). looks like PyOpenGL
website has some good links:
http://pyopengl.sourceforge.net/documentation/index.html

the MSDN openGL stuff in particular is what I used:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/openglstart_9uw5.asp

My opinion is that when thinking of it as being designed for 3D in particular
(which it is) it pretty much makes sense... The only possibly weird part is
the way things tend to be on a kind of on a stack (push matrix transforms,
push render settings, push vertexes, now render them...) So you have to
remember and manage state a bit, but DirectX can be like that too. So I guess
what I'm saying is it's not really any harder or different than understanding
any 3d api...

Learning to use it for 2d, takes a whole nother set of work on top of that,
and that was mostly sample source code to learn that for me. The one part in
particular that I don't find hard to understand, but very annoying to have to
deal with is texture management (not really specific to 2d though), since most
OpenGL implementations only support certain sizes of power of 2 textures (i.e.
1024x1024), you've got to pack all your 2d images into some larger gl buffer,
then to draw them you make the texture coords of your quads mapped into the
right offsets in the gl buffer... It basically just sucks - in 3d it can be
easier because the artists tools can do the texture packing for them for a
specific model, but for 2d packing textures isn't a normal part of art
production... I'm just now getting into writing Python code to hide all this
ugly detail from me, and it seems harder to grasp and do than it seems like it
should be...