Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1314 → Rev 1315

/demos/trunk/mesatex/mesatex.c
16,7 → 16,7
* http://shark.sssup.it
*/
 
#include <drivers/vga.h>
#include <drivers/glib.h>
#include <drivers/keyb.h>
 
#include <GL/osmesa.h>
35,8 → 35,6
#define WIDTH 640
#define HEIGHT 480
#define BYTES_PP 2 //BytesPerPixel
#define INITSTR G640x480x64K //SVGAlib standard mode definitions
#define CARD VESA //Video driver
 
OSMesaContext ctx;
 
123,7 → 121,6
static void gl_init()
{
 
static GLfloat h = (GLfloat) HEIGHT / (GLfloat) WIDTH;
static int twidth=8, theight=8;
static GLubyte tex1[] = {
0, 0, 0, 0, 0, 0, 0, 0,
253,29 → 250,23
 
}
 
static int screen(int mode)
static int screen()
{
 
vga_modeinfo *minf;
 
vga_setmode(mode,CARD);
minf = vga_getmodeinfo(mode);
if(! (minf->flags & CAPABLE_LINEAR)){
vga_setmode(TEXT,CARD);
printk(KERN_INFO "The mode %d is not capable of linear\n",mode);
return 1;
extern DWORD flbaddr;
/* graphic card Initialization */
if (grx_init() < 1) {
sys_abort(1);
}
vga_setpage(0);
if(vga_setlinearaddressing() == -1) {
vga_setmode(TEXT,CARD);
printk(KERN_INFO "Could not set linear addressing for mode %d\n",mode);
return 1;
if (grx_open(640, 480, 16) < 0) {
cprintf("GRX Err\n");
sys_abort(1);
}
video_buf = vga_getgraphmem();
video_buf = (unsigned char *)flbaddr;
 
grx_setbuffer(rgb_565_buf, WIDTH, HEIGHT); //Init of RGB16 version of grx functions
//created to work with Mesa buffer
return 0;
}
286,7 → 277,7
OSMesaDestroyContext(ctx);
free(rgb_565_buf);
 
vga_setmode(TEXT,CARD);
grx_close();
 
sys_end();
 
304,7 → 295,7
 
while(1) {
 
copy_videomem_16to16(rgb_565_buf, video_buf, VMEMLONG);
memcpy(rgb_565_buf, video_buf, RGB565MEM);
task_endcycle();
 
}
393,7 → 384,7
gl_init();
if (screen(INITSTR)) {
if (screen()) {
printk(KERN_INFO "Graphical initialization failed !!\n");
sys_end();
}
/demos/trunk/mesatex/makefile
12,5 → 12,5
include $(BASE)/config/example.mk
 
mesatex:
make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__OSMESA__ __OLDCHAR__ __SVGA__"
make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__OSMESA__ __OLDCHAR__ __GRX__"