From: Allan Carhart Newsgroups: comp.os.msdos.djgpp Subject: Graphics Question (switching pages) Date: Mon, 10 Mar 1997 11:20:11 -0800 Organization: Sierra-Net Lines: 96 Message-ID: NNTP-Posting-Host: carhart.com Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hello everyone, I am near the end of a project which I'm in a bind trying to finish. I have invested over 40 hours of my time on this project, and expect to received a significant amount of money for the final product -- However, if I don't finish it, I don't get paid. And if it isn't finished quickly, my client will loose interest and go elsewhere. The program: A JPEG viewer written for MS-DOS with various configurable options tailored to the clients needs. (current version downloadable at ftp://carhart.com) What works: It reads JPEG files correctly, loads them into memory, displays each on the screen in a slideshow manner, scales them to a configurable ratio, etc. The platform: DJGPP (2.x) I am using version 2.0 of the graphics package with DJGPP which claims to provide all the capabilities of Turbo C. The problem: My client still doesn't like the speed with which the images get drawn on the screen. Even though the decompression is done at the beginning (before I view any images, they are all decompressed into memory), the time it takes just to plot the images on the screen is too long. One side question: I am using a resolution of 640x480 800x600 or 1024x768 with 256 or 65536 colors. The client wants to be able to view a few images on the screen at once, so a minimum of 640x480x256 is needed. Am I correct in assuming that this qualifies as SVGA? If not, I know that 800x600x256 is. Does SVGA graphics immediately imply the program will not be portable due to differences in video cards? Any 'generic' video card that I can program for? This is especially relevant if I need to write into video memory. My current plan: I have tried to swap pages, so I could plot pixels on a page not being viewed, and then bring it up so the image is seen as appearing instantly. What's important here is that the delay happen while the screen is black and the image appear in one piece. My current problem with this plan: I've tried the functions setvisualpage() and setactivepage() but they just DONT DO ANYTHING! When I call getvisualpage() and getactivepage() they always return 0. I really don't have very much documentation on this, and have done everything I can think of. I am a reasonably good programmer, but have exhausted my knowledge and resources. I have searched the web and SimTel archives for resources, but it seemed that this newsgroup had the most potential for help. I'll do whatever it takes to solve this problem. Should I switch to another compiler? Should I bite the bullet and go out and buy one? This program must be in DOS. Will other compilers give me trouble with the 640K/1-meg boundary? Or is there a more low-level way to do this? I have no experience with 80x86 assembly -- all my assembly experience is on the 68000 series and on the sparc. However, I'm not afraid to try it. Should I try to write straight to video memory? Can I do this is a somewhat portable way? (different video cards, I mean) There is only one client with potentially just one computer. So portability can be sacrificed if need by. If you can give me any information, I'd really appreciate it. Specifically: 1) references where I can read about this in books or on the web 2) real code snips that work 3) information about how to write to video memory 4) background on what's going on with setvisualpage() and setactivepage() (and why the don't seem to work with gcc?) 5) success stories with DJGPP (gcc for DOS) graphics programming. Thanks in advance. I really appreciate it. -Allan Carhart allan AT carhart DOT com P.S. I am a college student, so the time I have is limited. That's why I'm looking for a shortcut by posting to this group. However, I'll still do what it takes to get this accomplished. i.e., reading, learning, programming, debugging, troubleshooting.