Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (292)
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 1733 times)
0 Members and 1 Guest are viewing this topic.
Offline Raloth

Senior Newbie




I love YaBB 1G - SP1!


« Posted 2003-04-02 02: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 Member




Who, me?


« Reply #1 - Posted 2003-04-02 07: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 20: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: 48
Projects: 11


Monkey for a head


« Reply #3 - Posted 2003-04-02 21: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 Member




Java games rock!


« Reply #4 - Posted 2003-04-03 04: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-04 01: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 03: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-05 00:58:51 »

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

Senior Member




Who, me?


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

No more so than with a perspective view, surely?

Hellomynameis Charlie Dobbie.
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #9 - Posted 2003-04-05 12: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 21: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 Member




Who, me?


« Reply #11 - Posted 2003-04-06 23: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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (67 views)
2013-05-17 21:29:12

alaslipknot (76 views)
2013-05-16 21:24:48

gouessej (109 views)
2013-05-16 00:53:38

gouessej (104 views)
2013-05-16 00:17:58

theagentd (115 views)
2013-05-15 15:01:13

theagentd (104 views)
2013-05-15 15:00:54

StreetDoggy (149 views)
2013-05-14 15:56:26

kutucuk (172 views)
2013-05-12 17:10:36

kutucuk (170 views)
2013-05-12 15:36:09

UnluckyDevil (179 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.095 seconds with 21 queries.