Re: gl_freecontext() problems

Search this archive.

From: Jay Link (jlink@interlink-bbs.com)
Date: Sun 04 Apr 1999 - 16:31:51 IDT


> I have run into a problem in that I can't get my virtual screen to
> display on the physical - this makes it rather difficult to see what's
> going on :) 

You forgot to gl_setcontextvga(35) . (you had vgavirtual, but you need
vga, too). That will fix your gl_freecontext() problems, too.

-J

#include <stdio.h>
#include <stdlib.h>
#include <vgagl.h>
#include <vga.h>

main()
{
	GraphicsContext *virtualscreen;
	GraphicsContext *physicalscreen;

	vga_init();

/*** create virtual screen ***/
	gl_setcontextvgavirtual(35);  /* G800x600x16M32 */
	virtualscreen=gl_allocatecontext();
	gl_getcontext(virtualscreen);

/*** create physical screen ***/
	vga_setmode(35);
        /* fix below */
	gl_setcontextvga(35);  /* G800x600x16M32 */
	physicalscreen=gl_allocatecontext();
	gl_getcontext(physicalscreen);

	gl_setcontext(virtualscreen);

	/* draw something here using gl_setpixelrgb() */

	gl_copyscreen(physicalscreen);
	/*** the documentation appears to be wrong here in that */
	/*** gl_copyscreen(&physicalscreen) is suggested yet this */
	/*** causes a compilation error for me */

	while(getchar() != 'x');
	/*** at this stage, I should have something visible and be */
	/*** waiting for an 'x' input to terminate the programme   */
	/*** but in fact I am left looking at the same blank screen */
	/*** that I started with :(  */

	vga_setmode(TEXT);
	gl_freecontext(virtualscreen);
/*	gl_freecontext(physicalscreen);*/
	/*** the commented out line above causes a segmentation fault */
	/*** as discussed in my last post                             */

	return (0);

}


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:22 IST