|
enable_triple_buffer - segmentation error |
OICW
Member #4,069
November 2003
|
I'm trying to have three different methods of updating screen - double buffer, page flipping and triple buffer. Basicly I went to allegro examples to get to know how to program them. After getting the ideas I wrote a code to initialize gfx_mode and to redraw the screen using theese three methods. There are two possible ways of initializing the mode. At first it will try to initialize triple buffer, then if gfx_card don't support it it will try to init page flip and at last double buffer. The second way is manualy typing a request as program parameter - this will override checking of gfx_capabilities & GFX_CAN_TRIPLE_BUFFER. When I manualy specify the mode everything goes perfectly. All three modes are working without problems (well under GFX_SAFE only double buffer works because page flip and triple buffer says that they don't have enough memory). But the problem begins when I let the program to set it automaticaly. In the beggining it uses this code to recognise if gfx card is capable of using triple buffer:
It's very similar to ex3buf code from allegro examples, with one exception: this one crashes at calling enable_triple_buffer with "Your program has generated segmentation error: reading or writing to forbidden memory". And I'm curious why this should be when the ex3buf works perfectly and says that it's using real triple buffering. [My website][CppReference][Pixelate][Allegators worldwide][Who's online] |
Todd Cope
Member #998
November 2000
|
It might crash if you haven't done set_gfx_mode(...) yet. |
OICW
Member #4,069
November 2003
|
Oh holy crap, that would be it. I didn't expected that I must set gfx mode prior to call enable_triple_buffer. Heh that would mean I have to rewrite the code a bit. Anyway thank you. Can anybody tell me why under GFX_SAFE it is unable to set three video pages? I'm just curious. [My website][CppReference][Pixelate][Allegators worldwide][Who's online] |
Kitty Cat
Member #2,815
October 2002
|
Quote: Can anybody tell me why under GFX_SAFE it is unable to set three video pages? Because that's the "safe", least featured/accelerated driver. In Windows, it's a windowed GDI mode, which is unable to use video bitmaps (and thus no page flipping or triple buffering). What would probably work, would be:
-- |
OICW
Member #4,069
November 2003
|
Thank you for enlighten me. I changed it to something simillar yesterday and it works. [My website][CppReference][Pixelate][Allegators worldwide][Who's online] |
|