/** * Initializes EGL and OpenGL for use by this tile engine. */ bool GLTileEngine::initGL() { // make the context current if(!this->platform->makeCurrent()) { printf("MakeCurrent returned false\n"); return false; } glEnable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glDisable(GL_BLEND); glDisable(GL_DITHER); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); if(checkGLError()) printf("\n"); if(!loadTexture()) { checkGLError(); return false; } // initialize overlay texture glGenTextures(1, &this->overlayTexture); glBindTexture(GL_TEXTURE_2D, this->overlayTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); genTexCoords(); if(!this->sprites.loadSprites()) { printf("Failed to load one or more sprites\n"); return false; } checkGLError(); return true; }
float* getTexCoords(int segment) { top = getTop(segment); left = getLeft(segment); genTexCoords() ; return & texcoords[0]; }