1
0
Fork 0

Bug fixes

This commit is contained in:
MrDev023 2017-01-14 20:10:33 +01:00
parent ae3320e067
commit d1ec316066
4 changed files with 82 additions and 75 deletions

View file

@ -3,8 +3,8 @@
<component name="ChangeListManager">
<list default="true" id="00f293cb-c755-478c-9b6f-422f827454e0" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/res/shaders/main.frag" afterPath="$PROJECT_DIR$/res/shaders/main.frag" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/Main.java" afterPath="$PROJECT_DIR$/src/globalgamejam/Main.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -20,6 +20,18 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="869">
<caret line="117" column="17" lean-forward="false" selection-start-line="117" selection-start-column="17" selection-end-line="117" selection-end-column="17" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Shaders.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Shaders.java">
<provider selected="true" editor-type-id="text-editor">
@ -30,41 +42,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="main.vert" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/shaders/main.vert">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="19" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.frag" pinned="false" current-in-tab="true">
<file leaf-file-name="main.frag" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="8" column="2" lean-forward="false" selection-start-line="8" selection-start-column="2" selection-end-line="8" selection-end-column="2" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="fbo.vert" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/shaders/fbo.vert">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="16" column="28" lean-forward="false" selection-start-line="16" selection-start-column="28" selection-end-line="16" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="fbo.frag" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/shaders/fbo.frag">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="50" lean-forward="false" selection-start-line="10" selection-start-column="50" selection-end-line="10" selection-end-column="50" />
<state relative-caret-position="153">
<caret line="9" column="86" lean-forward="false" selection-start-line="9" selection-start-column="86" selection-end-line="9" selection-end-column="86" />
<folding />
</state>
</provider>
@ -73,9 +55,23 @@
<file leaf-file-name="FrameBufferObject.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1222">
<caret line="5" column="35" lean-forward="false" selection-start-line="5" selection-start-column="35" selection-end-line="5" selection-end-column="35" />
<folding />
<state relative-caret-position="-66">
<caret line="49" column="39" lean-forward="true" selection-start-line="49" selection-start-column="39" selection-end-line="49" selection-end-column="39" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="MainGame.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="334">
<caret line="38" column="24" lean-forward="true" selection-start-line="38" selection-start-column="24" selection-end-line="38" selection-end-column="24" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -124,7 +120,6 @@
<option value="$USER_HOME$/Desktop/BasicLighting-master/src/Main.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/TestTile.java" />
<option value="$PROJECT_DIR$/res/shaders/main.vert" />
<option value="$PROJECT_DIR$/src/globalgamejam/Main.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
@ -136,6 +131,7 @@
<option value="$PROJECT_DIR$/res/shaders/fbo.frag" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/Main.java" />
<option value="$PROJECT_DIR$/res/shaders/main.frag" />
</list>
</option>
@ -714,8 +710,8 @@
<caret line="105" column="24" lean-forward="false" selection-start-line="105" selection-start-column="24" selection-end-line="105" selection-end-column="24" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1331#1530#0" expanded="true" />
<element signature="e#1529#1530#0" expanded="true" />
<element signature="e#1383#1582#0" expanded="true" />
<element signature="e#1581#1582#0" expanded="true" />
</folding>
</state>
</provider>
@ -905,18 +901,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-117">
<caret line="55" column="1" lean-forward="false" selection-start-line="55" selection-start-column="1" selection-end-line="55" selection-end-column="1" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1331#1530#0" expanded="true" />
<element signature="e#1529#1530#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/TestTile.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
@ -991,16 +975,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="117">
<caret line="34" column="28" lean-forward="false" selection-start-line="34" selection-start-column="12" selection-end-line="34" selection-end-column="28" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Shaders.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
@ -1009,14 +983,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1222">
<caret line="5" column="35" lean-forward="false" selection-start-line="5" selection-start-column="35" selection-end-line="5" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/shaders/fbo.frag">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
@ -1041,14 +1007,44 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="334">
<caret line="38" column="24" lean-forward="true" selection-start-line="38" selection-start-column="24" selection-end-line="38" selection-end-column="24" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="8" column="2" lean-forward="false" selection-start-line="8" selection-start-column="2" selection-end-line="8" selection-end-column="2" />
<state relative-caret-position="153">
<caret line="9" column="86" lean-forward="false" selection-start-line="9" selection-start-column="86" selection-end-line="9" selection-end-column="86" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-66">
<caret line="49" column="39" lean-forward="true" selection-start-line="49" selection-start-column="39" selection-end-line="49" selection-end-column="39" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="869">
<caret line="117" column="17" lean-forward="false" selection-start-line="117" selection-start-column="17" selection-end-line="117" selection-end-column="17" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

View file

@ -7,6 +7,7 @@ in vec2 fragTexCoord;
in vec3 fragVert;
//layout(location = 0) out vec4 finalColor;
// https://learnopengl.com/#!Lighting/Multiple-lights pour le lighing en cas de besoin
void main() {
gl_FragData[0] = texture(materialTex, fragTexCoord) * color;

View file

@ -4,6 +4,7 @@ package globalgamejam;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL13.GL_MULTISAMPLE;
import static org.lwjgl.system.MemoryUtil.*;
import org.lwjgl.glfw.*;
@ -48,6 +49,7 @@ public class Main {
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GL11.GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GL11.GL_FALSE);
glfwWindowHint(GLFW_SAMPLES, 4);//Activation du MSAA x4
// glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@ -69,6 +71,7 @@ public class Main {
//initialisation
//------------------------------------------------------------------------------------
glEnable(GL_MULTISAMPLE);//Activation du MSAA
Input.init();
game = new MainGame();
@ -103,9 +106,16 @@ public class Main {
}
}
game.destroy();
Audio.destroy();
glfwDestroyWindow(windowID);
glfwTerminate();
}
public static void changeGame(Game g){
game.destroy();
game = g;
g.init();
}
}

View file

@ -41,9 +41,6 @@ public class FrameBufferObject {
//Definir le render Texture
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D, renderedTexture, 0);
IntBuffer drawBuffs = BufferUtils.createIntBuffer(1);
drawBuffs.put(0, GL_COLOR_ATTACHMENT0);
GL20.glDrawBuffers(drawBuffs);
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
throw new IllegalStateException("FBO not loaded !");
fboTexID = renderedTexture;
@ -75,6 +72,9 @@ public class FrameBufferObject {
public void startRenderToFBO(){
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
IntBuffer drawBuffs = BufferUtils.createIntBuffer(1);
drawBuffs.put(0, GL_COLOR_ATTACHMENT0);
GL20.glDrawBuffers(drawBuffs);
glViewport(0,0,Main.WIDTH,Main.HEIGHT);
}