Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphics library under Windows -- corruption #3433

Closed
vicuna opened this issue Jan 14, 2005 · 2 comments
Closed

Graphics library under Windows -- corruption #3433

vicuna opened this issue Jan 14, 2005 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 14, 2005

Original bug ID: 3433
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: John Whitington
Version: 3.08 (Windows/mingw)
OS: Windows 2000
Submission from: cpc2-cmbg6-6-0-cust140.cmbg.cable.ntl.com (81.104.214.140)

Dear all,

I have an application which provides debug output using the OCaml Graphics
module. I'm outputting thousands of partial scanlines (represented by a
Graphics.image of height one row and widths from as small as one column) per
second from my renderer.

This works initially but after a few seconds the little images are drawn only
erratically, and then frequently the entire screen (i.e outside the Caml window
as well) goes black, and the Windows furniture / icons are drawn over the top of
this black. The program continues to run, however. It seems there is corruption
of some kind. The two salient features of the input data are small images and
high data rates.

I can try to put together a minimal example if required.

Cheers,

John Whitington

@vicuna
Copy link
Author

vicuna commented Jan 24, 2005

Comment author: administrator

[forwarded to caml-bugs by Damien]

Dear Damien,

Sorry for sending this direct -- I can't work out how to add it to the
previous
bug report.

The attatched code opens a graphical window, and redraws an object at
the
current cursor position on Graphics.Poll.

When I run it (under Windows)

(a) The object sometimes doesn't appear, giving a flickering effect
(This is
actually images not being drawn, rather than flicker due to update,
since we're
using manual syncronisation of the frame buffer)

(b) Resizing or moving the window can cause corruption of the screen
(mostly
turning black and Windows redrawing things wrongly)

Cheers,

John

--
John Whitington


(* Minimal Example for bug 3433 )
(
Compile with support for Graphics library *)
type scanline = Graphics.color array

type sprite = scanline list

let example_scanline w =
Array.init w (fun i -> Graphics.rgb 128 128 (255 - (w * 2)))

let rec example w =
match w with
0 -> []
| _ -> (example_scanline w)::example (w - 1)

let plot_scanline x y l =
let image = Graphics.make_image [|l|] in
Graphics.draw_image image x y

let rec plot_sprite x y spr =
match spr with
[] -> Graphics.synchronize ()
| l::ls -> plot_scanline x y l; plot_sprite x (y + 1) ls

let mine = example 100

let _ = Graphics.open_graph " 400x400"; Graphics.auto_synchronize false

let rec loop oldx oldy =
let {Graphics.mouse_x = mouse_x; Graphics.mouse_y = mouse_y} =
Graphics.wait_next_event [Graphics.Poll]
in
Graphics.set_color Graphics.white;
Graphics.fill_rect (oldx - 1) (oldy - 1) 102 102;
plot_sprite mouse_x mouse_y mine; loop mouse_x mouse_y

let _ = loop 0 0



@vicuna
Copy link
Author

vicuna commented Feb 3, 2005

Comment author: administrator

Fixed DD&XL 2005-02-03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant