Hello!
I've recently been trying to get started with GLES and created a project, following the Jon's Teapot tutorial. I managed to get a window created without a problem. I have since tried to draw a simple vertex array to test it out and so far I don't get any primitives rendered, just the same window; it is glClearColor'd so I guess GL is functioning somewhat. My inherited window looks like this:
#include "MyWindow.h"
#include <iostream>
#include <stdlib.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
GLfloat square[] = {0.25, 0.25, 0.0,
0.75, 0.25, 0.0,
0.25, 0.75, 0.0, //global for quick test
0.75, 0.75, 0.0};
void MyWindow :: initGL()
{
glClearColor(0.0f,0.0f,0.0f,0.5f); //initialising clear colour
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glVertexPointer(3, GL_FLOAT, 0, square); //point to vert array
glEnableClientState(GL_VERTEX_ARRAY); //enable vert array
}
void MyWindow ::display()
{
glClearColor(1.0f,0.0f,0.0f,1.0f); //setting clear colour
glClear( GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
swapBuffers();
}
I've tried adding extra gl commands (viewport, cull-face etc.) but none seem to do the trick, the current vertex array and ortho projection is from an example after thinking mine was wrong. I've been reading for the past few hours trying to find similar issues, I came across something about conflicting gl libraries, but I only have the .a and .so files of libEGL and libGLESv1, as well as the lib for bcm_host (I'm very new to Linux stuff!) linked into Code::Blocks IDE.
I could be missing something incredibly obvious but I've been looking at it so long now I'm not sure! Any advice would be appreciated; I'm hoping it's at least an interesting problem.