PDA

View Full Version : A simple Hexahedral



Normski
07-17-2000, 10:58 PM
I'm new to opengl. I try to take a simple cuboid sample, squash it and strectch so it appears on the bottom left hand side of the screen. This is a solid object. I'm having problems achieving this. Can somebody post me some simple drawing code, please. http://www.opengl.org/discussion_boards/ubb/redface.gif

phlake
07-18-2000, 06:30 AM
i'd recommend looking at NeHe's tutorials: http://nehe.gamedev.net/opengl.asp

Normski
07-18-2000, 07:46 AM
Manage to get the Vertices set up, is there any easier way to do this by hand?

Take the following code, this is a 'airport runway'
Are there any code generators or even anything to manke this easy or do you guys out do this by hand?

// CODE START
float nYPoint = -1.6;
float nYHeight = 0.12;

float nXPoint = -1.4;
float nWidth = 3.4;

float fDist = 0.3;

// glRotatef(m_nRotate+=2,0.0,1.0,0.0);
glBegin(GL_QUADS); // Draw A Quad

glColor3f(0.9f,0.9f,0.9f);
glVertex3f( nXPoint, nYHeight + nYPoint,-fDist);
glVertex3f(nWidth + nXPoint, nYHeight + nYPoint,-fDist);
glVertex3f(nWidth + nXPoint, nYHeight + nYPoint, fDist);
glVertex3f( nXPoint, nYHeight + nYPoint, fDist);

glColor3f(0.5f,0.5f,0.5f);
glVertex3f( nXPoint, nYPoint,-fDist);
glVertex3f(nWidth + nXPoint, nYPoint,-fDist);
glVertex3f(nWidth + nXPoint, nYPoint, fDist);
glVertex3f( nXPoint, nYPoint, fDist);

glVertex3f( nXPoint, nYPoint ,-fDist);
glVertex3f(nWidth + nXPoint,nYPoint,-fDist);
glVertex3f(nWidth + nXPoint, nYHeight + nYPoint,-fDist);
glVertex3f( nXPoint,nYHeight + nYPoint,-fDist);

glVertex3f( nXPoint, nYPoint, fDist);
glVertex3f( nXPoint, nYPoint,-fDist);
glVertex3f( nXPoint,nYHeight + nYPoint,-fDist);
glVertex3f( nXPoint, nYHeight + nYPoint, fDist);


glVertex3f( nWidth + nXPoint, nYPoint, fDist);
glVertex3f( nWidth + nXPoint, nYPoint,-fDist);
glVertex3f( nWidth + nXPoint,nYHeight + nYPoint,-fDist);
glVertex3f( nWidth + nXPoint, nYHeight + nYPoint, fDist);

glVertex3f( nXPoint, nYPoint ,fDist);
glVertex3f(nWidth + nXPoint,nYPoint,fDist);
glVertex3f(nWidth + nXPoint, nYHeight + nYPoint,fDist);
glVertex3f( nXPoint,nYHeight + nYPoint,fDist);
glEnd(); // Done Drawing The Quad
// CODE START

nexusone
07-21-2000, 07:51 AM
There is a program's out there that let you draw an object then export it to an opengl object. The output can be gl code of gl list code..
nehe.gamedev.net has a good program example of what I think you are looking for.


[QUOTE]Originally posted by Normski:
[B]Manage to get the Vertices set up, is there any easier way to do this by hand?

Take the following code, this is a 'airport runway'
Are there any code generators or even anything to manke this easy or do you guys out do this by hand?



[This message has been edited by nexusone (edited 07-21-2000).]