π
<-

double buffering avec nSDL

C, C++, ASM...

double buffering avec nSDL

Message non lude newprog_creator » 23 Mai 2023, 17:59

Bonjour à tous,
Je suis actuellement en train d'apprendre à utiliser nSDL.
J'ai une question pour laquelle je ne trouve pas de réponse.
Je souhaiterai savoir comment désactiver le double buffering. En effet, la fonction sdl_flip() est très lente (50exec/sec) ainsi que la fonction updaterect() également.
Merci par avance pour vos retours...
Merci

Le code d'exemple de ndless (link) est le même que celui que j'utilise.... :
Code: Tout sélectionner
int sdlinit(void)
{
    ptr++;
    if(SDL_Init(SDL_INIT_VIDEO) == -1) {
        printf("Couldn't initialize SDL: %s\n", SDL_GetError());
        exit(EXIT_FAILURE);
    }
    screen = SDL_SetVideoMode(320, 240, has_colors ? 16 : 8, SDL_SWSURFACE);
    if(screen == NULL) {
        printf("Couldn't initialize display: %s\n", SDL_GetError());
        SDL_Quit();
        exit(EXIT_FAILURE);
    }
    SDL_ShowCursor(SDL_DISABLE);
    is_sdl_used=1;
    return screen;
}
Avatar de l’utilisateur
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Prochain niv.: 75.8%
 
Messages: 68
Inscription: 29 Mar 2014, 19:07
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: bac+13

Re: double buffering avec nSDL

Message non lude Vogtinator » 23 Mai 2023, 19:13

You can't disable double buffering. nSDL uses a framebuffer which it draws into and then calls lcd_blit at the end of updaterects.

However, there is no forced vsync or anything like that which would explain the 50fps. Maybe it's actually input handling which takes that long? Especially the touchpad scanning can take a while, but usually not that long.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: double buffering avec nSDL

Message non lude newprog_creator » 23 Mai 2023, 19:52

Thanks for your response.
Unfortunately, the low speed don't come from the input handling (i have disable it).
I will have to recode all graphics functions ....boring...
Thanks again for your response
Avatar de l’utilisateur
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Prochain niv.: 75.8%
 
Messages: 68
Inscription: 29 Mar 2014, 19:07
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: bac+13

Re: double buffering avec nSDL

Message non lude newprog_creator » 23 Mai 2023, 23:21

I come back,
I have some other points i want to ask for.
1- I love the SDL_getticks() function and want to implement an equivalent without using sdl. Is there an another way without nsdl ?
2- In addition, i have not found the way to use interrupts. Is there a mean to do that ?
3- Has someone the source code in c of the blit function with a good optimisation ? (Always without using sdl)

Thanks again by advance
Avatar de l’utilisateur
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Prochain niv.: 75.8%
 
Messages: 68
Inscription: 29 Mar 2014, 19:07
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: bac+13

Re: double buffering avec nSDL

Message non lude Vogtinator » 24 Mai 2023, 10:03

newprog_creator a écrit:I come back,
I have some other points i want to ask for.
1- I love the SDL_getticks() function and want to implement an equivalent without using sdl. Is there an another way without nsdl ?

Only by using timers directly.

2- In addition, i have not found the way to use interrupts. Is there a mean to do that ?

You can, you'll have to configure the hardware, write a handler and overwrite the handler of the OS.

3- Has someone the source code in c of the blit function with a good optimisation ? (Always without using sdl)

Thanks again by advance


You can look at the nSDL code: https://github.com/Vogtinator/nSDL

Alternatives are https://github.com/n2DLib/n2DLib/ or https://github.com/Vogtinator/nGL/blob/ ... etools.cpp
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: double buffering avec nSDL

Message non lude newprog_creator » 24 Mai 2023, 16:00

Thanks for your response
Avatar de l’utilisateur
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Prochain niv.: 75.8%
 
Messages: 68
Inscription: 29 Mar 2014, 19:07
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: bac+13


Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 5 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Ndless for CX 4.5.5 / CX II 6.2.0
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
12345
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
3002 utilisateurs:
>2968 invités
>26 membres
>8 robots
Record simultané (sur 6 mois):
43991 utilisateurs (le 10/09/2025)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)