VBO/point sprites/alpha

Started by
3 comments, last by m_power_hax 13 years, 4 months ago
Hi,

Huge thanks for your help in my other threads guys. I have another question, this time i'm trying to put some alpha values on the color of the point sprites the code is generating with a VBO. Here the code for the VBO:
	glEnable(GL_BLEND);	glBlendFunc(GL_SRC_ALPHA, GL_ONE);        glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboId);        glEnableClientState(GL_NORMAL_ARRAY);        glEnableClientState(GL_COLOR_ARRAY);        glEnableClientState(GL_VERTEX_ARRAY);        	glNormalPointer(GL_FLOAT, 0, (void*)sizeof(vertices));        	glColorPointer(3, GL_FLOAT, 0, (void*)(sizeof(vertices)+sizeof(normals)));        	glVertexPointer(3, GL_FLOAT, 0, 0);		float quadratic[] =  {1.0f, 0.0f, 0.01f};		glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );		float maxSize = 0.0f;		glGetFloatv(GL_POINT_SIZE_MAX_ARB, &maxSize );		if(maxSize > 100.0f)			maxSize = 100.0f;		glPointSize(maxSize);		glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f);		glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, 1.0f);		glPointParameterfARB(GL_POINT_SIZE_MAX_ARB, maxSize);				glEnable(GL_POINT_SPRITE_ARB);			glDrawArrays(GL_POINTS, 0, numPoints);		glDisable(GL_POINT_SPRITE_ARB);        glDisableClientState(GL_VERTEX_ARRAY);        glDisableClientState(GL_COLOR_ARRAY);        glDisableClientState(GL_NORMAL_ARRAY);        glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);	glDisable(GL_BLEND);


I tried using the GL_BLEND function, and it worked. But the alpha is not working correctly in all direction. I would like to know if it is the right way of doing it or should i load the alpha from a shader?
Advertisement
You need to ask more specific questions, it's not clear at all what you're trying to do with that code. Nobody knows what "is not working correctly from all directions" means. I don't see any alpha values anywhere in your code, so I have no idea where you're getting these values from or how you intend to use them.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
glColorPointer(3, GL_FLOAT, 0, (void*)(sizeof(vertices)+sizeof(normals)));

The 3 means 3 components (RBG), if you use 4 then its (RGBA). Does your array have rgba, or rgb?

Standard blending is glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Quote:Original post by karwosts
You need to ask more specific questions, it's not clear at all what you're trying to do with that code. Nobody knows what "is not working correctly from all directions" means. I don't see any alpha values anywhere in your code, so I have no idea where you're getting these values from or how you intend to use them.


glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

this do the alpha for all point sprites. For now the point sprite are white or black. When they are black, the alpha make them invisible. When turning around the cube of white point sprites rendered, they are not drawed for a certain angle.


Quote:Original post by dpadam450
glColorPointer(3, GL_FLOAT, 0, (void*)(sizeof(vertices)+sizeof(normals)));

The 3 means 3 components (RBG), if you use 4 then its (RGBA). Does your array have rgba, or rgb?

Standard blending is glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


That's probably it. I'll have to call the glColorPointer with a 4 components. I'll try that, thanks!

This topic is closed to new replies.

Advertisement