summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorRay <[email protected]>2022-07-04 17:47:47 +0200
committerRay <[email protected]>2022-07-04 17:47:47 +0200
commitc6c71fe73c897981c2ddfb40dd82cc09c61f8aff (patch)
tree8a32fee110dd5ef795dbdeccb1e53d534a074729 /examples
parent850321cf2b8b8af8a645666b5bfa758057cf8258 (diff)
downloadraylib-c6c71fe73c897981c2ddfb40dd82cc09c61f8aff.tar.gz
raylib-c6c71fe73c897981c2ddfb40dd82cc09c61f8aff.zip
REVIEWED: `DrawMesh()` #2511
Disable color vertex attribute if not provided by mesh
Diffstat (limited to 'examples')
-rw-r--r--examples/shaders/resources/shaders/glsl330/lighting.fs2
-rw-r--r--examples/shaders/resources/shaders/glsl330/lighting_instancing.vs4
-rw-r--r--examples/shaders/shaders_mesh_instancing.c7
3 files changed, 7 insertions, 6 deletions
diff --git a/examples/shaders/resources/shaders/glsl330/lighting.fs b/examples/shaders/resources/shaders/glsl330/lighting.fs
index 93be20ed..58845c86 100644
--- a/examples/shaders/resources/shaders/glsl330/lighting.fs
+++ b/examples/shaders/resources/shaders/glsl330/lighting.fs
@@ -3,7 +3,7 @@
// Input vertex attributes (from vertex shader)
in vec3 fragPosition;
in vec2 fragTexCoord;
-in vec4 fragColor;
+//in vec4 fragColor;
in vec3 fragNormal;
// Input uniform values
diff --git a/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs b/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs
index 7f16dc62..6775a2eb 100644
--- a/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs
+++ b/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs
@@ -4,7 +4,7 @@
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
-in vec4 vertexColor;
+//in vec4 vertexColor; // Not required
in mat4 instanceTransform;
@@ -28,7 +28,7 @@ void main()
// Send vertex attributes to fragment shader
fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
- fragColor = vertexColor;
+ //fragColor = vertexColor;
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
// Calculate final vertex position
diff --git a/examples/shaders/shaders_mesh_instancing.c b/examples/shaders/shaders_mesh_instancing.c
index c1e48c02..08618d6e 100644
--- a/examples/shaders/shaders_mesh_instancing.c
+++ b/examples/shaders/shaders_mesh_instancing.c
@@ -19,7 +19,6 @@
#include "rlights.h"
#include <stdlib.h> // Required for: calloc(), free()
-#include <math.h> // Required for:
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
@@ -27,7 +26,7 @@
#define GLSL_VERSION 100
#endif
-#define MAX_INSTANCES 8000
+#define MAX_INSTANCES 10000
//------------------------------------------------------------------------------------
// Program main entry point
@@ -87,7 +86,9 @@ int main(void)
matInstances.shader = shader;
matInstances.maps[MATERIAL_MAP_DIFFUSE].color = RED;
- // Create a defult material with default internal shader for non-instanced mesh drawing
+ // Load default material (using raylib intenral default shader) for non-instanced mesh drawing
+ // WARNING: Default shader enables vertex color attribute BUT GenMeshCube() does not generate vertex colors, so,
+ // when drawing the color attribute is disabled and a default color value is provided as input for thevertex attribute
Material matDefault = LoadMaterialDefault();
matDefault.maps[MATERIAL_MAP_DIFFUSE].color = BLUE;