Andriod SDL_2.0/OPENGL ES 1.1/NDK Base for Eclipse?

Hey does anyone have a simple base project for eclipse for SDL_2.0/OPENGL ES 1.1/NDK Base? that complies and works?

I’m getting a huge headache, just trying to get OpenGL enabled using SDL 1.2. Just spend 3 hours trying to get OpenGL going with no success.
#include <GLES/gl.h> works but I still get this.

stuff like this:
Description Resource Path Location Type
’GL_QUADS’ was not declared in this scope main.cpp /SDLActivity/jni/src line 42 C/C++ Problem??

I’ve been advised to go SDL 2.0, but I also need OpenGL working and the NDK C++. But I’m have massive trouble just getting a working base.

OpenGL ES is not OpenGL, it’s just a subset made especifically for
very low-end devices (such as mobile). GL_QUADS doesn’t exist in
OpenGL ES, for instance (you need to use two triangles). This is your
issue.

May want to look up more about OpenGL ES first because otherwise you
won’t get anywhere.

2013/4/27, Timodor :> Hey does anyone have a simple base project for eclipse for SDL_2.0/OPENGL ES

1.1/NDK Base? that complies and works?

I’m getting a huge headache, just trying to get OpenGL enabled using SDL
1.2. Just spend 3 hours trying to get OpenGL going with no success.
#include <GLES/gl.h> works but I still get this.

stuff like this:
Description Resource Path Location Type
’GL_QUADS’ was not declared in this scope main.cpp /SDLActivity/jni/src line
42 C/C++ Problem??

I’ve been advised to go SDL 2.0, but I also need OpenGL working and the NDK
C++. But I’m have massive trouble just getting a working base.

There is an Android project in the SDL 2 source tree. Here’s some
(unfinished) info about it:

You should refer to the wiki for porting tips from SDL1.2 to SDL2. If you
have any other problems, let us know.
http://wiki.libsdl.org/moin.fcg/MigrationGuide

Jonny DOn Sat, Apr 27, 2013 at 7:47 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

OpenGL ES is not OpenGL, it’s just a subset made especifically for
very low-end devices (such as mobile). GL_QUADS doesn’t exist in
OpenGL ES, for instance (you need to use two triangles). This is your
issue.

May want to look up more about OpenGL ES first because otherwise you
won’t get anywhere.

2013/4/27, Timodor :

Hey does anyone have a simple base project for eclipse for
SDL_2.0/OPENGL ES
1.1/NDK Base? that complies and works?

I’m getting a huge headache, just trying to get OpenGL enabled using SDL
1.2. Just spend 3 hours trying to get OpenGL going with no success.
#include <GLES/gl.h> works but I still get this.

stuff like this:
Description Resource Path Location Type
’GL_QUADS’ was not declared in this scope main.cpp
/SDLActivity/jni/src line
42 C/C++ Problem??

I’ve been advised to go SDL 2.0, but I also need OpenGL working and the
NDK
C++. But I’m have massive trouble just getting a working base.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

#include “Game.h”

#include <android/log.h>
#include <GLES/gl.h>
#include <GLES/glext.h>

//include <android/asset_manager.h>

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

//Initialize all SDL subsystems
	if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
	{
		return 1;
	}

    //Set up the screen
	//Create Window
	//if( SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_OPENGL | SDL_FULLSCREEN ) == NULL )
	if( SDL_SetVideoMode( 780, 480, 8, SDL_OPENGL) == NULL )
	{
		return false;
	}
	SDL_WM_SetCaption( "GUNNER", NULL );

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrthof(0, 780, 480, 0, 0, 1);
	glMatrixMode(GL_MODELVIEW);


	bool bGame = true;

	while (bGame == true)
	{

		/*
		glBegin(GL_QUADS);
			glVertex2d( 0 ,  0	);
			glVertex2d( 0 ,  10 );
			glVertex2d( 10 , 10	);
			glVertex2d( 10 , 0	);
		glEnd();
		*/


		SDL_GL_SwapBuffers();
	}


return 0;

}

ERRORS

Description Resource Path Location Type

Function ‘glLoadIdentity’ could not be resolved main.cpp /SDLActivity/jni/src line 34 Semantic Error
Type ‘glMatrixMode’ could not be resolved main.cpp /SDLActivity/jni/src line 36 Semantic Error
Type ‘glMatrixMode’ could not be resolved main.cpp /SDLActivity/jni/src line 33 Semantic Error
Function ‘glOrthof’ could not be resolved main.cpp /SDLActivity/jni/src line 35 Semantic Error

I check the OpenGL header’s and those functions are in there. Something to do with lib’s?

Are you absolutely sure that you’ve included GLES/gl.h?

Alternatively it might be some Eclipse code analysis voodoo failing,
something like this -
http://stackoverflow.com/questions/10041453/eclipse-c-type-could-not-be-resolved-error-even-though-build-is-successfulOn 28 April 2013 08:10, Timodor wrote:

**
#include “Game.h”

#include **
#include **
#include **

//include **

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

//Initialize all SDL subsystems
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
{
return 1;
}

//Set up the screen
//Create Window
//if( SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,
SDL_OPENGL | SDL_FULLSCREEN ) == NULL )
if( SDL_SetVideoMode( 780, 480, 8, SDL_OPENGL) == NULL )
{
return false;
}
SDL_WM_SetCaption( “GUNNER”, NULL );

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0, 780, 480, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);

bool bGame = true;

while (bGame == true)
{

/*
glBegin(GL_QUADS);
glVertex2d( 0 , 0 );
glVertex2d( 0 , 10 );
glVertex2d( 10 , 10 );
glVertex2d( 10 , 0 );
glEnd();
*/

SDL_GL_SwapBuffers();
}

return 0;
}

ERRORS

Description Resource Path Location Type

Function ‘glLoadIdentity’ could not be resolved main.cpp
/SDLActivity/jni/src line 34 Semantic Error
Type ‘glMatrixMode’ could not be resolved main.cpp /SDLActivity/jni/src
line 36 Semantic Error
Type ‘glMatrixMode’ could not be resolved main.cpp /SDLActivity/jni/src
line 33 Semantic Error
Function ‘glOrthof’ could not be resolved main.cpp /SDLActivity/jni/src
line 35 Semantic Error

I check the OpenGL header’s and those functions are in there. Something to
do with lib’s?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well I finally got OpenGL working but’s bizarre. It only complies if you load eclipse from scratch, if you like edit the main.cpp with anything, all of sudden you get those can’t resolve this and that. So it works, but you can edit you code, without having to restart the entire eclipse! I suspect it has something to do with NDK.

Something to do with this build command : C:\adt-bundle-windows-x86_64-20130219\android-ndk-r8d\ndk-build

If it doesn’t make sense, blame Eclipse. That’s what I’ve learned.
Restart Eclipse or your computer and it usually works out. ndk-build can
be used from the command line too, so you can avoid these problems if you
go that route.

Jonny DOn Mon, Apr 29, 2013 at 5:58 AM, Timodor wrote:

**
Well I finally got OpenGL working but’s bizarre. It only complies if you
load eclipse from scratch, if you like edit the main.cpp with anything, all
of sudden you get those can’t resolve this and that. So it works, but you
can edit you code, without having to restart the entire eclipse! I suspect
it has something to do with NDK.

Something to do with this build command :
C:\adt-bundle-windows-x86_64-20130219\android-ndk-r8d\ndk-build


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well I finally got around it went into the error manager in eclipse and disabled the very error types it now works.

GLAD I have SDL 1.2 and OpenGL ES 1.1 Working :slight_smile: I’ve ported the entire game and it’s much faster now.