2012-03-01 3 views
0

J'utilise gl_points comme sprites, quand les points atteignent la limite de l'écran, ils disparaissent, le problème est que mes points sont plus grands que 1 pixel, donc ils disparaissent quand la moitié du point est reliée, je suppose qu'il y est une sorte d'abattage activé pour supprimer les points qui sont hors écran, la question est de savoir comment l'éteindre.OpenGLES 2.0 GL_POINTS disparaissent

+0

l'augmentation de la fenêtre aide dans ce cas :) – ZZZ

Répondre

-2

L'augmentation de la taille de la fenêtre aide, ou vous pouvez le rendre à la texture et zoomez :)

1
GLES20Renderer.programLight = GLES20.glCreateProgram(); 
    int vertexShaderLight  = GLES20Renderer.loadShader(GLES20.GL_VERTEX_SHADER, GLES20Renderer.vertexShaderCodeLight); 
    int fragmentShaderLight  = GLES20Renderer.loadShader(GLES20.GL_FRAGMENT_SHADER, GLES20Renderer.fragmentShaderCodeLight); 
    GLES20.glAttachShader(GLES20Renderer.programLight, vertexShaderLight); 
    GLES20.glAttachShader(GLES20Renderer.programLight, fragmentShaderLight); 
    GLES20.glLinkProgram(GLES20Renderer.programLight); 
    uPLocationLight    = GLES20.glGetUniformLocation(GLES20Renderer.programLight, "uP"); 
    uVPositionLocationLight  = GLES20.glGetUniformLocation(GLES20Renderer.programLight, "uVPosition"); 

    GLES20.glUseProgram(GLES20Renderer.programLight); 
    GLES20.glUniform4f(uVPositionLocationLight, LightPosInEyeSpace[0], LightPosInEyeSpace[1], LightPosInEyeSpace[2], LightPosInEyeSpace[3]); 
    GLES20.glUniformMatrix4fv(uPLocationLight, 1, false, ProjectionMatrix, 0); 
    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 1); 


private static final String vertexShaderCodeLight = 
     "uniform vec4 uVPosition;     \n" 
    + "uniform mat4 uP;       \n" 
    + "void main(){        \n" 
    + " gl_PointSize = 15.0;      \n" 
    + " gl_Position = uP * uVPosition;   \n" 
    + "}           \n"; 
private static final String fragmentShaderCodeLight = 
     "#ifdef GL_FRAGMENT_PRECISION_HIGH   \n" 
    + "precision highp float;      \n" 
    + "#else          \n" 
    + "precision mediump float;     \n" 
    + "#endif          \n" 
    + "void main(){        \n" 
    + " gl_FragColor = vec4(1.0,1.0,1.0,1.0);  \n" 
    + "}           \n"; 
0

GL_POINTS sont tronquées au centre. C'est juste une limitation de GL_POINTS. Si vous ne pouvez pas vivre avec cela, utilisez simplement des quads réguliers (en supposant que la performance peut y faire face)

+0

je sais, c'est pourquoi j'ai augmenté la taille de la fenêtre, donc c'est plus grand de deux points en x et y et les points sont rendus bien maintenant – ZZZ

Questions connexes