clop
Member
- Joined
- Aug 17, 2010
- Messages
- 176
Hi fellow developers,
Here's a question for you. I'm just starting to experiment with openGL and I've understood that GLES1 was a subset of GL1, and that a working GLES1 code would work with a "standard" openGL.
But my experiments proved me wrong. So, am I right? Is my experiment right? Please, help me
My experiment: Drawing a single coloured triangle.
Relevant code:
For openGL, I use SDL with flag SDL_OPENGL flag, for openGLES I use EGL.
Result are attached, first one is openGL and second and correct one (I guess) is openGLES rendering.
Here's a question for you. I'm just starting to experiment with openGL and I've understood that GLES1 was a subset of GL1, and that a working GLES1 code would work with a "standard" openGL.
But my experiments proved me wrong. So, am I right? Is my experiment right? Please, help me
My experiment: Drawing a single coloured triangle.
Relevant code:
Code:
#if !defined(HAVE_GLES)
#define GLfloat GLdouble
#define GL_CLAMP_TO_EDGE GL_CLAMP
#define glClearDepthf glClearDepth
#define glOrthof glOrtho
#endif
GLfloat triangle[] = {
0.125f, 0.125f, 0.0f,
0.75f, 0.125f, 0.0f,
0.125f, 0.75f, 0.0f
};
GLfloat colors[] = {
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 1.0f, 0.0f, 1.0f,
1.0f, 0.0f, 0.0f, 1.0f
};
void initGL()
{
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
glShadeModel(GL_SMOOTH);
}
void drawTriangle(GLfloat *vertices, GLfloat *color)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, 0, color);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
}
For openGL, I use SDL with flag SDL_OPENGL flag, for openGLES I use EGL.
Result are attached, first one is openGL and second and correct one (I guess) is openGLES rendering.
Last edited by a moderator: