I’m struggling getting my particle shaders to work. Particularly, I do not know how to set …
… because I don’t know how to find the information relevant to Panda3D.

The shader code works with other libraries. I don’t know what I’m missing …
… and I don’t know how to find the information I need to change that flag. :confused:

Google yields two links. With this thread, soon three. :slight_smile:

import direct.directbase.DirectStart
from pandac.PandaModules import *

model = loader.loadModel('Any will do')
model.setRenderMode(RenderModeAttrib.MPoint, 50)

model.setTexGen(TextureStage.getDefault(), TexGenAttrib.MPointSprite)
model.setShader(Shader.load(Shader.SL_GLSL, vertex="sphere.vert", fragment="sphere.frag"))


Changing the RenderModePerspectives yields no change.
I might or might not misunderstand what they are usually used for.

#version 330

layout(location = 0)in vec4 p3d_Vertex;

uniform mat4 p3d_ModelViewProjectionMatrix;
uniform mat4 p3d_ProjectionMatrix;
uniform mat4 p3d_ModelMatrix;
uniform mat4 p3d_ViewMatrix;

varying vec4  eye;

void main()

    int side= 5;

    eye = p3d_ViewMatrix * p3d_ModelMatrix * vec4(p3d_Vertex.xyz,1.0);

    float dist = length(eye.xyz);

    vec4  corner = p3d_ProjectionMatrix * vec4(side, side, eye.z, eye.w);

    gl_PointSize = 512.0 * corner.x / corner.w;
    gl_Position = p3d_ProjectionMatrix * eye;   

This is just a crappy base example displaying my issue.
I need to be able to modify the gl_PointSize within my vertex shader.

Can you tell me how?

Thanks! :slight_smile:

This state is controlled by setRenderModeThickness in Panda (which, incidentally, is bugged in 1.9.0). I wasn’t aware of the existence of GL_VERTEX_PROGRAM_POINT_SIZE. This seems like something I could (and should) easily add to Panda. I’ll get back to you about this.

Thanks, mate! I’ll wait! :slight_smile:

Okay, this issue has finally been solved thanks to rdb,
who pointed out that I absolutely can do OpenGL calls in a way I would have never thought of!

All it needs to do OpenGL calls, like setting flags or vertices etc, is installing a callback!
Of course pyopengl has to be installed.

from OpenGL.GL import *                       # PyOpenGL
from pandac.PandaModules import *         # needed for the callback

def initGL(cbdata):

cbnode = CallbackNode('cbnode')
cbnp = render.attachNewNode(cbnode)

You have to issue a clearDrawCallback, else initGL will get called every frame.
Unless, of course, you specifically want that to happen.