Greetings!
I’m struggling getting my particle shaders to work. Particularly, I do not know how to set …
… GL_VERTEX_PROGRAM_POINT_SIZE_ARB …
… 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.
Google yields two links. With this thread, soon three.
import direct.directbase.DirectStart
from pandac.PandaModules import *
model = loader.loadModel('Any will do')
model.setRenderMode(RenderModeAttrib.MPoint, 50)
#model.setRenderModePerspective(1)
model.setTexGen(TextureStage.getDefault(), TexGenAttrib.MPointSprite)
model.setShader(Shader.load(Shader.SL_GLSL, vertex="sphere.vert", fragment="sphere.frag"))
model.reparentTo(render)
#render.setRenderModePerspective(1)
run()
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!