Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1315 → Rev 1314

/demos/trunk/mesatex/mesatex.c
16,7 → 16,7
* http://shark.sssup.it
*/
 
#include <drivers/glib.h>
#include <drivers/vga.h>
#include <drivers/keyb.h>
 
#include <GL/osmesa.h>
35,6 → 35,8
#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;
 
121,6 → 123,7
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,
250,23 → 253,29
 
}
 
static int screen()
static int screen(int mode)
{
 
extern DWORD flbaddr;
/* graphic card Initialization */
if (grx_init() < 1) {
sys_abort(1);
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;
}
if (grx_open(640, 480, 16) < 0) {
cprintf("GRX Err\n");
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;
}
video_buf = (unsigned char *)flbaddr;
video_buf = vga_getgraphmem();
 
grx_setbuffer(rgb_565_buf, WIDTH, HEIGHT); //Init of RGB16 version of grx functions
//created to work with Mesa buffer
return 0;
}
277,7 → 286,7
OSMesaDestroyContext(ctx);
free(rgb_565_buf);
 
grx_close();
vga_setmode(TEXT,CARD);
 
sys_end();
 
295,7 → 304,7
 
while(1) {
 
memcpy(rgb_565_buf, video_buf, RGB565MEM);
copy_videomem_16to16(rgb_565_buf, video_buf, VMEMLONG);
task_endcycle();
 
}
384,7 → 393,7
gl_init();
if (screen()) {
if (screen(INITSTR)) {
printk(KERN_INFO "Graphical initialization failed !!\n");
sys_end();
}