Browse Source

Shaders: use location 1 for texture coordinates and location 2 for normals.

pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
ef42287cf9
  1. 4
      src/Shaders/Phong.h
  2. 4
      src/Shaders/Phong.vert

4
src/Shaders/Phong.h

@ -59,7 +59,7 @@ myDiffuseTexture.bind(Shaders::Phong::DiffuseTextureLayer);
class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
public: public:
typedef Attribute<0, Vector3> Position; /**< @brief Vertex position */ typedef Attribute<0, Vector3> Position; /**< @brief Vertex position */
typedef Attribute<1, Vector3> Normal; /**< @brief Normal direction */ typedef Attribute<2, Vector3> Normal; /**< @brief Normal direction */
/** /**
* @brief Texture coordinates * @brief Texture coordinates
@ -67,7 +67,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* Used only if one of @ref Flag::AmbientTexture, @ref Flag::DiffuseTexture * Used only if one of @ref Flag::AmbientTexture, @ref Flag::DiffuseTexture
* or @ref Flag::SpecularTexture is set. * or @ref Flag::SpecularTexture is set.
*/ */
typedef Attribute<2, Vector2> TextureCoordinates; typedef Attribute<1, Vector2> TextureCoordinates;
enum: Int { enum: Int {
/** /**

4
src/Shaders/Phong.vert

@ -41,7 +41,7 @@ uniform highp vec3 light;
#ifdef EXPLICIT_ATTRIB_LOCATION #ifdef EXPLICIT_ATTRIB_LOCATION
layout(location = 0) in highp vec4 position; layout(location = 0) in highp vec4 position;
layout(location = 1) in mediump vec3 normal; layout(location = 2) in mediump vec3 normal;
#else #else
in highp vec4 position; in highp vec4 position;
in mediump vec3 normal; in mediump vec3 normal;
@ -49,7 +49,7 @@ in mediump vec3 normal;
#ifdef TEXTURED #ifdef TEXTURED
#ifdef EXPLICIT_ATTRIB_LOCATION #ifdef EXPLICIT_ATTRIB_LOCATION
layout(location = 2) in mediump vec2 textureCoords; layout(location = 1) in mediump vec2 textureCoords;
#else #else
in mediump vec2 textureCoords; in mediump vec2 textureCoords;
#endif #endif

Loading…
Cancel
Save