Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-02-2010, 07:36 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 47
Default Zoom on 3D Objects

Hi!
I've been following these tutorials, and I was wondering if it was possible to modify this tutorial to allow for zooming:

iPhone Development: OpenGL ES From the Ground Up, Part 3: Viewports in Perspective

I just want to zoom in and out using a slider.

I'm thinking by modifying this piece of code:
Code:
CGRect rect = view.bounds; 
GLfloat size = .01 * tanf(DEGREES_TO_RADIANS(45.0) / 2.0); 

glFrustumf(-size,                                           // Left
            size,                                           // Right
           -size / (rect.size.width / rect.size.height),    // Bottom
            size / (rect.size.width / rect.size.height),    // Top
            .01,                                          // Near
            1000.0);                                          // Far
I should be able to achieve what I want. But I need some guidance!

Thanks for your time!
CasualDays is offline   Reply With Quote
Old 02-02-2010, 09:59 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,575
Default

This FAQ recommends multiplying everything except near and far by your zoom factor:

OpenGL FAQ / 8 Viewing and Camera Transforms, and Using gluLookAt()
__________________
smasher is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,296
Threads: 39,092
Posts: 171,394
Top Poster: smasher (2,575)
Welcome to our newest member, Issue
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:08 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0