Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: Basic questions on Buffer Strategy, please hel on: 2003-04-27 19:40:50


New Code: I think this block may help your confusion

public void run(){
 while (true){  
   updateProgram();
    Graphics g = strategy.getDrawGraphics();    
   // Draw to graphics  
   // you have code already in your paint method so take it out
   // and create another method that takes a Graphics g
   // something like
   paintToBuffer(g);
   strategy.show();    
try{  
    Thread.sleep(100);
   }catch(InterruptedException e){}
 }
}

I haven't actually used a Bufferstrategy yet, but from what I've read, this is probably what you want to do.. for a simple render loop.

Later.
2  Java Game APIs & Engines / Java 2D / Re: Newbie, summary of research: on: 2003-04-27 19:34:19
Alright, I'll give BufferStrategy a whirl.. I won't delete my other renderers yet though, I'll just plugin a new BufferStrategyRenderer.. and profile my code.. Let's see if suns code "Actually optimizes by choosing the best config" I'm somehow a bit skeptical. I forgot to mention, I'm not using fullscreen mode, so there will be no page flipping in my near future  Cry

Thanks, again for the info.
3  Java Game APIs & Engines / Java 2D / Re: How to remove previous drawStrings? on: 2003-04-27 09:14:46
hey there.. umm basically you need to grab the Graphics2D and execute the following line:



g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
then:
Rectangle2D rect = new Rectangle(0,0,m_nBoardWidth,m_nBoardHeight);
// or whatever the size of your screen or rectangle you want to blank to transparent is.
then
g2D.fill(rect);// now your rectangle has been cleared
after that you have to reset the composite by doing this:

g2D.setComposite(AlphaComposite.SrcOver);

// blit your image or text to the graphics2d now and your done.

Later.
4  Java Game APIs & Engines / Java 2D / Re: Newbie, summary of research: on: 2003-04-27 06:58:22
Umm, thanks for the suggestion.. You didn't answer any of my questions though.... Embarrassed
5  Java Game APIs & Engines / Java 2D / Newbie, summary of research: on: 2003-04-27 05:09:00
Hey guys, as you can see by the subject header I'm new to this scene/subculture. I'm currently working on a game engine and I have a couple of questions concerning the hardware acceleration in java. Actually I have more of a summary of the research I've done.

1. Use VolatileImages for the backbuffer. They will blit to the screen faster because java will be moving image data from VRAM to VRAM
2. Use "Managed" images (applet.getImage()) for sprites and blitting to volatile images. Java takes care of the acceleration in the background through the API
3. Use bufferedImages if you need access to pixel data (special effects) slowest of all imges, no hardware acceleration.

Are the three asumptions I've made correct?

Another question:  Currently my engine is setup to auto-detect hardware acceleration. I then load 1 of three renderes according to the following criteria:

1. If the system supports accelerated images and they are true volatileImages then load TrueVolatileRenderer
2. If the system supportts volatile images and they are not true volatile (ie linux.. uses pixelmaps or something) use VolatileRenderer
3. If no accleration can be used use a bufferedImage renderer...

How does the logic sound up there? I divided the renderers up purely for speed... less calcs have to be made if the system is in state 2 then state 3 so I created a differed renderer etc...


Thanks, in advance
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Dwinin (6 views)
2014-07-29 10:59:34

E.R. Fleming (20 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!