fixed fbos tmp

pull/7/head
hYdos 2020-02-25 15:33:33 +10:00
parent c448d21a8e
commit 37e8bb144c
4 changed files with 21 additions and 9 deletions

View File

@ -117,11 +117,22 @@ public class Litecraft extends Game{
return system;
}
//temp stuff to test out fbo fixes
int oldWindowWidth = Window.width;
int oldWindowHeight = Window.height;
@Override
public void update() {
ginger3D.update(data);
if(oldWindowHeight != Window.height || oldWindowWidth != Window.width) {
System.out.println("Windows size changed");
ginger3D.contrastFbo.resizeFBOs();
}
oldWindowWidth = Window.width;
oldWindowHeight = Window.height;
ginger3D.masterRenderer.renderShadowMap(data.entities, data.lights.get(0));
data.camera.move();
@ -138,9 +149,7 @@ public class Litecraft extends Game{
boolean isClicked = playButton.isClicked();
playButton.update();
if(text == null) {System.out.println("Yes is null crusty foss time");}
text.setText(isClicked + "");
ginger3D.renderOverlays(this);

View File

@ -5,6 +5,7 @@ import java.util.*;
import com.github.hydos.ginger.engine.api.game.Game;
import com.github.hydos.ginger.engine.elements.buttons.TextureButton;
import com.github.hydos.ginger.engine.font.GUIText;
import com.github.hydos.ginger.engine.postprocessing.Fbo;
/**
* Used if a game wants to access engine variables safely
@ -15,7 +16,9 @@ public class GingerRegister {
public List<GUIText> texts;
public List<TextureButton> guiButtons;
public List<Fbo> fbos;
public Game game;
public GingerRegister() {
@ -28,9 +31,7 @@ public class GingerRegister {
}
public GUIText retrieveText(String string) {
GUIText lastText = null;
for(GUIText text: texts) {
lastText = text;
if(string.equalsIgnoreCase(string)) {
return text;
}

View File

@ -17,7 +17,7 @@ public class Fbo {
long window;
int width = 1024;
int height = 768;
boolean resetFramebuffer;
public boolean resetFramebuffer;
boolean destroyed;
Object lock = new Object();
@ -45,6 +45,8 @@ public class Fbo {
public void createFBO() {
this.window = Window.window;
this.width = Window.width;
this.height = Window.height;
/* Create multisampled FBO */
multisampledColorRenderBuffer = glGenRenderbuffers();
multisampledDepthRenderBuffer = glGenRenderbuffers();

View File

@ -48,6 +48,6 @@ void main(void){
out_Color = vec4(totalDiffuse, 1.0) * textureColour + vec4(totalSpecular, 1.0);
out_Color = mix(vec4(skyColour, 1.0), out_Color, visibility);
out_Color = vec4(out_Color.r*brightness, out_Color.b*brightness, out_Color.g*brightness, out_Color.a);
out_Color = vec4(out_Color.r*brightness, out_Color.g*brightness, out_Color.b*brightness, out_Color.a);
}