The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Andriod SDL_2.0/OPENGL ES 1.1/NDK Base for Eclipse?
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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.
Andriod SDL_2.0/OPENGL ES 1.1/NDK Base for Eclipse?
Sik


Joined: 26 Nov 2011
Posts: 905
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:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Andriod SDL_2.0/OPENGL ES 1.1/NDK Base for Eclipse?
Jonny D


Joined: 12 Sep 2009
Posts: 932
There is an Android project in the SDL 2 source tree.  Here's some (unfinished) info about it:http://www.dinomage.com/2013/01/howto-sdl-on-android/



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 D



On Sat, Apr 27, 2013 at 7:47 AM, Sik the hedgehog wrote:
Quote:
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:
Quote:
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.

Quote:
#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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
I think it's something to do with linking.
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
#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?
Andriod SDL_2.0/OPENGL ES 1.1/NDK Base for Eclipse?
Scott Percival
Guest

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-successful




On 28 April 2013 08:10, Timodor wrote:
Quote:
#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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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
Andriod SDL_2.0/OPENGL ES 1.1/NDK Base for Eclipse?
Jonny D


Joined: 12 Sep 2009
Posts: 932
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 D



On Mon, Apr 29, 2013 at 5:58 AM, Timodor wrote:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Error
Timodor


Joined: 14 Apr 2013
Posts: 72
Location: Australia
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 Smile I've ported the entire game and it's much faster now.