Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nero81af

Pages: [1]
1
General discussions / Re: Android and iOS ports available for testing
« on: July 22, 2014, 10:00:58 am »
Just a quick question: is there a way to obtain the native activity outside sfml? I need access to obbpath and assetmanager to extract game data! :D Maybe it would be nice to obtain it from getSystemHandle instead of the native window!

2
General discussions / Re: Android and iOS ports available for testing
« on: April 23, 2014, 12:38:34 pm »
I edited my previous post! master branch has fixed problems regarding opengl 3.0 context creation.

while testing I found out another bug

JoystickImpl.mm and JoystickImpl.hpp in Ios folder are missing getIdentification method!

3
General discussions / Re: Android and iOS ports available for testing
« on: April 23, 2014, 10:25:38 am »
those patches have been applied on the master branch from yesterday so no! opengl 3.0 context does not work without those patches

4
General discussions / Re: Android and iOS ports available for testing
« on: April 22, 2014, 05:05:58 pm »
I'd like to submit here some patches I had to put in sfml in order to build ogre with sfml on android ios macos linux and windows with gl3plus renderer and gles2 renderer and mingw64 compiler. Some patches allow the creation of a es2.0 / 3.0 context.. not sure those are useful tho since sfml is working with gles 1.0 only.. anyway here they are (those patches should not broke actual build)

SFML/Window/EglContext.cpp: line 197.

    //const EGLint contextVersion[] = {
    //    EGL_CONTEXT_CLIENT_VERSION, 1,
    //    EGL_NONE
    //};
    //
    //EGLContext toShared;
    //
    //if (shared)
    //    toShared = shared->m_context;
    //else
    //    toShared = EGL_NO_CONTEXT;
    EGLint renderable;
    EGLint client_version;

    eglGetConfigAttrib(m_display,m_config,EGL_RENDERABLE_TYPE,&renderable);

    if(renderable == EGL_OPENGL_ES_BIT)
    {
        client_version = 1;
    }
    else if(renderable == EGL_OPENGL_ES2_BIT)
    {
        client_version = 2;
    }

    const EGLint contextVersion[] = {
        EGL_CONTEXT_CLIENT_VERSION, client_version,
        EGL_NONE
    };

    EGLContext toShared;

    if (shared && (client_version != 2))
        toShared = shared->m_context;
    else
        toShared = EGL_NO_CONTEXT;

SFML/Window/EglContext.cpp: line 260.

    // Set our video settings constraint
    //const EGLint attributes[] = {
    //    EGL_BUFFER_SIZE, bitsPerPixel,
    //    EGL_DEPTH_SIZE, settings.depthBits,
    //    EGL_STENCIL_SIZE, settings.stencilBits,
    //    EGL_SAMPLE_BUFFERS, settings.antialiasingLevel,
    //    EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
    //    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
    //    EGL_NONE
    //};
    EGLint renderable;

    if(settings.majorVersion == 1)
    {
        renderable = EGL_OPENGL_ES_BIT;
    }
    else if(settings.majorVersion == 2)
    {
        renderable = EGL_OPENGL_ES2_BIT;
    }

    const EGLint attributes[] = {
        EGL_BUFFER_SIZE, bitsPerPixel,
        EGL_DEPTH_SIZE, settings.depthBits,
        EGL_STENCIL_SIZE, settings.stencilBits,
        EGL_SAMPLE_BUFFERS, ((settings.antialiasingLevel > 0) ? 1 : 0),
        EGL_SAMPLES, settings.antialiasingLevel,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
        EGL_RENDERABLE_TYPE, renderable,
        EGL_NONE
    };

SFML/Window/Android/WindowImplAndroid.cpp: line 520.

    //case AKEYCODE_DEL                : return Keyboard::Delete;
    case AKEYCODE_DEL                : return Keyboard::BackSpace;
 
SFML/Window/Android/WindowImplAndroid.cpp: line 614.

    if(action == AKEY_EVENT_ACTION_UP)
    {
       unicode = 0;
    }

SFML/Window/iOS/SFAppDelegate.mm: line 269.

    if(character == '\b')
    {
        sf::Event event;
        event.type = sf::Event::KeyPressed;
        event.key.code = sf::Keyboard::BackSpace;
        event.key.alt = false;
        event.key.control = false;
        event.key.shift = false;
        sfWindow->pushEvent(event);
    }
    else if(character == '\n')
    {
        sf::Event event;
        event.type = sf::Event::KeyPressed;
        event.key.code = sf::Keyboard::Return;
        event.key.alt = false;
        event.key.control = false;
        event.key.shift = false;
        sfWindow->pushEvent(event);
    }

SFML/Window/iOS/SFView.mm: line 104.

    //sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
    sf::Vector2i position(static_cast<int>(point.x * self.contentScaleFactor), static_cast<int>(point.y * self.contentScaleFactor));

