π
<-
Chat plein-écran
[^]

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.: 74.2%
 
Messages: 67
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.: 74.2%
 
Messages: 67
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.: 74.2%
 
Messages: 67
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.: 74.2%
 
Messages: 67
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 25 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
"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.
Offre de test des nouveautés de rentrée 2024 par Casio. Enseignant(e), reçois gratuitement 1 exemplaire, à ton choix, de la Graph Light ou bien de la Graph Math+
14€ remboursés par Casio sur l'achat de ta calculatrice Graph 35 d'ici le 31 Octobre 2024
10€ remboursés par Casio sur l'achat de ta calculatrice Graph 90+E d'ici le 31 Décembre 2024
10€ remboursés par Casio sur l'achat de ta calculatrice Graph 25 d'ici le 31 Décembre 2024
8€ remboursés par Casio sur l'achat de ta calculatrice Graph Math+ d'ici le 31 Octobre 2024
Reprise de ton ancienne fx-92 Collège ou Graph 25/35/90 à 3€ peu importe son état. Même non fonctionnelle et donc invendable, même ancienne Graph 35 non conforme aux programmes (pas de Python), même ancienne Graph 25/35 inutilisable aux examens (pas de mode examen) et donc invendable. Etiquette de retour fournie, pas de frais de port à payer.
3€ remboursés par Casio sur l'achat de ta calculatrice fx-92 Collège d'ici le 30 Septembre 2024
5€ de remise immédiate sur l'achat de ta calculatrice TI-83 Premium CE Edition Python chez les revendeurs partenaires
4€ de remise immédiate sur l'achat de ta calculatrice TI-82 Advanced Edition Python chez les revendeurs partenaires
3€ de remise immédiate sur l'achat de ta calculatrice TI-82 Advanced chez les revendeurs partenaires
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234567891011121314
-
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.
1077 utilisateurs:
>1062 invités
>9 membres
>6 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
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)