Jump to content
  • Advertisement
Sign in to follow this  
greentiger

OpenGL I'm new to OpenGL

This topic is 2559 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm new to OpenGL in python.

I've manage to draw coordinates and put in a camera but the orientation seems off.

From what I've read it should be:

x +
|
/ - - - y +
/
z +

but it seems like it actually draws as

y +
|
/ - - - x +
/
z +

here's what I've got, maybe I've got it implemented backwards?


def gfxInit():
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) #clear the color and depth buffers
glLoadIdentity() #clear current (in this case, modelview) matrix to the identity matrix
gluLookAt(3,3,3, 0,0,0, 0,1,0) # at 3,3,3 looking at origin 0,0,0 with vector pointing up 0,1,0

def gfxShowCoords():
# Cartesian: draw X, Y, Z

glBegin(GL_LINES)

# draw positive X
glColor3f(1,0,0) # red
glVertex3f(0,0,0) # origin
glVertex3f(2,0,0)

# draw positive Y
glColor3f(0,1,0) # green
glVertex3f(0,0,0) # origin
glVertex3f(0,2,0)

# draw positive Z
glColor3f(0,0,1) # blue
glVertex3f(0,0,0) # origin
glVertex3f(0,0,2)

glEnd()




I also want to draw cube "tiles" that are 1 h x 1 w x 1/2 high -- these should be wireframe for now but later I want to make them texture mapped. Better to draw them as lines, quads or another method?

Thanks! Edited by greentiger

Share this post


Link to post
Share on other sites
Advertisement
X is right, z is in/out, y is up
Many newer cards don't support quads, so you'll need to use line strips or textures on solid cubes

Share this post


Link to post
Share on other sites

X is right, z is in/out, y is up
Many newer cards don't support quads, so you'll need to use line strips or textures on solid cubes


So no GL_QUAD_STRIP?
So how would I draw the above dimenions as a cube with the intention to texture it later?

Share this post


Link to post
Share on other sites
Just use triangles. You may be able to make a cube using a triangle strip, but I'm not sure if there's some order that would work.
gltranslatef(positionofcube)
glbegin(gl triangles)
glvertex3f for each point

If you need help with the actual points, I can post a better example, but I'm on my cell right now

Share this post


Link to post
Share on other sites

Just use triangles. You may be able to make a cube using a triangle strip, but I'm not sure if there's some order that would work.
gltranslatef(positionofcube)
glbegin(gl triangles)
glvertex3f for each point

If you need help with the actual points, I can post a better example, but I'm on my cell right now


after reading your post and googl'ing it's odd that they would trim some of the basic commands--but i guess it would help trim their bulkiness and i guess since quads are made of two triangles it doesn't matter i suppose. still -- odd ...

thanks for the heads up.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!