Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
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  
  fun with rotation  (Read 1629 times)
0 Members and 1 Guest are viewing this topic.
Offline bedelf

Junior Member




Are you suggesting coconuts migrate?


« Posted 2003-06-06 14:44:21 »

Edit: do over! Goggle has failed me again. :(

Say I have a square 2d quad with some coords like, (100,100), (116,100), (116,116), (100,116).

To simplify my question, let me put it like this. I want to rotate it in place. I don't want it to move, just rotate from the center around to the right or left. Is this possible?

I can't find any examples that don't set the coords to like (-8,-8), (8,-8), (8,8), (-8,8) or mess with the camera. Looking at glrotatef documention didn't help much either.
Offline princec

JGO Kernel


Medals: 361
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2003-06-06 15:47:19 »

The simple answer is, you can't easily, you should have rotated it back when it was at the origin. Which is what you will now go and attempt to do.

Cas Smiley

Offline bedelf

Junior Member




Are you suggesting coconuts migrate?


« Reply #2 - Posted 2003-06-06 16:00:27 »

Looks like my rotation dreams within the limits of the SPGL are toast. Smiley Looking at Alien Flux now I can at understand why everything is the way it is. Oh well, I think what I'm going to do now is just do all the rendering myself explicitly and worry about building something to speed it up later. Getting really tired of not getting anywhere. Wink

Though I can't say I didn't learn anything this week.

edit: spelling, i blame the headache that feels like my eyeballs are trying to liberate themselves from my skull
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Chman

Junior Member




Nothing more that... Java games are cool !


« Reply #3 - Posted 2003-06-07 05:45:45 »

Quote

To simplify my question, let me put it like this. I want to rotate it in place. I don't want it to move, just rotate from the center around to the right or left. Is this possible?


Yes it's possible, and it's very easy !

Just use gl.pushMatrix() before your transormation and gl.popMatrix() after it :

translate_your_quad
 gl.pushMatrix();
   rotate_your_quad
 gl.popMatrix();

It should work..
Offline bedelf

Junior Member




Are you suggesting coconuts migrate?


« Reply #4 - Posted 2003-06-07 07:10:44 »

I could make it work in the middle of all that vertex array code, ya.

I think I'll be traveling different roads for a time though.

edit: you get an A+ for effort though Tongue
Offline princec

JGO Kernel


Medals: 361
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-06-07 09:11:13 »

I can rotate sprites without effort in the SPGL - you just have to remember to rotate them before you translate them, as Ch*man suggests. However, you don't want to do it like he says, because the performance (for sprites) will be utterly utterly abysmal and you'll only manage to draw a couple of hundred before it starts to judder.


Cas Smiley

Offline bedelf

Junior Member




Are you suggesting coconuts migrate?


« Reply #6 - Posted 2003-06-07 09:35:14 »

Then theres something I don't understand. (an experience not wholly unfamiliar to me) How/when can you rotate using the SpriteEngine? Back when I brought this up last time you said something about just having different animations for it. Not what I'm looking for, but you seem to be hinting at what I want now.

If you had a dollar for everytime I asked a question, I know. Indulge me one more time please. Tongue

All my sprites are going to be top-down little buggers and need to face the direction they are looking in. This should be changing almost every single frame for most of the sprites, unless I design a boring combat system. Wink

edit: added a LSL3 reference Wink
Offline princec

JGO Kernel


Medals: 361
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2003-06-07 12:14:43 »

Ah, now the version of the sprite engine you've got in SPGL currently hasn't got the rotation code in it Smiley I took it out because I didn't need it as we pre-render all our sprites in rotated positions. Just let's say you'd need to perform the rotation before translation occurs in the writeSpriteToBuffer method in SpriteRenderer. In fact if you look back in some of the old cvs versions it'll still be in there.

Cas Smiley

Offline bedelf

Junior Member




Are you suggesting coconuts migrate?


« Reply #8 - Posted 2003-06-07 13:50:08 »

/me falls backward

edit: evil.

edit2: yep, it's in there i believe, under version 1.6

god I hope that crap just pastes Smiley
Offline bedelf

Junior Member




Are you suggesting coconuts migrate?


« Reply #9 - Posted 2003-06-07 19:08:27 »

Ok, I just sat down and worked rotation back in. It didn't exactly just paste but it went in fairly gracefully since you really didn't change that much.

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

atombrot (23 views)
2014-08-19 09:29:53

Tekkerue (22 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (57 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (29 views)
2014-08-08 02:01:56

Norakomi (36 views)
2014-08-06 19:49:38

BurntPizza (66 views)
2014-08-03 02:57:17
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-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
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!