SFML/Window/iOS/SFView.mm: line 124.

    //sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
    sf::Vector2i position(static_cast<int>(point.x * self.contentScaleFactor), static_cast<int>(point.y * self.contentScaleFactor));

SFML/Window/iOS/SFView.mm: line 145.

    //sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
    sf::Vector2i position(static_cast<int>(point.x * self.contentScaleFactor), static_cast<int>(point.y * self.contentScaleFactor));

SFML/Window/Win32/JoystickImpl.cpp: line 235.

    //ss.str(_T(""));
    ss.str(sf::String(""));

SFML/Window/Win32/JoystickImpl.cpp: line 250.

    //ss.str(_T(""));
    ss.str(sf::String(""));

5
General discussions / Re: Android and iOS ports available for testing
« on: March 05, 2014, 04:50:38 pm »
I'd like to signal the bug I've found on Android! It's quite important since otherwise the app will crash sooner or later:

in WindowImplAndroid.cpp

301 + lJavaVM->DetachCurrentThread();

504 - case AKEYCODE_DEL: return Keyboard::Delete;
504 + case AKEYCODE_DEL : return Keyboard::BackSpace;

593 - jobject ObjectKeyEvent = lJNIEnv->NewObject(ClassKeyEvent, KeyEventConstructor, (jvalue*)downTime, (jvalue*)eventTime, (jvalue*)action, (jvalue*)code, (jvalue*)repeat, (jvalue*)metaState, (jvalue*)deviceId, (jvalue*)scancode, (jvalue*)flags, (jvalue*)source);
593 + jobject ObjectKeyEvent = lJNIEnv->NewObject(ClassKeyEvent, KeyEventConstructor, downTime, eventTime, action, code, repeat, metaState, deviceId, scancode, flags, source);

602 + lJavaVM->DetachCurrentThread();

6
General discussions / Re: Android and iOS ports available for testing
« on: February 28, 2014, 04:01:44 pm »
little update: I updated android and now processEvent get called but I still cannot have input since getUnicode() in

void WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates* states)

always returns 0!

7
General discussions / Re: Android and iOS ports available for testing
« on: February 28, 2014, 12:42:03 pm »
I've finally menaged to build ogre over sfml and cegui over ogre on windows mac Linux android and iOS! now I have one last problem with android! when I show the keyboard with

sf::Keyboard::setVirtualKeyboardVisible(true)

I can see the virtual keyboard but I can't capture inputs!

I tried to investigate in the method

int WindowImplAndroid::processEvent(int fd, int events, void* data)

that is attached to a looper in

static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue)

but when I try to press a key processEvent callback is not entered! the only keys that works are tab and backspace!

8
General discussions / Re: Android and iOS ports available for testing
« on: February 12, 2014, 02:48:21 pm »
try this patch

Window/EGLContext.cpp: line 86:
- EGLint attrib_list[] = { EGL_NONE };
+ EGLint attrib_list[] = { EGL_WIDTH,1,EGL_HEIGHT,1,EGL_NONE };

9
General discussions / Re: Android and iOS ports available for testing
« on: January 27, 2014, 02:38:49 pm »
ok I got it working! it was a problem on my opengl code! still have to figure out what! probably some unimplemented feature of opengl es! btw eglCreatePbufferSourface really need another type of initialization!

Window/EGLContext.cpp: line 86:
- EGLint attrib_list[] = { EGL_NONE };
+ EGLint attrib_list[] = { EGL_WIDTH,1,EGL_HEIGHT,1,EGL_NONE };

10
General discussions / Re: Android and iOS ports available for testing
« on: January 27, 2014, 01:10:24 pm »
I could manage to display some graphics using the sfml-graphic module: I rendered a blue rectangle on white background on android. so probably the problem is in my opengl setup! dunno where tho

11
General discussions / Re: Android and iOS ports available for testing
« on: January 27, 2014, 02:02:57 am »
hello! I'm new to the forum and I'm doing some testings on ios and android ports in order to make a cross platform framework.

I'm building sfml in my own makefiles and building only window and system modules in libsfml.a on windows using mingw: these are my compilation flags:

DEFS= -DSFML_STATIC -DSFML_OPENGL_ES -D__STDC_FORMAT_MACROS -D__USE_BSD -D_BSD_SOURCE -DPOSIX_SOURCE -DGL_GLEXT_PROTOTYPES -Dfdatasync=fsync -DPIC -fPIC -fexceptions -frtti -std=gnu++11
LDFLAGS = -lGLESv1_CM -lGLESv2 -lstlport_static -lc -ldl -lgcc -landroid -lEGL
CFLAGS = -shared -LC:\android\ndk\sources/cxx-stl/stlport/libs/armeabi-v7a -LC:\android\ndk\platforms/android-17/arch-arm/usr/lib C:\android\ndk\platforms/android-17/arch-arm/usr/lib/crtbegin_static.o -nostdlib -Wl,--no-undefined -Wl,--whole-archive libsfml.a -Wl,--no-whole-archive

