1
0
Fork 0

add FrameBuffer Object

This commit is contained in:
MrDev023 2017-01-14 19:32:47 +01:00
parent 18bb7ab823
commit eda25cf2c9
7 changed files with 304 additions and 227 deletions

View file

@ -2,18 +2,13 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="00f293cb-c755-478c-9b6f-422f827454e0" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/globalgamejam/tiles/TestTile.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/globalgamejam/render/Tile.java" afterPath="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/res/shaders/fbo.frag" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/res/shaders/fbo.vert" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/res/shaders/main.frag" afterPath="$PROJECT_DIR$/res/shaders/main.frag" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/res/shaders/main.vert" afterPath="$PROJECT_DIR$/res/shaders/main.vert" />
<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/game/Game.java" afterPath="$PROJECT_DIR$/src/globalgamejam/game/Game.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" afterPath="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" afterPath="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/Camera.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/Camera.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.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" />
@ -28,112 +23,7 @@
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<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="255">
<caret line="15" column="20" lean-forward="false" selection-start-line="15" selection-start-column="20" selection-end-line="15" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</file>
<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="187">
<caret line="11" column="60" lean-forward="false" selection-start-line="11" selection-start-column="60" selection-end-line="11" selection-end-column="60" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="DisplayManager.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="30" column="65" lean-forward="false" selection-start-line="30" selection-start-column="65" selection-end-line="30" selection-end-column="65" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Tile.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="54" column="60" lean-forward="false" selection-start-line="54" selection-start-column="60" selection-end-line="54" selection-end-column="60" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2892#2893#0" expanded="true" />
<element signature="e#2924#2925#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Game.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/Game.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="22" lean-forward="false" selection-start-line="12" selection-start-column="22" selection-end-line="12" selection-end-column="22" />
<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="389">
<caret line="26" column="26" lean-forward="false" selection-start-line="26" selection-start-column="26" selection-end-line="26" selection-end-column="26" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#624#625#0" expanded="true" />
<element signature="e#660#661#0" expanded="true" />
<element signature="e#743#744#0" expanded="true" />
<element signature="e#763#764#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="6" column="5" lean-forward="false" selection-start-line="6" selection-start-column="5" selection-end-line="6" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Camera.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Camera.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="20" column="32" lean-forward="true" selection-start-line="20" selection-start-column="32" selection-end-line="20" selection-end-column="32" />
<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">
<state relative-caret-position="-68">
<caret line="18" column="88" lean-forward="false" selection-start-line="18" selection-start-column="88" selection-end-line="18" selection-end-column="88" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
@ -172,7 +62,6 @@
<option value="$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/math/Vector4f.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/Texture.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/Tile.java" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$USER_HOME$/Desktop/BasicLighting-master/src/Main.java" />
@ -181,11 +70,16 @@
<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$/res/shaders/main.frag" />
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/Camera.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/game/Game.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/FBOTile.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" />
<option value="$PROJECT_DIR$/res/shaders/main.frag" />
<option value="$PROJECT_DIR$/res/shaders/fbo.vert" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
<option value="$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java" />
<option value="$PROJECT_DIR$/res/shaders/fbo.frag" />
</list>
</option>
</component>
@ -375,6 +269,38 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="GGL-2017" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GGL-2017" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="res" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="GGL-2017" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GGL-2017" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="res" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="shaders" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
@ -609,7 +535,7 @@
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<editor active="false" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
@ -620,13 +546,14 @@
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
@ -638,7 +565,6 @@
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
@ -653,18 +579,6 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
<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="0" selection-end-column="0" />
<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$/res/shaders/main.vert">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
@ -709,10 +623,6 @@
<caret line="22" column="27" lean-forward="true" selection-start-line="22" selection-start-column="27" selection-end-line="22" selection-end-column="27" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#624#625#0" expanded="true" />
<element signature="e#660#661#0" expanded="true" />
<element signature="e#743#744#0" expanded="true" />
<element signature="e#763#764#0" expanded="true" />
</folding>
</state>
</provider>
@ -820,7 +730,7 @@
<state relative-caret-position="85">
<caret line="14" column="3" lean-forward="false" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
<folding>
<element signature="imports" expanded="false" />
<element signature="imports" expanded="true" />
<element signature="e#1876#1877#0" expanded="false" />
<element signature="e#1895#1896#0" expanded="false" />
<element signature="e#1922#1923#0" expanded="false" />
@ -886,28 +796,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="14" column="3" lean-forward="false" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
<folding>
<element signature="imports" expanded="false" />
<element signature="e#1876#1877#0" expanded="false" />
<element signature="e#1895#1896#0" expanded="false" />
<element signature="e#1922#1923#0" expanded="false" />
<element signature="e#1942#1943#0" expanded="false" />
<element signature="e#1964#1965#0" expanded="false" />
<element signature="e#1980#1981#0" expanded="false" />
<element signature="e#2003#2004#0" expanded="false" />
<element signature="e#2042#2043#0" expanded="false" />
<element signature="e#2067#2068#0" expanded="false" />
<element signature="e#2105#2106#0" expanded="false" />
<element signature="e#2131#2132#0" expanded="false" />
<element signature="e#2158#2159#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Sound3D.java" />
<entry file="file://$PROJECT_DIR$/src/globalgamejam/input/IO.java">
<provider selected="true" editor-type-id="text-editor">
@ -972,24 +860,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="30" column="65" lean-forward="false" selection-start-line="30" selection-start-column="65" selection-end-line="30" selection-end-column="65" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/shaders/main.vert">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="20" lean-forward="false" selection-start-line="15" selection-start-column="20" selection-end-line="15" selection-end-column="20" />
<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">
@ -998,14 +868,6 @@
</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="-68">
<caret line="18" column="88" lean-forward="false" selection-start-line="18" selection-start-column="88" selection-end-line="18" selection-end-column="88" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-391">
@ -1014,40 +876,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="60" lean-forward="false" selection-start-line="11" selection-start-column="60" selection-end-line="11" selection-end-column="60" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="54" column="60" lean-forward="false" selection-start-line="54" selection-start-column="60" selection-end-line="54" selection-end-column="60" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2892#2893#0" expanded="true" />
<element signature="e#2924#2925#0" expanded="true" />
</folding>
</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="389">
<caret line="26" column="26" lean-forward="false" selection-start-line="26" selection-start-column="26" selection-end-line="26" selection-end-column="26" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#624#625#0" expanded="true" />
<element signature="e#660#661#0" expanded="true" />
<element signature="e#743#744#0" expanded="true" />
<element signature="e#763#764#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Camera.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
@ -1058,14 +886,116 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/Game.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="22" lean-forward="false" selection-start-line="12" selection-start-column="22" selection-end-line="12" selection-end-column="22" />
<state relative-caret-position="238">
<caret line="14" column="5" lean-forward="true" selection-start-line="14" selection-start-column="5" selection-end-line="14" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="247">
<caret line="30" column="65" lean-forward="false" selection-start-line="30" selection-start-column="65" selection-end-line="30" selection-end-column="65" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="121">
<caret line="53" column="8" lean-forward="false" selection-start-line="53" selection-start-column="8" selection-end-line="66" selection-end-column="38" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2892#2893#0" expanded="true" />
<element signature="e#2924#2925#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/FBOTile.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="63" lean-forward="false" selection-start-line="15" selection-start-column="63" selection-end-line="15" selection-end-column="63" />
<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="19" lean-forward="false" selection-start-line="8" selection-start-column="18" selection-end-line="8" selection-end-column="19" />
<folding />
</state>
</provider>
</entry>
<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>
<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>
<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" />
<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="665">
<caret line="93" column="122" lean-forward="false" selection-start-line="93" selection-start-column="122" selection-end-line="93" selection-end-column="122" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#3230#3231#0" expanded="true" />
<element signature="e#3282#3283#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="359">
<caret line="84" column="41" lean-forward="false" selection-start-line="84" selection-start-column="8" selection-end-line="84" selection-end-column="41" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</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="255">
<caret line="19" column="51" lean-forward="false" selection-start-line="19" selection-start-column="51" selection-end-line="19" selection-end-column="51" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

12
res/shaders/fbo.frag Normal file
View file

@ -0,0 +1,12 @@
#version 150
//Il ny a pas de layout(location=i) dans OpenGL < 3.3, mais tu peux utiliser glFragData[i] = myvalue à la place.
uniform sampler2D materialTex;
in vec2 fragTexCoord;
in vec3 fragVert;
out vec4 finalColor;
void main() {
finalColor = texture(materialTex, fragTexCoord);
}

18
res/shaders/fbo.vert Normal file
View file

@ -0,0 +1,18 @@
#version 150
uniform mat4 projection;
in vec3 vert;
in vec2 vertTexCoord;
out vec3 fragVert;
out vec2 fragTexCoord;
void main() {
// Pass some variables to the fragment shader
fragTexCoord = vertTexCoord;
fragVert = vert;
// Apply all matrix transformations to vert
gl_Position = projection * vec4(vert, 1);
}

View file

@ -1,12 +1,12 @@
#version 150
#version 330
//Il ny a pas de layout(location=i) dans OpenGL < 3.3, mais tu peux utiliser glFragData[i] = myvalue à la place.
uniform sampler2D materialTex;
uniform vec4 color;
in vec2 fragTexCoord;
in vec3 fragVert;
out vec4 finalColor;
layout(location = 0) out vec4 finalColor;
void main() {
finalColor = texture(materialTex, fragTexCoord) * color;

View file

@ -3,7 +3,6 @@ package globalgamejam.game;
import globalgamejam.render.*;
import globalgamejam.tiles.TestTile;
import globalgamejam.tiles.Tile;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
@ -13,9 +12,11 @@ import java.util.ArrayList;
public class MainGame extends Game{
private ArrayList<Tile> tiles;
private FrameBufferObject fbo;
@Override
public void init() {
fbo = new FrameBufferObject();
tiles = new ArrayList<Tile>();
TestTile t = new TestTile();
t.getTransform().translate(100,100,0);
@ -31,7 +32,11 @@ public class MainGame extends Game{
@Override
public void render2D() {
fbo.startRenderToFBO();
for(Tile t : tiles)t.render();
fbo.stopRenderToFBO();
fbo.renderFBO();
}
@ -42,6 +47,7 @@ public class MainGame extends Game{
@Override
public void destroy() {
fbo.destroy();
tiles.clear();
}

View file

@ -0,0 +1,110 @@
package globalgamejam.render;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL30.*;
import static org.lwjgl.opengl.GL32.*;
import globalgamejam.Main;
import globalgamejam.math.Matrix4f;
import globalgamejam.math.Vector2f;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
/**
* Created by MrDev023 on 14/01/2017.
*/
public class FrameBufferObject {
private int fbo,fboTexID,renderID,vbo,size;
public FrameBufferObject(){
int width = Main.WIDTH;
int height = Main.HEIGHT;
this.fbo = glGenFramebuffers();
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
//Creation de la texture qui va contenir la sortie RGB du shader
int renderedTexture = glGenTextures();
glBindTexture(GL_TEXTURE_2D, renderedTexture);
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//Creation du tampon de profondeur
int depthrenderbuffer = glGenRenderbuffers();
glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthrenderbuffer);
//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;
renderID = depthrenderbuffer;
this.vbo = GL15.glGenBuffers();
float[] a = new float[]{
0,0, 0.0f,0.0f,
1,0, 1.0f,0.0f,
1,1, 1.0f,1.0f,
0,1, 0.0f,1.0f
};
FloatBuffer buffer = BufferUtils.createFloatBuffer(a.length);
buffer.put(a).flip();
size = a.length/(2+2);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vert"));
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vert"), 2, GL11.GL_FLOAT, false, (2+2)*4, 0);
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"));
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"), 2, GL11.GL_FLOAT, true, (2+2)*4, 2*4);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
public void startRenderToFBO(){
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glViewport(0,0,Main.WIDTH,Main.HEIGHT);
}
public void stopRenderToFBO(){
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
public void renderFBO(){
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0,0,Main.WIDTH,Main.HEIGHT);
Shaders.MAIN_FBO.bind();
Shaders.MAIN_FBO.uniform("projection", (new Matrix4f()).Ortho2D(0,1,0,1,-1,1).mul(new Matrix4f().translate(.5f,.5f,0)));
GL13.glActiveTexture(GL13.GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, fboTexID);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL11.glDrawArrays(GL11.GL_QUADS, 0, size);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
Shaders.MAIN_SHADERS.unbind();
}
public void destroy(){
glDeleteTextures(fboTexID);
glDeleteRenderbuffers(renderID);
glDeleteFramebuffers(fbo);
}
}

View file

@ -12,11 +12,12 @@ public class Shaders {
public int program;
public static Shaders MAIN_SHADERS;
public static Shaders MAIN_SHADERS,MAIN_FBO;
static{
try{
MAIN_SHADERS = new Shaders("res/shaders/main.vert","res/shaders/main.frag");
MAIN_FBO = new Shaders("res/shaders/fbo.vert","res/shaders/fbo.frag");
}catch(Exception e){
e.printStackTrace();
}