Displaying an image in android using SDL2 and OPENGL es2 library

I’m trying to display an image in Android using SDL2 and GLES2 library,can anyone suggest some links or tutorial which uses these features to do the same?

      • Updated - - -

Here is the code till what i had done:

#include <SDL.h>
#include <SDL_opengles2.h>
#include <stdio.h>
#include <android/log.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define RESOLUTION_WDT 1280
#define RESOLUTION_HT 720
int reinitiate=0;
#define LOGD(…) __android_log_print(ANDROID_LOG_DEBUG, “Testing”, VA_ARGS)

int main(int argc, char *argv[]) {

SDL_Window	*window=0;
SDL_GLContext	maincontext=0;
SDL_Surface	*image=NULL;
SDL_Renderer	*renderer;

if (SDL_Init(SDL_INIT_EVERYTHING)) {
	LOGD( "Could not initialize SDL - %s

“, SDL_GetError());
SDL_Quit();
exit(1);
}
LOGD(” SDL Initialized…");
//OPENGL intialization:-
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,24);
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,1);
//SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT,0);
//window
window = SDL_CreateWindow(“Image TEST”,SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,0,0,SDL_WINDOW_FULLSCREEN|SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
if(window==NULL)
{
LOGD(“Could not create Window”);
return 0;
}
LOGD(“SDL Window Created sucessfully”);
maincontext=SDL_GL_CreateContext(window);
if(maincontext==NULL)
{
LOGD(“GL content created Failure”);
return 0;
}
LOGD(“GL content created successfully”);

if(SDL_GL_MakeCurrent(window,maincontext)&lt;0)
{
	LOGD("Not able to make current window as context 				window");
	return 0;
}
LOGD("Current window set");
image = SDL_LoadBMP("image.jpeg");
 if(image==NULL)
 {
	 LOGD("Image loading failure");
	 return	0;
 }
 LOGD("Successfully Image got Loaded");

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.