Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  screen dimensions in Open GL units?  (Read 2297 times)
0 Members and 1 Guest are viewing this topic.
Offline Raloth

Senior Newbie




I love YaBB 1G - SP1!


« Posted 2003-04-02 00:55:22 »

Is there a way to find out what the dimensions are based on where the camera is? Even from (0,0,0) would work in my case. I can use simple triginometry to calculate what it is from the camera height I decide to use and store it in a final. I am working on a 2d-3d overhead game and I need to know to keep the "sprites" from going off the screen. Right now I am just using textured quads, but in the future I hope these will be come actual models so I can do some cool effects with the z coordinate (for example, enemies fly up and shoot down at you).
Offline cfmdobbie

Senior Devvie


Medals: 1


Who, me?


« Reply #1 - Posted 2003-04-02 05:43:44 »

I'm afraid that's a bit confused - in a perspective mode the "world" extents you can see depends on how far away you're looking, and whether the surface you're looking at is perpendicular to the camera etc.  You should be able to work out things like that, but it's down to you to do the math (since you set up the world and objects in the first place).

You might want to use an orthogonal view - look at gl.ortho().  The viewing volume generated is a "rectangular parallelepiped" (a box) rather than a frustum.

Hellomynameis Charlie Dobbie.
Offline Raloth

Senior Newbie




I love YaBB 1G - SP1!


« Reply #2 - Posted 2003-04-02 18:49:12 »

All I need is a way to tell if a vertice is in the current camera view. I'm not sure what I was thinking before.

I did think about using ortho, but that limits the game to only looking good at one resolution.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #3 - Posted 2003-04-02 19:56:57 »

Theres code for a GL Frustum class in the shared code section somewhere, that should do what you want.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Harley Rana

Junior Devvie




Java games rock!


« Reply #4 - Posted 2003-04-03 02:40:01 »

http://www.markmorley.com/opengl/frustumculling.html
Explains the situtation really well. Smiley
Offline Raloth

Senior Newbie




I love YaBB 1G - SP1!


« Reply #5 - Posted 2003-04-03 23:45:04 »

I think I might just go to ortho view. How well does open gl resize the textures? I wanted the game to be playable on any resolution but it doesn't look like it is going to happen.
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #6 - Posted 2003-04-04 01:57:38 »

Just use a bigger or smaller square. Bigger square == resized  image.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Raloth

Senior Newbie




I love YaBB 1G - SP1!


« Reply #7 - Posted 2003-04-04 22:58:51 »

I'm just worried that the image will get too distorted at really high or low resolutions.
Offline cfmdobbie

Senior Devvie


Medals: 1


Who, me?


« Reply #8 - Posted 2003-04-04 23:12:37 »

No more so than with a perspective view, surely?

Hellomynameis Charlie Dobbie.
Offline princec

« JGO Spiffy Duke »


Medals: 436
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2003-04-05 10:42:15 »

Use the highest resolution texture you can get away with. Get GLU to generate mipmaps of it. Use linear_mipmap_nearest minification.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Raloth

Senior Newbie




I love YaBB 1G - SP1!


« Reply #10 - Posted 2003-04-06 19:34:06 »

Thanks guys, everything is working pretty well now. One thing is kind of bothering me though. My particles end up going on top of the sprites and I would like them underneath, and I can't figure out how to change the order. Turning off blending before rendering the sprites and then turning it back on before the particles doesn't seem to work.
Offline cfmdobbie

Senior Devvie


Medals: 1


Who, me?


« Reply #11 - Posted 2003-04-06 21:53:03 »

If you're using a Z buffer in an orthogonal viewing transform, just give the particles a larger Z-value.  If you can't afford to have them moved far, just "budge" them a little - by 0.001f or something.

If you're not Z-buffering, just draw the particles first.

Hellomynameis Charlie Dobbie.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (38 views)
2014-12-15 09:26:44

Mr.CodeIt (31 views)
2014-12-14 19:50:38

BurntPizza (62 views)
2014-12-09 22:41:13

BurntPizza (99 views)
2014-12-08 04:46:31

JscottyBieshaar (60 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (77 views)
2014-11-29 21:32:03

toopeicgaming1999 (138 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (38 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!