Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  drawing images and rotating with JOGL  (Read 805 times)
0 Members and 2 Guests are viewing this topic.
Offline 8ballj

JGO n00b
*

Posts: 15



« on: 2009-12-02 13:10:30 »

All my images are PNG format.  I've gotten to the point where I can draw these images using gl.glDrawPixels().  I generate all the byte[] buffers upon load of the game, however this itself isn't adequate if I want images rotated during the game.  What is the best way to implement this?

1) Use Java2D to apply AffineTransform rotation to image and then produce byte[] for each frame.  Seems like this add a lot of overhead, especially with 60+ fps.

2) Use Textures?  I'm wondering if I convert an image to texture if JOGL can do the rotation for me.

3) Any other ideas?

Offline lhkbob

JGO Neuromancer
****

Posts: 1174
Medals: 35



« Reply #1 on: 2009-12-03 10:37:18 »

Yes you'll need to use textures.  This is pretty easy to do.  The first step is to create a texture object to use the byte[] data from your loaded image.  Then you draw a quad that contains the entire image and when you want the image rotated, you rotate the quad.

Offline 8ballj

JGO n00b
*

Posts: 15



« Reply #2 on: 2009-12-25 16:08:24 »

excellent, thanks!
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.087 seconds with 20 queries.