View Full Version : 3D

08-05-2009, 10:54 AM
I am a beginner to openGL. I am trying to draw 3 dimension coordinates in x,y and x. Whenever I draw lines using vertices, i.e. glVertex3f(0.,1.,0.), etc. I only get output in x and y, no z. I tried changing the glBindTexture(GL_TEXTURE_2D, etc) to GL_TEXTURE_3D and I get an "undeclared Identifier" error. I am wondering the following:
1.) would this be the correct place to change from 2D to 3D?

2.) is the 3D variable a new addition in the "glext.h" include file and do I need to download and add?

Please let me know, Sid Kraft

08-05-2009, 12:21 PM
n x,y and x. You mean x, y and z ? :D

1)I don't know what TEXTURE_3D means, but you can also draw in 3D with TEXTURE_2D.

I think it's easyer for you if you use an engine first.
You must create your models in a 3D Programm (for Example Blender), then you export it and load it with OpenGl


08-05-2009, 01:17 PM
Usually, a texture is two dimensional. It is an image, that has both height and width. You can, though, specify a three-dimensional texture. It essentially consists of a stack of images. That constant should be defined in gl.h. If you are on Windows, then you may have some really old headers & libraries. I don't use Windows, so I can't tell you where to get them, but that may be the problem.

There are different types of coordinates that you can pass to OpenGL. There are the vertex coordinates, specified by glVertex(). These specify the location of the geometry in space. There are also texture coordinates. A texture coordinate is associated with a vertex coordinate. The texture coordinate tells what part of the texture should be put on that vertex.

It's not clear to me that you understand the process here. Check out one of the online redbooks (http://www.opengl.org/documentation/red_book/). They're old, but they cover the fundamentals well.

08-05-2009, 04:57 PM
I hope I understand your problem correctly.
Do you mean you are not able to view your 3D point? i.e you draw point at (10,10, 30) but you are not able to perceive depth ???

Check following:
1. While initializing, is GL_DEPTH flag enabled?
2. While setting up viewport did you use glOrtho() [3D version]
3. Where is your camera placed?

By mentioning texture, do you want to map texel to a vertex ??