Is Geometry shader not work with GL3?

Takaaki Sone's icon

Hi everyone.

I started using jitter with gl3.
But, jit.gl.shader is not work .
When I creat jit.gl.shader and save that shader, The text below is output on MaxConsole.

jit.gl.mesh: jit_gl_geometry_draw_buffers: GL Error: Invalid operation

I can use jit.gl.shader, if i delete geometry shader in my shader.
But, gl3 sample is working with geometry. ex Billbord example.

What's happened?
Anybody knows how I do it?

Thanks.

Rob Ramirez's icon

zip up the shader and the patch and post it here and i'll take a look

Takaaki Sone's icon

ROB

Thank you for your reply .
This is zip and video that reproduces the situation.

At first, there is no problem, but saving the shader gives an error.

Thank you.

sample4_drawCircle_shader.zip
application/x-zip-compressed 3.35 KB

Rob Ramirez's icon

Ok, not sure what's going on here but I can reproduce and will investigate.

Takaaki Sone's icon

Thank you very much.
I look forward to your reply.

Jim Bastow's icon

I'm experiencing the same issue. Any progress on this bug?

Rob Ramirez's icon

looking at this more closely I am not seeing a bug, but the patch is not properly setup (the mesh is set to draw_mode points, but the shader is expecting lines_adjacency). if there's some indication of what you are trying to achieve I might be able to advise.

Jim Bastow's icon

Hi Rob, i'm experiencing the issue when using only gl.gridshape, not gl.mesh.

As soon as the default shader is saved the geometry disappears and I receive this message in the console:

jit.gl.gridshape: jit_gl_geometry_draw_buffers: GL Error: Invalid operation

Max Patch
Copy patch and select New From Clipboard in Max.

Jim Bastow's icon

Oh and here's the default shader in case you need it.

shader_test.jxs
jxs 1.71 KB

Rob Ramirez's icon

that's only the default shader if @gridmode is 0 (quadgrid). if you set @gridmode 0 on your gridshape that shader should work. for the default jit.gl.gridshape (@gridmode 1 - trigrid) this is the default shader:

<jittershader name="fill-flat-triangles">
    <description>
        An auto-generated shader for simulating deprecated OpenGL features in OpenGL 3.2+
    </description>
    <param name="position" type="vec3" state="POSITION" />
    <param name="modelViewProjectionMatrix" type="mat4" state="MODELVIEW_PROJECTION_MATRIX" />
    <param name="color" type="vec4" state="COLOR" />
    <language name="glsl" version="1.5">
        <bind param="position" program="vp" />
        <bind param="modelViewProjectionMatrix" program="vp" />
        <bind param="color" program="vp" />
        <program name="vp" type="vertex">
            <![CDATA[
// Preprocessor
#version 330 core
// Definitions
// Uniforms
uniform mat4 modelViewProjectionMatrix;
// Attributes
in vec3 position;
in vec4 color;
// Output
out jit_PerVertex {
    flat vec4 color;
} jit_out;
// Library functions
void main() {    
    gl_Position = modelViewProjectionMatrix * vec4(position, 1.);    
    jit_out.color = color;
}
]]>
        </program>
        <program name="fp" type="fragment">
            <![CDATA[
#version 330 core

in jit_PerVertex {
    flat vec4 color;
} jit_in;
out vec4 color;
void main() {
    color = jit_in.color;
}    

]]>
        </program>
    </language>
</jittershader>
Jim Bastow's icon

Ah I had no idea about the @gridmode attribute. Thanks!