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
Hi liujun,
It looks like you have misunderstood the basic concepts of OpenGL ES.
May I recommend looking at the Open GL ES SDKs we have on our website? We have a version for both Linux as well as Android, and they can be run either on a real device, or on your desktop by using our OpenGL ES Emulator.
They go through the basics such as rendering a simple triangle.
If after you have gone through the SDK and are still having problems, please get back to us and we will try help in any way we can.
Kind Regards,
Michael McGeagh