Advertisement Jump to content
Sign in to follow this  


This topic is 3837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a project that uses point sprites as rendering primitives. I want to manipulate output using vertex and fragment programs and can't seem to get them working together properly. So far the only thing I get are normal points, which are not even of appropriate size according to distance. They are just small dots, as if I wasn't using point sprites. Shaders are very simple, they do not change anything for now. I am using only aplha channel of texture for rendering point sprites. Gl.glEnable(Gl.GL_BLEND); Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA); float[] mat = new float[16]; Gl.glPointSize(60); Gl.glTranslatef(ViewerPosition.x, ViewerPosition.y, ViewerPosition.z - 100); SetShaderParameters(); EnableShaders(); float[] quadratic = { 1, 0f, 0.01f }; Gl.glPointParameterfvARB(Gl.GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic); Gl.glPointParameterfARB(Gl.GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f); float maxSize = 0.0f; Gl.glGetFloatv(Gl.GL_POINT_SIZE_MAX_ARB, out maxSize); Gl.glPointParameterfARB(Gl.GL_POINT_SIZE_MIN_ARB, 1.0f); Gl.glPointParameterfARB(Gl.GL_POINT_SIZE_MAX_ARB, maxSize); Gl.glTexEnvf(Gl.GL_POINT_SPRITE_ARB, Gl.GL_COORD_REPLACE_ARB, Gl.GL_TRUE); Gl.glEnable(Gl.GL_POINT_SPRITE_ARB); Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture[0]); Gl.glDepthMask(Gl.GL_FALSE); // Track the combined model-view-projection matrix CgGl.cgGLSetStateMatrixParameter(m_CGparam_modelViewProj, CgGl.CG_GL_MODELVIEW_PROJECTION_MATRIX, CgGl.CG_GL_MATRIX_IDENTITY); checkForCgError("setting state matrix parameter"); Gl.glGetFloatv(Gl.GL_MODELVIEW_MATRIX, mat); Vector3f vRight = new Vector3f(mat[0], mat[4], mat[8]); Vector3f vUp = new Vector3f(mat[1], mat[5], mat[9]); Vector3f vCenter = new Vector3f(0.0f, 0.0f, 0.0f); //render Gl.glColor3f(1, 1, 0); Point3D centerPoint = new Point3D(25, -25, 0); Gl.glBegin(Gl.GL_POINTS); Gl.glVertex3f(centerPoint.x - 25, centerPoint.y - 25, 0); Gl.glVertex3f(centerPoint.x + 25, centerPoint.y - 25, 0); Gl.glVertex3f(centerPoint.x + 25, centerPoint.y + 25, 0); Gl.glVertex3f(centerPoint.x - 25, centerPoint.y + 25, 0); Gl.glEnd(); Gl.glPopMatrix(); //Gl.glCallList(lidarDisplList); Gl.glDepthMask(Gl.GL_TRUE); Gl.glDisable(Gl.GL_POINT_SPRITE_ARB); DisableShaders();

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!