Questions tagged [bufferstrategy]

The BufferStrategy is a Java class representing the mechanism used to organize complex memory on a certain AWT Canvas or Window. Use this tag for general questions related to creating or managing a BufferStrategy.

Official Documentation:

75 questions
1
vote
0 answers

disposing onto a bufferstrats but .show wont show graphics

So I've just learnt about BS and dispose from what I've been told the dispose is basically disposing the graphical objects that I've written so far onto the BS, and then with the bs.show It should be displaying the colour blue on my background…
Munerz
  • 1,052
  • 1
  • 13
  • 26
1
vote
0 answers

Rendering image in java

I'm trying to put a picture in java JFrame, but i want to modify every pixel, so i want to load it pixel by pixel. I'm stuck at part where pixels should be loaded to the screen but i see no effect. What did i miss? I'm pretty sure it's something…
Akka Jaworek
  • 1,970
  • 4
  • 21
  • 47
1
vote
0 answers

Is it better to use JPanel or Canvas?

Right now I have a workspace set up that extends JFrame and implements Runnable. It actually set it up that way when I used the JFrame feature within eclipse. I try to add a BufferStrategy and I get several errors in the Debug console.
1
vote
2 answers

FileStream and it's buffering strategy

I've found out that there is no point in using BufferedStream in conjunction with FileStream as it has it's own buffering strategy. Yet, I was wondering about one thing: FileStream fsWithBuffer = new FileStream("buf.dat", FileMode.OpenOrCreate, …
Paweł Poręba
  • 1,084
  • 1
  • 14
  • 37
1
vote
1 answer

Passive rendering method

I am building a simple game rendering method. I have a static images like map background that isn't really changing at all . I am just using like 30% of the whole screen for changing graphics. And I don't feel like it is necessary to render all that…
1
vote
0 answers

BufferStrategy Causing Flickering?

I am new to Java Game Programming and I am having trouble with my game. I am making this for my class in school and for fun so I transfer my code from my computer at school and my computer at home. Recently, when I run my program at home, the…
Patrick
  • 11
  • 2
1
vote
1 answer

Pass JFrame as argument to JPanel subclass for BufferStrategy

I'm creating an application in which I have a class with a main frame (JFrame), and a class which is a JPanel subclass called OvalPanelClass. I say main frame because the user has the option to open up another JFrame (window). This OvalPanelClass is…
quantum285
  • 1,032
  • 2
  • 11
  • 23
1
vote
1 answer

Using java bufferstrategy and swing elements at the same time

I program a simple RTS game now, and it is my first experience in game design. My problem is that when I use createBufferStrategy(2) all swing elements (buttons etc...) not displayed after bufferStrategy.show(); method is invoked. My game is full of…
Crabonog
  • 423
  • 3
  • 12
1
vote
0 answers

Implementing BufferStrategy

I'm coming from Java background and for creating games I always used BufferStrategy for smoothing animations. However in Android I couldn't find BufferStrategy, so I decided to create my own. How would you implement a BufferStrategy? Pseudo-code is…
oshribm
  • 145
  • 1
  • 7
1
vote
2 answers

triple buffer heavy flickering

Shouldn't triple buffering and Canvas be an optimal solution for passive rendering? I've just wrote this java code that displays a circle. If I leave bufferstrategy to 3, it flickers so much. If I turn it down to 2 or 1 it's ok. Maybe I'm doing…
Muteking
  • 1,465
  • 5
  • 18
  • 31
1
vote
2 answers

Java Buffer strategy learning

I'm learning to use bufferstrategy with canvas, I coded this class which is then added to a JFrame in another class. I'm trying to draw a rectangle, but the canvas is empty. The console says at…
Muteking
  • 1,465
  • 5
  • 18
  • 31
0
votes
0 answers

How to prevent screen tearing when using triple buffering in Java

I'm trying to draw a simple shape on the screen using the Swing library and the BufferStrategy class. However, when using BufferStrategy with three buffer areas, screen tearing occurs, but not when using two buffer areas. Does anyone know what's…
anathrax
  • 91
  • 1
  • 1
  • 11
0
votes
0 answers

Is there a way to fully ignoreRepaint in Swing?

I'm using setIgnoreRepaint(true) on my JFrame with Active Rendering and a BufferStrategy. When I disable the portion of code that is calling contentPane.repaintAll() from the EDT withing my game loop, nothing get's drawn anymore which is expected,…
Eorix
  • 81
  • 8
0
votes
0 answers

How do i get the content of the BufferStrategy/its Graphics in Java?

is there a way to get the content of the current Buffer im writing to? a sort of a representation of what i've written to its graphics. For example, in the following code, i would like to get a BufferedImage or even an Array that has values that…
telos
  • 25
  • 6
0
votes
1 answer

Having Trouble With Drawing To BufferStrategy Java

I am creating a game and want to draw to a Canvas using it's BufferStrategy. For some reason it doesn't seem to want to display anything on the screen. I've looked at the Java Documentation and read several Stackoverflow questions that others have…
IssiahB
  • 52
  • 8