Per point size with a vbo

Hi,
I want to draw particles with individual point sizes. If I’m not completly mistaken I can set the individual point size only in a vertex shader where I can set the gl_PointSize so some value. Since I do not (yet) want to use sprites I only can use integer values. Is that correct?
Unfortnately I seem to miss something important here because I’m compeltely unable to archive the desired result.
What I expect is to get a random distribution of points with a white color with a random pixelsize between 0 and 5. But what I get is one (or 1000, not sure) pixel in the middle of the screen. At least the color is correct because the pixel is white and not red what means that my shaders are used. To me it seems as if the positions or the view matrix produces only zero values, but the positions seem to be okay. I’d really appreciate any hints.

This is my code:

#include "ofApp.h"

#define NUMPOINTS 1000
ofShader shader;
ofVbo vbo;
std::vector<ofVec3f> pos(NUMPOINTS);
std::vector<float> pscale(NUMPOINTS);

void ofApp::setup(){
	ofSetLogLevel(OF_LOG_VERBOSE);
	ofLogToConsole();

	for (int i = 0; i < NUMPOINTS; i++)
	{
		pos[i] = ofVec3f(ofRandom(ofGetWidth()), ofRandom(ofGetHeight()));
		pscale[i] = ofRandom(5.0f);
	}
	vbo.setVertexData(&pos[0], NUMPOINTS, GL_DYNAMIC_DRAW);

	shader.load("shader");
	shader.begin();
	int pointAttLoc = shader.getAttributeLocation("pointSize");
	vbo.setAttributeData(pointAttLoc, &pscale[0], 1, NUMPOINTS, GL_DYNAMIC_DRAW);
	shader.end();
}

void ofApp::update(){}

void ofApp::draw(){
	ofClear(0.0f);
	ofSetColor(255, 0, 0);
	shader.begin();
	vbo.draw(GL_POINTS, 0, NUMPOINTS);
	shader.end();
}

And these are my vertex…

#version 150

uniform mat4 modelViewProjectionMatrix;
in vec4 position;
in float pointSize;

void main()
{
    gl_Position = modelViewProjectionMatrix * position;
	gl_PointSize = pointSize;
}

and fragment shaders:
#version 150

out vec4 outputColor;

void main()
{
    outputColor = vec4(1.0, 1.0, 1.0, 1.0);
}

Okay, after some testing, I could find out that I have to setup open gl in the main.cpp correctly, it seems not to work with the default ofSetupOpenGL(1024,768, OF_WINDOW);. Now I get particles, but I only get differently scaled points if I do an ofEnablePointSprites(). With default particles I only can set uniform size with glPointSize().

:+1: exactly what I was looking for, thank you!