Java-Gaming.org
 Featured games (81) games approved by the League of Dukes Games in Showcase (497) Games in Android Showcase (114) games submitted by our members Games in WIP (563) 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 2153 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 Member

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: 56
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 Member

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 Member

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 Kernel

Medals: 378
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 Member

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.
 UprightPath (12 views) 2014-09-20 20:14:06 BurntPizza (26 views) 2014-09-19 03:14:18 Dwinin (40 views) 2014-09-12 09:08:26 Norakomi (70 views) 2014-09-10 13:57:51 TehJavaDev (95 views) 2014-09-10 06:39:09 Tekkerue (49 views) 2014-09-09 02:24:56 mitcheeb (70 views) 2014-09-08 06:06:29 BurntPizza (52 views) 2014-09-07 01:13:42 Longarmx (39 views) 2014-09-07 01:12:14 Longarmx (45 views) 2014-09-07 01:11:22
 BurntPizza 36x Riven 18x Rayvolution 18x ags1 16x princec 16x basil_ 16x KevinWorkman 15x LiquidNitrogen 12x theagentd 11x kevglass 11x deathpat 11x nsigma 11x HeroesGraveDev 8x The Lion King 7x TehJavaDev 6x PandaMoniumHUN 6x
 List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27Resources for WIP games2014-08-01 16:20:17Resources for WIP games2014-08-01 16:19:50List of Learning Resources2014-07-31 16:29:50List of Learning Resources2014-07-31 16:26:06List of Learning Resources2014-07-31 11:54:12HotSpot Optionsby dleskov2014-07-08 01:59:08
 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