π
<-
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_creator
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 29.7%
 
Posts: 57
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 8: ER (Espèce Rare: nerd)
Niveau 8: ER (Espèce Rare: nerd)
Level up: 98.4%
 
Posts: 213
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_creator
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 29.7%
 
Posts: 57
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_creator
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 29.7%
 
Posts: 57
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 8: ER (Espèce Rare: nerd)
Niveau 8: ER (Espèce Rare: nerd)
Level up: 98.4%
 
Posts: 213
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_creator
Niveau 7: EP (Espèce Protégée: geek)
Niveau 7: EP (Espèce Protégée: geek)
Level up: 29.7%
 
Posts: 57
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 2 guests

-
Search
-
Social TI-Planet
-
Featured topics
Concours de dessin Star Wars par Casio jusqu'au 1er juin 2023 : programme ton dessin sur ta fx-92 Collège ou bien en Python sur ta Graph 90/35+E II. 2 consoles de jeux Nintendo Switch avec jeu Star Wars à gagner !
Comparaisons des meilleurs prix pour acheter sa calculatrice !
14€ remboursés par Casio sur l'achat de ta calculatrice Graph 35 d'ici le 31 Octobre 2023
Reprise de ton ancienne fx-92 Collège ou Graph 25/35/90 à 5€. Même non fonctionnelle ou ancien modèle. 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 2023
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
12345678
-
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.
781 utilisateurs:
>740 invités
>36 membres
>5 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)