This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to set triangle Vertices with opengl ES 2.0  ???

my screen is 1920 * 1080, i want draw a cover on screen,

but  triangle  pionter array only can be set -1 to 1,   can not 1 to 1920 or 1080,

if i set 1 to 1920 or 1080,  its to big cover the sceen....

i want to set pointer array accordding the screen width or height  (1920 or 1080 ) ....

//poor english

//sample code

// create shader   program ...........

// const GLfloat triangleVertices[] = { -1, -1, 1, -1, 1, 1, -1, 1};    //eg 2

const GLfloat triangleVertices[] = { 1, 1, 1920, 1, 1920, 1080, 1, 1080};  //eg 2

const GLfloat triangleColor[] = { 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1};

glVertexAttribPointer(vPositionHandle, 2, GL_FLOAT, GL_TRUE, 0, triangleVertices);

glEnableVertexAttribArray(vPositionHandle);

glVertexAttribPointer(vColorHandle, 4, GL_FLOAT, GL_TRUE, 0, triangleColor);

glEnableVertexAttribArray(vColorHandle);

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);//GL_TRIANGLES

0