mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
Merge pull request #5481 from samcake/punk
GL CORE PROFILE:Fixing a few shader and enableing the INput core profile that breaks on mac
This commit is contained in:
commit
c4d353e3af
10 changed files with 64 additions and 59 deletions
|
@ -11,13 +11,13 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
uniform sampler2D colorMap;
|
uniform sampler2D colorMap;
|
||||||
uniform vec4 color;
|
uniform vec4 color;
|
||||||
|
|
||||||
in vec2 varTexcoord;
|
in vec2 varTexCoord0;
|
||||||
out vec4 outFragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
outFragColor = texture(colorMap, varTexcoord) * color;
|
outFragColor = texture(colorMap, varTexCoord0) * color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,27 +13,27 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
uniform vec4 texcoordRect;
|
uniform vec4 texcoordRect;
|
||||||
|
|
||||||
out vec2 varTexcoord;
|
out vec2 varTexCoord0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
const vec4 UNIT_QUAD[4] = vec4[4](
|
||||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
vec4(-1.0, -1.0, 0.0, 1.0),
|
||||||
vec4(1.0, -1.0, 0.0, 1.0),
|
vec4(1.0, -1.0, 0.0, 1.0),
|
||||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
vec4(-1.0, 1.0, 0.0, 1.0),
|
||||||
vec4(1.0, 1.0, 0.0, 1.0)
|
vec4(1.0, 1.0, 0.0, 1.0)
|
||||||
);
|
);
|
||||||
vec4 pos = UNIT_QUAD[gl_VertexID];
|
vec4 pos = UNIT_QUAD[gl_VertexID];
|
||||||
|
|
||||||
// standard transform
|
// standard transform
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
||||||
|
|
||||||
varTexcoord = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy;
|
varTexCoord0 = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
uniform sampler2D colorMap;
|
uniform sampler2D colorMap;
|
||||||
|
|
||||||
in vec2 varTexcoord;
|
in vec2 varTexCoord0;
|
||||||
out vec4 outFragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
outFragColor = texture(colorMap, varTexcoord);
|
outFragColor = texture(colorMap, varTexCoord0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
uniform sampler2D colorMap;
|
uniform sampler2D colorMap;
|
||||||
|
|
||||||
in vec2 varTexcoord;
|
in vec2 varTexCoord0;
|
||||||
out vec4 outFragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
outFragColor = vec4(texture(colorMap, varTexcoord).xyz, 1.0);
|
outFragColor = vec4(texture(colorMap, varTexCoord0).xyz, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,25 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
out vec2 varTexcoord;
|
out vec2 varTexCoord0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
const vec4 UNIT_QUAD[4] = vec4[4](
|
||||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
vec4(-1.0, -1.0, 0.0, 1.0),
|
||||||
vec4(1.0, -1.0, 0.0, 1.0),
|
vec4(1.0, -1.0, 0.0, 1.0),
|
||||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
vec4(-1.0, 1.0, 0.0, 1.0),
|
||||||
vec4(1.0, 1.0, 0.0, 1.0)
|
vec4(1.0, 1.0, 0.0, 1.0)
|
||||||
);
|
);
|
||||||
vec4 pos = UNIT_QUAD[gl_VertexID];
|
vec4 pos = UNIT_QUAD[gl_VertexID];
|
||||||
|
|
||||||
// standard transform
|
// standard transform
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
||||||
|
|
||||||
varTexcoord = (pos.xy + 1) * 0.5;
|
varTexCoord0 = (pos.xy + 1) * 0.5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
out vec2 varTexcoord;
|
out vec2 varTexCoord0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
const vec4 UNIT_QUAD[4] = vec4[4](
|
||||||
|
@ -34,5 +34,5 @@ void main(void) {
|
||||||
<$transformModelToWorldPos(obj, tc, tc)$>
|
<$transformModelToWorldPos(obj, tc, tc)$>
|
||||||
|
|
||||||
gl_Position = pos;
|
gl_Position = pos;
|
||||||
varTexcoord = tc.xy;
|
varTexCoord0 = tc.xy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,10 @@ void GLBackend::do_setInputBuffer(Batch& batch, uint32 paramOffset) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NOT_SUPPORT_VAO
|
#if (GPU_FEATURE_PROFILE == GPU_CORE)
|
||||||
|
#define SUPPORT_VAO
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_VAO)
|
#if defined(SUPPORT_VAO)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -95,8 +98,10 @@ void GLBackend::killInput() {
|
||||||
|
|
||||||
void GLBackend::syncInputStateCache() {
|
void GLBackend::syncInputStateCache() {
|
||||||
#if defined(SUPPORT_VAO)
|
#if defined(SUPPORT_VAO)
|
||||||
for (int i = 0; i < NUM_CLASSIC_ATTRIBS; i++) {
|
for (int i = 0; i < _input._attributeActivation.size(); i++) {
|
||||||
_input._attributeActivation[i] = glIsEnabled(attributeSlotToClassicAttribName[i]);
|
GLint active = 0;
|
||||||
|
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &active);
|
||||||
|
_input._attributeActivation[i] = active;
|
||||||
}
|
}
|
||||||
//_input._defaultVAO
|
//_input._defaultVAO
|
||||||
glBindVertexArray(_input._defaultVAO);
|
glBindVertexArray(_input._defaultVAO);
|
||||||
|
|
|
@ -19,8 +19,8 @@ uniform sampler2D originalTexture;
|
||||||
|
|
||||||
// the interpolated normal
|
// the interpolated normal
|
||||||
in vec3 _normal;
|
in vec3 _normal;
|
||||||
in vec4 _texCoord0;
|
in vec3 _color;
|
||||||
in vec4 _color;
|
in vec2 _texCoord0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||||
|
|
|
@ -14,18 +14,18 @@
|
||||||
// the texture
|
// the texture
|
||||||
uniform sampler2D colorMap;
|
uniform sampler2D colorMap;
|
||||||
|
|
||||||
in vec3 _position;
|
in vec3 varPosition;
|
||||||
in vec3 _normal;
|
in vec3 varNormal;
|
||||||
in vec2 _texCoord0;
|
in vec2 varTexCoord0;
|
||||||
in vec4 _color;
|
in vec4 varColor;
|
||||||
|
|
||||||
out vec4 _fragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 color = texture(colorMap, _texCoord0);
|
vec4 color = texture(colorMap, varTexCoord0);
|
||||||
// FIXME CORE this isn't working
|
// FIXME CORE this isn't working
|
||||||
//_fragColor = color * _color;
|
//_fragColor = color * _color;
|
||||||
//_fragColor = vec4(color.rgb, color.a * _color.a);
|
//_fragColor = vec4(color.rgb, color.a * _color.a);
|
||||||
//_fragColor = vec4(color.rgb * _color.rgb, color.a);
|
//_fragColor = vec4(color.rgb * _color.rgb, color.a);
|
||||||
_fragColor = color;
|
outFragColor = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
out vec3 _position;
|
out vec3 varPosition;
|
||||||
out vec3 _normal;
|
out vec3 varNormal;
|
||||||
out vec2 _texCoord0;
|
out vec2 varTexCoord0;
|
||||||
out vec4 _color;
|
out vec4 varColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
_texCoord0 = inTexCoord0.st;
|
varTexCoord0 = inTexCoord0.st;
|
||||||
_color = inColor;
|
varColor = inColor;
|
||||||
|
|
||||||
// standard transform
|
// standard transform
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
||||||
<$transformModelToEyeDir(cam, obj, inNormal.xyz, _normal)$>
|
<$transformModelToEyeDir(cam, obj, inNormal.xyz, varNormal)$>
|
||||||
_position = inPosition.xyz;
|
varPosition = inPosition.xyz;
|
||||||
}
|
}
|
Loading…
Reference in a new issue