OpenGL "Coordinates"

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

OpenGL "Coordinates"

Postby Quipeace » Tue Mar 09, 2010 7:03 pm

Hey all,

I've been developing for android for a couple of weeks now, creating some simple apps using menus and buttons etc. That is getting quite boring without any inspiration, so I thought I'd give OpenGL a go.

The plan is to create a digital version of a quite entertaining game we play at school when there's nothing else to do, the goal is to capture as many squares. Just click the link below to see what I mean.
http://blogsimages.skynet.be/images_v2/ ... 074dd8.gif

I've managed to render a couple of cubes that I will eventually use to create a grid, I chose cubes as I thought I'd be able to create some nice effects with them. A game field would consist of 100 cubes to form a grid.

The problem is the coordinate system, I developed for the NDS (in C). There I would simply put a cube at (0, 0) and another one at (5, 0) etc. (0, 0) being the top left of the screen.

It's probably my logic, but I can't figure it out. Please point me in the right direction :D

Quipeace
Quipeace
Developer
Developer
 
Posts: 27
Joined: Tue Feb 23, 2010 4:00 pm

Top

Postby pmws » Tue Mar 09, 2010 7:15 pm

Unless you want to implement some 3d animations, I would recommend using android 2d graphics - painting on a canvas - for your game (create some "fake" 3d effect if you want)

For the following reasons :
- you dont need the speed of openGL
- its way easier to code
- you will probably get into troubles with picking. (i assume you want the border pieces to be clickable)

On a 2d canvas your 0,0 coordinates will be your top left corner.

As far as openGl is concerned the coords will depend on where you place the camera. In most examples and tutorials 0,0 will be the center of the screen.

just my 2 cents

Paul
pmws
Developer
Developer
 
Posts: 37
Joined: Thu Sep 24, 2009 12:23 pm

Postby Quipeace » Tue Mar 09, 2010 7:24 pm

Yeah, I suppose 2d would work well, if not better. Just thought it would be a good project to get started with 3d programming :).

I'll look into 2d first, see if I can figure that out first. I can always come back later.

Thanks :D

EDIT: NVM
Last edited by Quipeace on Wed Mar 10, 2010 6:34 pm, edited 1 time in total.
Quipeace
Developer
Developer
 
Posts: 27
Joined: Tue Feb 23, 2010 4:00 pm

Postby Quipeace » Wed Mar 10, 2010 6:19 pm

Replied instead of edit... Sorry
Quipeace
Developer
Developer
 
Posts: 27
Joined: Tue Feb 23, 2010 4:00 pm

Postby Skywhy » Sat Mar 20, 2010 3:02 pm

2D OpenGL, Match screen coordinates to world coordinates:

http://www.anddev.org/opengl_2d_match_o ... t8840.html
Skywhy
Developer
Developer
 
Posts: 35
Joined: Tue Oct 20, 2009 7:55 pm

Postby Quipeace » Sat Mar 20, 2010 3:32 pm

That was what I was looking for, I'm too busy with school to actively develop at the moment, but it will certainly come in handy later.

Thanks :D
Quipeace
Developer
Developer
 
Posts: 27
Joined: Tue Feb 23, 2010 4:00 pm

Top

Postby Skywhy » Sat Mar 20, 2010 4:04 pm

You are quite welcome, happy to help if I can.
Skywhy
Developer
Developer
 
Posts: 35
Joined: Tue Oct 20, 2009 7:55 pm

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests