]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
Texture kann schon Gezeichnet werden,
authorPeter Schaefer <schaeferpm@gmail.com>
Thu, 14 Apr 2016 17:39:25 +0000 (19:39 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Thu, 14 Apr 2016 17:39:25 +0000 (19:39 +0200)
aber entweder wird der Buffer nicht richtig geschrieben oder gelesen...

Weave/Graphix/Model/Plane.cpp
Weave/Graphix/Textures/Texture.cpp
Weave/Scene/Scene.cpp
shader/basicTexture_FS.hlsl
shader/basic_FS.hlsl
shader/lightingTexture_FS.hlsl

index 300bc2593545ffd40b6c17db8d74b88c927b515c..fb07a86da96fead07bb836d192e5f4b6240f08d6 100644 (file)
@@ -34,7 +34,8 @@ void Plane::drawModel() const
        Shader::gActive()->setUniformLocation("uPlain", 1);
        Shader::gActive()->setUniformLocation("uFar", 0);
 
-       glDrawArrays(GL_QUADS, 0, 4);
+       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+       //glDrawArrays(GL_QUADS, 0, 4);
        glBindVertexArray(0);
 }
 
index 2b7fc58ab8c7229b7ba0b1f1378ab1dc659aa87e..4276fd37e54bfcd5be43eb03c28739836c283c10 100644 (file)
@@ -2,6 +2,7 @@
 #include <GL\glew.h>
 
 #include "../../Message.h"
+#include "../Shader.h"
 
 #include "tImage.h"
 
@@ -97,6 +98,8 @@ void Texture::useTexture(unsigned int _unit) const
        /* bind Texture*/
        glActiveTexture(GL_TEXTURE0 + _unit);
        glBindTexture(texture_target, handle);
+
+       Shader::gActive()->setUniformLocation("uColorTexture", _unit);
 }
 
 void Texture::updateSize(unsigned int _width, unsigned int _height)
index b8e66336948d65e56fddfa8018e39943928f9764..9f136b0b71969526eeec388006af1612c1ee8a81 100644 (file)
@@ -57,9 +57,10 @@ lookat(_lookat)
 
        bt_dynamics_world->setGravity(btVector3(0, YFALL_SPEED, 0));
 
-       blur = new fBufferObject(2);
        render = new fBufferObject(1);
 
+       blur = new fBufferObject(2,false);
+
        blur->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight());
        render->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight());
 
@@ -173,7 +174,8 @@ void Scene::update(float deltaT)
 
 void Scene::draw() const
 {
-       //render->useBuffer();
+       render->useBuffer();
+       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        viewPort.useViewPort();
 
        //Skybox
@@ -193,11 +195,12 @@ void Scene::draw() const
                (*i)->draw();
        }
 
-       //render->clearBuffer();
-       //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-       //Shader::gBasicTexture()->useShader();
-       //render->getTexture(0)->useTexture(0);
-       //Model::getPlaneModel()->drawModel(mat4(1.f));
+       render->clearBuffer();
+       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+       Shader::gBasicTexture()->useShader();
+       //render->getTexture()->useTexture();
+       SceneObjects.front()->gTexture()->useTexture();
+       Model::getPlaneModel()->drawModel(mat4(1.f));
        
 }
 
index db0e01d01a632205ad9772db9902aa93d37ff453..302d9497e2f3125302b445c6b05488955f6ce57c 100644 (file)
@@ -3,11 +3,11 @@
 //in worldNormal;
 in vec2 fUVs;
 
-layout(location = 0) out vec4 gl_FragColor;
+layout(location = 0) out vec4 FragColor;
 
 uniform sampler2D uColorTexture;
  
 void main()
 {
-       gl_FragColor = texture(uColorTexture, fUVs);
+       FragColor = texture(uColorTexture, fUVs);
 }
\ No newline at end of file
index c2b701afb832780df7a497aee3e83bd04d131439..3dc38386431ae03cedbad4264e55c51b4a9b7206 100644 (file)
@@ -1,7 +1,10 @@
 //Fragment Shader
 #version 330
+
+layout(location = 0) out vec4 FragColor;
+
 uniform vec4 uFragmentColor = vec4(0.6, 0, 0, 0.6);
  
 void main(){
-       gl_FragColor = uFragmentColor;
+       FragColor = uFragmentColor;
 }
index 4b7f56a7d5cc01051be825948493ef4bafb843f0..c3a96a7b2b6742541e7bd56c00471d66f581b9a2 100644 (file)
@@ -5,7 +5,7 @@ in vec2 fUVs;
 
 in vec3 PointLightPosition1, DirectionalLightDirection1;
 
-layout (location = 0) out vec4 gl_FragColor;
+layout (location = 0) out vec4 FragColor;
 
 uniform sampler2D uColorTexture;
 uniform vec4 material;                                 //vec4 in the form (ambient, point, directional, glossyness); so far it was (1, 1, 1, 3)
@@ -37,15 +37,15 @@ void main()
        float squaredist1 = worldPointLightDir1.x * worldPointLightDir1.x + worldPointLightDir1.y * worldPointLightDir1.y + worldPointLightDir1.z * worldPointLightDir1.z;
 
 
-       gl_FragColor = vec4(uvColor.rgb * (AmbientLightColor * material[0]
+       FragColor = vec4(uvColor.rgb * (AmbientLightColor * material[0]
                + PointLightColor1 * material[1] * (cosThetaPoint1 + pow(SpecularCosPoint1, specularConst)) / squaredist1
                + DirectionalLightColor1 * material[2] * (cosThetaDirection1 + pow(SpecularCosDirection1, specularConst))
                ), uvColor.a);
 
 
-       //gl_FragColor = vec4((normalize(worldNormal)+1)/2, 1.0f);
-       //gl_FragColor = vec4(length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, 1.0f);
+       //FragColor = vec4((normalize(worldNormal)+1)/2, 1.0f);
+       //FragColor = vec4(length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, 1.0f);
 
        //vec3 uvColor = texture(uColorTexture, fUVs).rgb;
-       //gl_FragColor = vec4(uvColor, 1.0);
+       //FragColor = vec4(uvColor, 1.0);
 }