Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid operation when specifying p3d_Color uniform as vec4 #1601

Closed
el-dee opened this issue Jan 21, 2024 · 0 comments
Closed

Invalid operation when specifying p3d_Color uniform as vec4 #1601

el-dee opened this issue Jan 21, 2024 · 0 comments

Comments

@el-dee
Copy link
Contributor

el-dee commented Jan 21, 2024

Description

Using latest master commit, 9517ffb, the glgsg throws an Illegal operation error when the uniform p3d_Color is specified as vec4 in GLSL code. Specifying it as vec3 is fine though

Using p3d_Color as vec4 works with 1.10.x and older version of the master branch

Steps to Reproduce

from panda3d.core import  CardMaker, Shader, PandaSystem, load_prc_file_data
from direct.showbase.ShowBase import ShowBase

print("Panda version: %s (%s) by %s (%s)" % (PandaSystem.getVersionString(),
                                             PandaSystem.getGitCommit(),
                                             PandaSystem.getDistributor(),
                                             PandaSystem.getBuildDate()))

load_prc_file_data("", "gl-check-errors #t")

def shader():
    return Shader.make(Shader.SL_GLSL,
                       vertex="""
#version 410

uniform mat4 p3d_ProjectionMatrix;
uniform mat4 p3d_ModelViewMatrix;

uniform vec4 p3d_Color;
//uniform vec3 p3d_Color;


in vec4 p3d_Vertex;
out vec4 color;

void main() {
    gl_Position = p3d_ProjectionMatrix * (p3d_ModelViewMatrix * p3d_Vertex);
    color = p3d_Color;
    //color = vec4(p3d_Color, 1);
}
""",
                       fragment="""
#version 410

in vec4 color;
out vec4 frag_color;

void main() {
    frag_color = color;
}
""")


base = ShowBase()
cm = CardMaker('card')
card = base.render.attach_new_node(cm.generate())
card.setPos(-0.5, 3, -0.5)
card.set_color((1, 0, 1, 1))
card.set_shader(shader())

base.run()

The output is

Panda version: 1.11.0 (9517ffb320fbd30f401e1550c6413a25f355e273) by cosmonium (Jan 20 2024 11:32:58)
Known pipe types:
  glxGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(error): at 2338 of panda/src/glstuff/glShaderContext_src.cxx : invalid operation

Environment

  • Operating system: Ubuntu
  • System architecture: x86_64
  • Panda3D version: master : 9517ffb
  • Installation method: Built from source
  • Python version (if using Python): 3.8
  • Compiler (if using C++): N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants