Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
44 user(s) are online (35 user(s) are browsing Forums)

Members: 0
Guests: 44

more...
Support us!
Recent OS4 Files
OS4Depot.net



« 1 ... 27 28 29 (30) 31 32 33 ... 39 »


Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

Quote:

You mean inside of the q3 code, or inside of sdl2 ? I only tried so far doing this inside of createcontext() in the sdl2:


I mean taking a simpler example than Q3. I believe OGLES2 SDK contains some? Or SDL2 has also some OGLES2 test case.

Quote:

Do you mean in q3 code, or inside of SDL2 , right after aglSwapBuffers() ?


It doesn't really matter, but Q3 is the logical place. Application knows when the frame ends and should do error checking. Locate call to SDL_GL_SwapWindow.


   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Quote:

I mean taking a simpler example than Q3. I believe OGLES2 SDK contains some? Or SDL2 has also some OGLES2 test case.

Simple ogles2 test cases works fine with SDL2 in oversized windowses, as well simple gl4es/sdl2 test cases too, as well as other game compiled via gl4es/sdl2 also works fine in oversized window.

Its exactly q3 which produce black window when it oversized, which by logic we can then blame, if not only fact that minigl version works fine from the same q3/sdl2 code..

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Just popping in
Joined:
2011/6/3 12:49
Posts: 232
@kas1e

>why it happens only with Q3[...] It should be in any game

From my own experience in debugging : never assume "It should be" but only check what really is/happen in the prog.


So in this case: have a look to what bitmap is currently used ... just to be sure.

Alain

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
I also tried to use "bitmap" way, as you have to do with SDL_os4opengles.c, with those MANAGE_BITMAP ifdefs, and it while it works, it still give the same black window in q3 when oversized window used. Damn :(

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

Did you try glGetError()?

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Quote:

Did you try glGetError()?


Yeah, in q3's code/sdl/sdl_glimp.c , we have there GLimp_EndFrame() function which has at top SDL_GL_SwapWindow(). So i made that:

const charglGetErrorString(GLenum error)
{
    switch (
error)
    {
    case 
GL_NO_ERROR:          return "No Error";
    case 
GL_INVALID_ENUM:      return "Invalid Enum";
    case 
GL_INVALID_VALUE:     return "Invalid Value";
    case 
GL_INVALID_OPERATION: return "Invalid Operation";
    case 
GL_INVALID_FRAMEBUFFER_OPERATION: return "Invalid Framebuffer Operation";
    case 
GL_OUT_OF_MEMORY:     return "Out of Memory";
    case 
GL_STACK_UNDERFLOW:   return "Stack Underflow";
    case 
GL_STACK_OVERFLOW:    return "Stack Overflow";
    default:                   return 
"Unknown Error";
    }
}

void _glCheckError(const char *filenameint line)
{
    
GLenum err;
    while ((
err glGetError()) != GL_NO_ERROR)
        
printf("OpenGL Error: %s (%d) [%u] %s\n"filenamelineerrglGetErrorString(err));
}


#define glCheckError() _glCheckError(__FILE__, __LINE__)


And put at top of function, and after SDL_GL_SwapWindow glCheckError():

void GLimp_EndFramevoid )
{
    
glCheckError();
    
// don't flip if drawing to front buffer
    
if ( Q_stricmpr_drawBuffer->string"GL_FRONT" ) != )
    {
        
SDL_GL_SwapWindowSDL_window );
    }
    
glCheckError();

..
blablabl


And it prinfs nothing, like no errors.. Tried both modes and when window fits in wb size, and when didn't, no errors in both cases , just in oversized one black window.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Is SDL2's Gamecontroller interface fully supported ? I see you code lots of amigainput's code in, so probably it supported, but is all implemented as it should be ?

And how it detect the stuff, i mean, different joysticks have needs to be configured probabaly via amigainput before they can be used via SDL2 gamecontroller interface ?

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

It supports only one joystick currently, Competition Pro. Some pads like XBOX-360 and Steam controller were not recognized by AmigaInput so they cannot be used right now. Reference: https://github.com/AmigaPorts/SDL/blob ... L_gamecontrollerdb.h#L590

This database can be appended by using test/controllermap which generates entries. I have made a test archive available ( http://capehill.kapsi.fi/sdl2/SDL_joystick_test.lha ) that can be used to:

1) test (AI-compatible) joystick: testjoystick
2) test gamecontroller (Competition Pro only!): testgamecontroller
3) configure mappings: controllermap. If you have some joystick you can send the mappings to me or make a PR on Github.

I just tested Competition Pro using test/testgamecontroller application. Directions worked, same with four buttons: A, B, X and Y.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Thanks for detailed answer, all clear now. We can say that just if one want joystick on SDL2 joystick interface: then Competition PRO only at moment.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Just can't stay away
Joined:
2007/2/23 13:49
From Finland, the land of Santa, sauna, sisu and salmiakki
Posts: 1097
@Capehill

The tests from SDL_joystick_test claims that I don't have any joysticks connected which is wrong. I have Competition Pro USB connected. (See Fricking shark subject.) amigainput.library v53.4.

_________________
Rock lobster bit me, so excuse me.
X1000 + AmigaOS 4.1 FE. Be authentic.
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

SDL joystick API supports joysticks that work with AmigaInput.

SDL game controller API supports those joysticks that have mapping in the game controller database. There is only one added so far.

   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@TSK

That is strange. I re-tested "testjoystick" with SDL 2.0.8 and it found my Competition Pro. Directions worked, pressing some button caused missing symbol: the issue is test archive is built from 2.0.9+ sources so I guess the test code is not backwards compatible.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Did i understand right, that there is 2 ways to handle joysticks in SDL2 apps ? One are SDL joystick API and another one is SDL game controller API ?

If so, what way is prefereble and better for amigaos4, and, is they both mixed and can work together, or, if programmed for one way, another one didn't works ?

Why i ask is that if you say we have onluy support for Competition Pro via GameController's API, then, other joysticks should't works at all, or, they still will, just with "wrong" mapping ?


Why i ask, is that if you will check that topic:
http://www.amigans.net/modules/xforum ... hp?topic_id=7931&forum=11

You can see, that when we have in game originall "Joystick" interface code, then for TSK's Cometition Pro joystick only left/right/up/down works, but buttons didn't. So, we made code to be not "Joystick" api, but GameController one, and then, for the same TSK's joystick , keys start to work for jump/fire, but left/right/up/down stop working.

So, we check on linux that game with GameController's API, and with an XBox360 everything works fine. What mean, that probably our GameController's API realisation need some changes/fixes maybe ? Or remaping or whatever ..


_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

I checked some code, Hydra makes an assumption that there are leftx/lefty axes defined: https://github.com/ptitSeb/hydracastle ... ter/src/sdl2/input.c#L201

Competition Pro has mapping for only rightx/righty: https://github.com/AmigaPorts/SDL/blob ... L_gamecontrollerdb.h#L590

Regarding joystick API, I don't know right now what are the button numbers for Competition Pro. Probably from 0 to upwards, I have used "0" in Super Methane Bros and some other apps. Then again, if we check Hydra code, buttons 0-3 set directions: https://github.com/ptitSeb/hydracastle ... ter/src/sdl2/input.c#L156

What exactly should happen when joystick fire buttons (Comp Pro has 4) are active?

SDL joystick API is better for now because the problem is, who will provide mappings for those AI-supported joysticks? They would need to be contributed to SDL project by various persons. I have about 2 joysticks that AI recognizes so that doesn't get us very far.

It's best if application could provide some configurability regarding buttons and axes.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill

Quote:

Competition Pro has mapping for only rightx/righty:


But why ? I mean why for Competition Pro we have mapping only for rightx/righty, and not for leftx/lefty ? I mean is it something we can help with so to have full mapping ?

Quote:

Regarding joystick API, I don't know right now what are the button numbers for Competition Pro. Probably from 0 to upwards, I have used "0" in Super Methane Bros and some other apps. Then again, if we check Hydra code, buttons 0-3 set directions: https://github.com/ptitSeb/hydracastle ... ter/src/sdl2/input.c#L156


We need to ask TSK in "fricking shark" thread, so he can test it and give us right "mapping" for.. Or i can just buy Competition Pro myself, that will be faster and easy for tests in end :)

Quote:

SDL joystick API is better for now because the problem is, who will provide mappings for those AI-supported joysticks? They would need to be contributed to SDL project by various persons. I have about 2 joysticks that AI recognizes so that doesn't get us very far.


I can buy for example 3-4 popular joysticks which works on amigaos4 , +your 2 , and so, we will have 6 joysticks, to which we can add 100% support and be done with it.

Then, for any other new joystik we can say to users : want to support your one ? Then follow that guide, and send us the mapping.


Quote:

It's best if application could provide some configurability regarding buttons and axes.


As i understand ptitSeb, the SDL2's Game Controller API is easy, and its easy to add to any game/app which didn't support it by default. So he done some "general" code one time, and can reuse it everywhere later.


_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

Quote:

But why ? I mean why for Competition Pro we have mapping only for rightx/righty, and not for leftx/lefty ? I mean is it something we can help with so to have full mapping ?


Comp Pro has only 2 axes. Who can say which of the 6 SDL-supported axes should be chosen? Cannot pick more than 2 (tried). But since I think axis behaviour is not analog, maybe it would best to map Comp Pro axes as directional buttons.

Quote:

We need to ask TSK in "fricking shark" thread, so he can test it and give us right "mapping" for.. Or i can just buy Competition Pro myself, that will be faster and easy for tests in end :)


Tested myself, Comp Pro buttons are 0-3 which is pretty logical. I don't know why SDL or AI reports 16 available buttons. Thing has only 4 buttons and I don't know how to get other buttons visible. Autofire selection didn't have impact.

Quote:

Then, for any other new joystik we can say to users : want to support your one ? Then follow that guide, and send us the mapping.


Next SDL2 release shall contain the test programs.

Quote:

As i understand ptitSeb, the SDL2's Game Controller API is easy, and its easy to add to any game/app which didn't support it by default. So he done some "general" code one time, and can reuse it everywhere later.


Joystick API is not difficult either. In my opinion Hydra makes some wrong assumptions on available axes. I think (didn't test yet) SDL offers a way to query axis and in case of failure, it should return NULL. My own joystick code is not better, I have hard-coded axes 0 and 1, worked for me.

Customer is the king, if possible, provide configuration options.

   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Quote:

Comp Pro has only 2 axes.


But why choicen for amigaos4 are rightx and righty, and not leftx and rightx ? ptitSeb add amigaos4 ifdefs to the code, so to use rightx/righty, but the choice to use Right axis and Left is a bit strange, he would assume default to be left.

That how current code looks like:
https://github.com/ptitSeb/hydracastle ... b/master/src/sdl2/input.c

You can see there:

Quote:

#ifdef __amigaos4__
#define STICK_X SDL_CONTROLLER_AXIS_RIGHTX
#define STICK_Y SDL_CONTROLLER_AXIS_RIGHTY
#else
#define STICK_X SDL_CONTROLLER_AXIS_LEFTX
#define STICK_Y SDL_CONTROLLER_AXIS_LEFTY
#endif


But that quite suck to have such ifdefs imho (i mean, it always will need amigaos4 adaptation then).

As for mapping before, it was used for Joystick interface buttons, not for Gamecontroller one. Anyway, it was bad and he add some default value, not that xbox360 mapping (that will be used in Gamecontroller mode anyway).


Quote:


Joystick API is not difficult either. In my opinion Hydra makes some wrong assumptions on available axes. I think (didn't test yet) SDL offers a way to query axis and in case of failure, it should return NULL. My own joystick code is not better, I have hard-coded axes 0 and 1, worked for me.

Customer is the king, if possible, provide configuration options.


quote ptitSeb's answer:

Quote:

Now, for Gamecontroller, the idea behind this API is to propose a Plug'n Play way to use a joystick: you plug it in, and because the Layout and mapping is standardized (look at XB360, XBOne, PS3 or PS4 controlleurs: they all offerts similar basic functions on a similar layout: left and right stick, left dpad, 4 fae buttons, 4 triggers, 1 back and 1 start buttons basically). So, for Gamecontroller, the point is to not have any config screen, it just work, with a fixed layout.

For joystick, a config screen would be needed. But as I don't like programming GUI, I don't think I'll do that (plus, it's a long and tedious work to program that GUI for joystick option for just 20 sec of use).


I can add, that it is good to have code which you just copy+paste from one game to another, and it "just works", without needs to write gui options again and again for every new game, which in end will be so boring, that no joystick support will be in favor of time.



_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5385
@Capehill
Btw, forgot to ask in previous comment : i notice that when i start any SDL app which has sound/music, i offten heard some noise-pitch sound (a very small one, just like blep). Like initialization done, but i can heard it. Is it something in SDL, or , it just my AHI settings need to be ajusted somehow to avoid it ?

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

Quote:

But why choicen for amigaos4 are rightx and righty, and not leftx and rightx ?


It was added in March 2016 so can't really remember.

Quote:

ptitSeb add amigaos4 ifdefs to the code, so to use rightx/righty, but the choice to use Right axis


Why he makes assumption that all our joysticks will have right axis if one has? By the way, you didn't comment my directional button proposal: I think it would be better. Competition Pro has really a "middle" axis.

Quote:

and Left is a bit strange, he would assume default to be left.


Why left is default?

Quote:

But that quite suck to have such ifdefs imho (i mean, it always will need amigaos4 adaptation then).


And what if controller has no axes? Axis code wouldn't work anyway, naturally.

I'm not asking anyone to add GUI code. Most sane games have some configuration file, adding few lines there is not bad? At least it's faster to modify and test than C code.

   Report Go to top

Re: SDL2
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 749
@kas1e

SDL2 doesn't clear audio buffer anymore, it must be done by the application now. https://wiki.libsdl.org/MigrationGuide#Audio

   Report Go to top


« 1 ... 27 28 29 (30) 31 32 33 ... 39 »



[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project