Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (604) Games in Android Showcase (171) games submitted by our members Games in WIP (654) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 screen dimensions in Open GL units?  (Read 2630 times) 0 Members and 1 Guest are viewing this topic.
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).
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.
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.
Orangy Tang

JGO Kernel

Medals: 57
Projects: 11

 « 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 ]
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.
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.
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
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.
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.
princec

« JGO Spiffy Duke »

Medals: 556
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

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.
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.

 bilznatch (25 views) 2015-08-04 11:03:17 SHC (42 views) 2015-08-01 03:58:20 Jesse (24 views) 2015-07-29 04:35:27 Riven (47 views) 2015-07-27 16:38:00 Riven (25 views) 2015-07-27 15:35:20 Riven (27 views) 2015-07-27 12:26:13 Riven (18 views) 2015-07-27 12:23:39 BurntPizza (41 views) 2015-07-25 00:14:37 BurntPizza (55 views) 2015-07-24 22:06:39 BurntPizza (34 views) 2015-07-24 06:06:53
 theagentd 50x wessles 48x basil_ 33x KaiHH 26x Riven 21x orangepascal 17x mooman219 17x bornander 16x ags1 16x KudoDEV 13x CelestialCreator 11x princec 11x klaus 11x pquiring 11x israelg99 9x Spasi 8x
 List of Learning Resourcesby gouessej2015-07-09 11:29:36How Do I Expand My Game?by bashfrog2015-06-14 11:34:43List of Learning Resources2015-05-31 05:37:30Intersection Methodsby Roquen2015-05-29 08:19:33List of Learning Resources2015-05-05 10:20:32How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21
 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