glCallLists drives me nuts

Started by
1 comment, last by szecs 14 years, 5 months ago
void glMenuPrintHighlight(int x,int y,int z,int q,const char *fmt,...)
{	
	char str[1000];
	int prev_i = 0,i = 0;
	va_list ap;

	va_start(ap, fmt);
	    vsprintf(str, fmt, ap);
	va_end(ap);

	glListBase(MenuFontOffset-32);

	while( 1 )
	{	
		glWindowPos3i(x,y,z);

		if( i == 0 )
			glColor4f(0,0,0,1);
		else
			glColor4f(0.9921875, 0.8125, 0.26953125, 1.0);

		while( str && str != '\n' )
			i++;
							
		glCallLists(i-prev_i, GL_UNSIGNED_BYTE, (GLubyte *)(str+prev_i));

		if( !str )
			break;

		i++;
		
		prev_i = i;
		y -= 20;
		q--;
	}
}
OK I'm still in C Anyway: What I'm excepting: the first line is drawn black, the others orange. What I get: the second line is drawn black, the others orange. It seems that the glColor is executed after glCallLists. It's a test version, that's why I'm checking 'i', instead of 'q'. I'm sure this will be just another stupid bug, that I always post.
Advertisement
The raster color is copied from the primary color when you set the raster position. You need to set the primary color before glWindowPos so the correct raster color is set also.
Ahaaa!
I would never guess that for myself.
Thanks again Brother Bob!

This topic is closed to new replies.

Advertisement