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 Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-09-2010, 10:08 AM   #1 (permalink)
Registered Member
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 173
Default Can't work with OpenGL and landscape...

Hi there!

After sending my first game to Apple (in review at this time!) it's time to begin with the second one! For this one I need to set OpenGL ES in landscape mode. I've started doing some game tests in a project in portrait mode but when I try to port this to landscape nothing work as it used to...
I know how to set landscape mode in the .plist file and also how to set OpenGL to draw in landscape mode:

Code:
glOrthof( -rect.size.width / 2, rect.size.width / 2, -rect.size.height / 2, rect.size.height / 2, -1, 1 );

(...)

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(160.0f, 240.0f, 0.0f );
glRotatef(-90.0, 0.0, 0.0, 1.0);
glScalef(1.0, -1.0, 1.0);
Objects are now drawn in landscape mode as it was expected, but nothing's changed with this, so there's no axis inversion and objects didn't even seem to be where they're drawn (so for touching an object I must touch the screen zone where it used to be in portrait mode)... Is there any way of setting OpenGL in a landscape context and setting all with this (so no need to turn head to image how axis are going or where the object is, instead it's printed in other point? I'm getting quite mad with this... U_U'

Thanks in advance!

Last edited by Johanovski; 02-09-2010 at 10:14 AM.
Johanovski is offline   Reply With Quote
Old 02-10-2010, 03:11 AM   #2 (permalink)
Registered Member
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 173
Default

Anyone has anything to say about this? I'm really getting mad with inverted axis, x than became y, y that have it's starting point where it's supposed to be 480, OpenGL and touches processing x and y inverted, ...
Johanovski is offline   Reply With Quote
Old 02-10-2010, 05:55 AM   #3 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 288
Default

Create a class to remap your co-ordinate systems, and just convert as needed. You could role it into your co-ordinate class as well, and have explicit accessors.
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Reply

Bookmarks

Tags
axis, landscape, opengl es, portrait

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,320
Threads: 39,117
Posts: 171,512
Top Poster: smasher (2,576)
Welcome to our newest member, xX Holllish Xx
Powered by vBadvanced CMPS v3.1.0

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