Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
57 user(s) are online (40 user(s) are browsing Forums)

Members: 0
Guests: 57

more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: SDL1 open issues

Subject: Re: SDL1 open issues
by kas1e on 2018/2/23 9:55:36

@Capehill
Thanks for insign !

With help of gl4es author i just hack gl4es support into sdl1:

Resized Image

You can see there in console behind output from gl4es debug.

That whay i do:

1. completely remove content of SDL_os4_wrapper.c (so 0 bytes), and then it didn't include all those SDL_os4_notimplemented_funcs.t and SDL_os4_notimplemented_table.t

2. in the SDL_os4video.h, at end of SDL_PrivateVideoData structure replaced struct GLContextIFace *IGL; on void *IGL; (so for ogles2 context)

3. in the SDL_os4video.c , in the os4video_AllocateOpenGLBuffers() , commented out:

Quote:

#if 0
hidden->IGL->MGLUpdateContextTags(
MGLCC_FrontBuffer,hidden->m_frontBuffer,
MGLCC_BackBuffer,hidden->m_backBuffer,
TAG_DONE);

hidden->IGL->GLViewport(0,0,width,height);
#endif


4. And new SDL_os4gl.c:

/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2006 Sam Lantinga

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Sam Lantinga
    slouken@libsdl.org
*/
#include "SDL_config.h"

#include <proto/ogles2.h>
/*
 * GL support for AmigaOS 4 using GL4ES->OGLES2
 */

#if SDL_VIDEO_OPENGL

#include "SDL_os4video.h"
#include "SDL_os4utils.h"
#include "SDL_os4blit.h"

#include <proto/exec.h>
#include <proto/intuition.h>

#include <GL4ES/gl.h>

//#define DEBUG
#include "../../main/amigaos4/SDL_os4debug.h"


voidaglGetProcAddress(const char *);  // gl4es's aglGetProcAddress
void amiga_pre_swap(); // from gl4es to make working aglSwapBuffers()
void amiga_post_swap(); // from gl4es to make working aglSwapBuffers()


/*
 * initialize OGLES2 context
 */
int os4video_GL_Init(_THIS)
{

    
struct SDL_PrivateVideoData *hidden _this->hidden;
    
    
dprintf("Initializing GL4ES->OGLES2.. ");

        
     
hidden->IGL=IOGLES2->aglCreateContextTags(0,
                
OGLES2_CCT_WINDOW,(ULONG)hidden->win,
                
OGLES2_CCT_DEPTH,16,
                
OGLES2_CCT_STENCIL,8,
                
OGLES2_CCT_VSYNC,0,
                
OGLES2_CCT_SINGLE_GET_ERROR_MODE,1,
            
TAG_DONE);


    if (
hidden->IGL)
    {
        
_this->gl_config.driver_loaded 1;
    
        
IOGLES2->aglMakeCurrent(hidden->IGL);        
        
        
hidden->OpenGL TRUE;

        return 
0;
    }
    else
    {
        
_this->gl_config.driver_loaded 0;
        
SDL_SetError("Failed to create OGLES2 context");
    }

    return -
1;

}

void os4video_GL_Term(_THIS)
{

}

int    os4video_GL_GetAttribute(_THISSDL_GLattr attribintvalue)
{
   return 
0;
}

int    os4video_GL_MakeCurrent(_THIS)
{
    return 
0;
}

void os4video_GL_SwapBuffers(_THIS)
{

    
amiga_pre_swap();
    
// Swap the Buffers!
    
if(IOGLES2) {
        
IOGLES2->aglSwapBuffers();
    }
    
amiga_post_swap(); 
     
}


void *os4video_GL_GetProcAddress(_THIS, const char *proc) {
    
void *func NULL;

    if ( !
_this->gl_config.driver_loaded )
    {
        if (
os4video_GL_Init(_this) != 0)
        {
            return 
NULL;
        }
    }

    
func = (void *)aglGetProcAddress(proc);
    return 
func;
}

int os4video_GL_LoadLibrary(_THIS, const char *path) {
    
/* Library is always open */
    
_this->gl_config.driver_loaded 1;

    return 
0;
}
#endif


Through, that only sme hack, and probably nothing else except test-cases will works. As you see i delete there everything, keep only simple main things so to check if it works, and it is.

We just need to think now how to implement it all in normal way. I think fallback to minigl will be wrong, as it all can runs, looks wrong, and everyone who have no ogles2 will think that app/game broken. Better "sorry, its is only for ogles2".

As for how it all handle : from one side, compile everything in, is good and then choice by flag. But then, need to touch SDL code then all the time to add that flag. From another side, if we do not want to touch sdl code, and choice what to make inbuild in SDL, then.. then there will be different link libs, like libsdl_mgl.a, libsdl_gl4es.a , libsdl_ogles2.a which dunno, kind of suck too..

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project