π
<-
Chat plein-écran
[^]

double buffering avec nSDL

C, C++, ASM...

double buffering avec nSDL

Unread postby newprog_creator » 23 May 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: Select all
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;
}
User avatar
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 74.2%
 
Posts: 67
Joined: 29 Mar 2014, 19:07
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: bac+13

Re: double buffering avec nSDL

Unread postby Vogtinator » 23 May 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.
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

Re: double buffering avec nSDL

Unread postby newprog_creator » 23 May 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
User avatar
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 74.2%
 
Posts: 67
Joined: 29 Mar 2014, 19:07
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: bac+13

Re: double buffering avec nSDL

Unread postby newprog_creator » 23 May 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
User avatar
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 74.2%
 
Posts: 67
Joined: 29 Mar 2014, 19:07
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: bac+13

Re: double buffering avec nSDL

Unread postby Vogtinator » 24 May 2023, 10:03

newprog_creator wrote: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
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

Re: double buffering avec nSDL

Unread postby newprog_creator » 24 May 2023, 16:00

Thanks for your response
User avatar
newprog_creatorProgrammeur
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 74.2%
 
Posts: 67
Joined: 29 Mar 2014, 19:07
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: bac+13


Return to Native: Ndless, Linux, ...

Who is online

Users browsing this forum: No registered users and 25 guests

-
Search
-
Social TI-Planet
-
Featured topics
"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
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1207 utilisateurs:
>1191 invités
>12 membres
>4 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)