| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | VioGetPhysBuf 1/ |
DS>I have been doing some full screen graphics programming lately and can not
DS>seem to get VioGetPhysBuf to work. I expected it to be the
DS>easiest part, but it eludes me even though all the 'tough'
DS>parts are working flawlessly.
Here's some code I wrote based on someone else's code for doing full
screen 320x200 graphics, it is loosely modeled after the Borland
graphics interface. It compiles under BCOS/2 but you need to make a
change in BCOS2\INCLUDE\BSESUB.H
APIRET16 APIENTRY16 VioGetState (PVOID16 pState, HVIO hvio);/*ROB
PVOID->PVOID16*/
APIRET16 APIENTRY16 VioSetState (PVOID16 pState, HVIO hvio);/*ROB
PVOID->PVOID16*/
Good luck.
Rob.
// OS2graph.h
#ifndef OS2GRAPH
#define OS2GRAPH
#define DetectVGA256 0
#define DETECT 0
#define grOk 0
int installuserdriver(char *fn, int driver);
int initgraph(int *gdriver, int *gmode, char *path);
int graphresult(void);
char *grapherrormsg(int msg);
int closegraph(void);
void VGASetAllPalette(char *palette, int size);
int lockgraph(void);
int unlockgraph(void);
int graphblit(void *buf, int width, int height);
#endif
// OS2graph.cpp
#include
#include
#include
#define INCL_BASE
#include
#include "os2graph.h"
#define SEG16 _far16
#define SCN_W 320
#define SCN_H 200
VIOMODEINFO vmiOld;
int scn_w, scn_h;
unsigned char palette[0x100][3];
int npalette;
int data_depth;
unsigned char *VGARAMptr;
int debug=0;
int installuserdriver(char *fn, int driver) {
return(grOk);
};
int initgraph(int *gdriver, int *gmode, char *path) {
VIOMODEINFO vmi;
VIOPHYSBUF phys;
VIOOVERSCAN vioos;
unsigned char SEG16 * ptr1616;
unsigned char status;
vmi.cb = 12;
vmi.fbType = 3;
vmi.color = 8;
vmi.col = 40;
vmi.row = 25;
vmi.hres = SCN_W;
vmi.vres = SCN_H;
vmiOld.cb=34;
VioGetMode(&vmiOld, (HVIO) 0);
if ( VioSetMode(&vmi, (HVIO) 0) )
{
debug=1; return(grOk);
fprintf(stderr, "Unable to enter 320x200 at 8pp graphics
mode\n");
exit(1);
}
phys.cb = 0x10000;
phys.pBuf = (unsigned char *) 0xa0000;
if ( VioGetPhysBuf(&phys, 0) )
{
debug=1; return(grOk);
fprintf(stderr, "Unable to access to physical graphics
screen\n");
exit(1);
}
ptr1616 = (unsigned char SEG16 *) ( phys.asel[0] << 16 );
VGARAMptr = (unsigned char *) ptr1616;
VioScrLock(VP_WAIT, &status, (HVIO) 0);
/* Set screen to colour 0, which will get set to black */
memset(VGARAMptr, 0, SCN_W*SCN_H);
/* Set all palette entrys to black */
memset(palette, 0, sizeof(palette));
VGASetAllPalette((char *) palette, 0x100);
/* Set border colour to colour 0 */
vioos.cb = sizeof(VIOOVERSCAN);
vioos.type = 1; /* Apparently no #define for this */
vioos.color = 0;
VioSetState(&vioos, (HVIO) 0);
VioScrUnLock((HVIO) 0);
return(grOk);
};
int graphresult(void) {
return(grOk);
};
char *grapherrormsg(int msg) {
return(NULL);
};
int closegraph(void) {
if (debug) return(grOk);
VioSetMode(&vmiOld, (HVIO) 0);
return(grOk);
};
void VGASetAllPalette(char *palette, int size) {
if (debug) return;
VIOCOLORREG viocreg;
>>> Continued to next message
___
X SLMR 2.1a X recursive (ree 'cuhr siv) adj. - see recursive.
--- Maximus/2 2.01wb
* Origin: The Idle Task... (604)275-0835 Richmond BC. (1:153/905)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 153/905 828 800 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.