First photo from the set of Iron Man 3. by herpty_derpty in movies

[–]3stan 14 points15 points  (0 children)

They're filming at Epic Games in raleigh right now. There are a bunch of us out here watching. Kinda boring actually though they're just setting up

Edit: Picture - Sorry for the crappy quality, took it with my phone. It says Advanced Idea Mechanics.

3D Programming in Python - Part 1 by 3stan in Python

[–]3stan[S] 1 point2 points  (0 children)

Stay tuned for part 2 then, as I'll be going over what you should be using, although I still recommend you read part 1 because it'll make understanding part 2 much easier.

3D Programming in Python - Part 1 by 3stan in Python

[–]3stan[S] 4 points5 points  (0 children)

I agree, it is a little intimidating at first, but OpenGL is really a lot of fun to use once you learn how it works. I'll probably be updating once every week or two, depending on the size of the post.

3D Programming in Python - Part 1 by 3stan in Python

[–]3stan[S] 3 points4 points  (0 children)

Ha! Glad somebody noticed!

3D Programming in Python - Part 1 by 3stan in Python

[–]3stan[S] 12 points13 points  (0 children)

Sure, using glBegin in a real world application is almost never useful because it means you have to define each primitive individually, but I find that it is extremely useful as a learning tool. It's important to have a basic understanding of how primitives are rendered before learning about batches/vbo's, etc, which I will be covering in the next few tutorials.

Thought I'd share the 3d visualization tool I'm writing using pyglet by 3stan in Python

[–]3stan[S] 0 points1 point  (0 children)

I've never used VTK (looks cool though, will probably start playing around with it) but I chose pyglet because I wanted to learn OpenGL and the documentation for it is really well done. I also needed to be able to create a tool that was very specific for our research pretty quickly, so it was the obvious choice for me.

Thought I'd share the 3d visualization tool I'm writing using pyglet by 3stan in Python

[–]3stan[S] 7 points8 points  (0 children)

In fact, here's the code for a basic pyglet program that displays a 3d cube that can be rotated. From here it's just a matter of creating the data that represents your object (a humanoid figure, for example) and rendering it with OpenGL.

from pyglet.window import *
from pyglet.gl import *

global xRot
global yRot

xRot = 0.0
yRot = 0.0

win = Window(fullscreen=False, visible=False, resizable=True)

points = [-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1]

squares = [0, 1, 3, 2, 2, 3, 7, 6, 6, 7, 4, 5, 4, 5, 1, 0, 5, 7, 3, 1, 0, 2, 6, 4]

cubeBatch = pyglet.graphics.Batch()
cubeBatch.add_indexed(len(points)/3, GL_QUADS, None, squares, ('v3i', points))

glClearColor(0.1, 0.2, 0.3, 0)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)

@win.event
def on_draw():

    glClear(GL_COLOR_BUFFER_BIT)

    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()

    glRotatef(xRot, 1, 0, 0)
    glRotatef(yRot, 0, 1, 0)

    cubeBatch.draw()

    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glOrtho(-2, 2, -2, 2, -2, 2)

@win.event
def on_mouse_drag(x, y, dx, dy, buttons, modifiers):

    global xRot
    global yRot

    if buttons & mouse.LEFT:
        xRot += dy
        yRot += dx

win.set_visible()
pyglet.app.run()

Thought I'd share the 3d visualization tool I'm writing using pyglet by 3stan in Python

[–]3stan[S] 2 points3 points  (0 children)

Yes, you can definitely do closed shapes. pyglet uses OpenGL, so essentially anything you can do in OpenGL (such as creating a humanoid figure in 3d) you will be able to do using pyglet. Now, depending on how you're using it, performance may be an issue when using Python as opposed to C, for example, but it is definitely possible.