everything goes ok in window and linux but once I try android things gets hard: I managed to compile and make an apk but when I run a simple main creating a window and displaying a cube, I get a black screen in emulator. in particular eglCreatePbufferSourface returns egl_bad_alloc. I tried to fix it using some custom attributes list: no more errors but still I get black screen with eglSurfaceAttrib not implemented.

#include <stdio.h>

#include <exception>

#include "rs.hpp"
#ifdef RS_PLATFORM_ANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#elif RS_PLATFORM_IOS
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#include "glew/GL/glew.h"
#endif
#include "sfml/SFML/Window.hpp"

#define _PLAYGROUND_NAME    "playground"
#define _PLAYGROUND_VERSION "0.1.0"

using namespace std;

int main(int argc,char **p_argv)
{
        try
        {
                sf::Window window(sf::VideoMode::getDesktopMode(),"OpenGL");
                glEnable(GL_DEPTH_TEST);
                glDepthMask(GL_TRUE);
#ifdef RS_PLATFORM_ANDROID
                glClearColor(1.0,1.0,1.0,1.0);
                glClearDepthf(1.f);
#elif RS_PLATFORM_IOS
                glClearColor(1.0,1.0,1.0,1.0);
                glClearDepthf(1.f);
#else
                glClearDepth(1.f);
#endif
                glDisable(GL_LIGHTING);
                glViewport(0,0,window.getSize().x,window.getSize().y);
                glMatrixMode(GL_PROJECTION);
                glLoadIdentity();
                GLfloat ratio = static_cast<float>(window.getSize().x) / window.getSize().y;
#ifdef RS_PLATFORM_ANDROID
                glFrustumf(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
#elif RS_PLATFORM_IOS
                glFrustumf(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
#else
                glFrustum(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
#endif

                GLfloat cube[] =
                {
                        -20, -20, -20,  0, 0,
                        -20,  20, -20,  1, 0,
                        -20, -20,  20,  0, 1,
                        -20, -20,  20,  0, 1,
                        -20,  20, -20,  1, 0,
                        -20,  20,  20,  1, 1,
                         20, -20, -20,  0, 0,
                         20,  20, -20,  1, 0,
                         20, -20,  20,  0, 1,
                         20, -20,  20,  0, 1,
                         20,  20, -20,  1, 0,
                         20,  20,  20,  1, 1,
                        -20, -20, -20,  0, 0,
                         20, -20, -20,  1, 0,
                        -20, -20,  20,  0, 1,
                        -20, -20,  20,  0, 1,
                         20, -20, -20,  1, 0,
                         20, -20,  20,  1, 1,
                        -20,  20, -20,  0, 0,
                         20,  20, -20,  1, 0,
                        -20,  20,  20,  0, 1,
                        -20,  20,  20,  0, 1,
                         20,  20, -20,  1, 0,
                         20,  20,  20,  1, 1,
                        -20, -20, -20,  0, 0,
                         20, -20, -20,  1, 0,
                        -20,  20, -20,  0, 1,
                        -20,  20, -20,  0, 1,
                         20, -20, -20,  1, 0,
                         20,  20, -20,  1, 1,
                        -20, -20,  20,  0, 0,
                         20, -20,  20,  1, 0,
                        -20,  20,  20,  0, 1,
                        -20,  20,  20,  0, 1,
                         20, -20,  20,  1, 0,
                         20,  20,  20,  1, 1
                };

                glEnableClientState(GL_VERTEX_ARRAY);
                glEnableClientState(GL_TEXTURE_COORD_ARRAY);
                glVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), cube);
                glTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), cube + 3);
                glDisableClientState(GL_NORMAL_ARRAY);
                glDisableClientState(GL_COLOR_ARRAY);
                sf::Clock clock;

                while (window.isOpen())
                {
                        sf::Event event;
                        while (window.pollEvent(event))
                        {
                                        if (event.type == sf::Event::Closed)
                                                        window.close();
                        }

                        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                        glMatrixMode(GL_MODELVIEW);
                        glLoadIdentity();
                        glTranslatef(0, 0, -100.f);
                        glRotatef(clock.getElapsedTime().asSeconds() * 50.f, 1.f, 0.f, 0.f);
                        glRotatef(clock.getElapsedTime().asSeconds() * 30.f, 0.f, 1.f, 0.f);
                        glRotatef(clock.getElapsedTime().asSeconds() * 90.f, 0.f, 0.f, 1.f);
                        glDrawArrays(GL_TRIANGLES, 0, 36);
                        window.display();
                }
        }
        catch(exception &exception)
        {

        }

        return 0;
}
 

Pages: [1]