Frustum and texture mapping

Hi everyone. I have two (hopefully quick) questions:

  1. I am simply trying to use glFrustum for a graphics program. However, no matter
    what I do, when I use it instead of glOrtho, nothing will come up on the screen.
    Could someone tell me exactly where it needs to go (display, init, main, etc.) and what I need to do to make it work?

And…

  1. Is there a simple way to texture map a small rectangular picture onto a rectangle? I’m trying to use a small picture to make a TV look like there is a video game on it, and while my books describe texture mapping, it seems to be way too complicated for something simple like this. It is a jpeg, but I could convert it to anything else through a graphics program I have.

Just FYI, I’m using OpenGL with MSVC++.

Thanks so much to anyone who helps.

glFrustum()? Na, don’t use that. Use the glu function gluPerspective(90,w/h,1,50) The 90 is an angle in degrees. It the angle stuff you can see in front of you, but I can’t remember the real name for it. w/h is width/height and that’s the aspect ration. 1 is the near clipping plane and 50 is the far clipping plane. My reshape function, that is when the window is resized, looks like this…

void reshape(int w, int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90,w/(float)h,1,50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,10,0,0,0,0,1,0);
}

gluLookAt(x1,y1,z1,x2,y2,z2,0,1,0);
x1,y1,z1 is the position of the eye.
x2,y2,z2 is the position the eye is looking at.
0,1,0 says that the y axis is up.

gluPerspective( FOV ,w/h,1,50)

Originally posted by reubenhawkins:
[b]glFrustum()? Na, don’t use that. Use the glu function gluPerspective(90,w/h,1,50) The 90 is an angle in degrees. It the angle stuff you can see in front of you, but I can’t remember the real name for it. w/h is width/height and that’s the aspect ration. 1 is the near clipping plane and 50 is the far clipping plane. My reshape function, that is when the window is resized, looks like this…

void reshape(int w, int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90,w/(float)h,1,50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,10,0,0,0,0,1,0);
}

gluLookAt(x1,y1,z1,x2,y2,z2,0,1,0);
x1,y1,z1 is the position of the eye.
x2,y2,z2 is the position the eye is looking at.
0,1,0 says that the y axis is up.[/b]

i) The gluPerspective or glFrustum should go right before your rendering, after glMatrixMode( GL_PROJECTION ).

ii) There is no quick way to do a texture map. All the parameters setup is quite necessary. I suggest you follow the book. Or if you want a fater way, d/l some tutorial and rip the texture mapping part out. Just make sure you know what are you ripping off.