HTML rendering with OpenGL and C++

Tags

, , , , , , , , , , , , ,

Peters stared through the iron bars. ‘Words,’ he barked, his chin dripping with saliva.

I cranked up my C++ Microsoft Visual Studio application (with the Oculus SDK for Windows and OpenGL graphics library) and added some words to a TV screen:

I have already figured how to do an HTTP request and HTML parsing with C++

And also how to turn my hand at Text rendering with OpenGL and C++

I got out the glue stick and stuck together the latest news headlines from the web with the green letters upon the TV screen.

There was some new C++ code though. A simple scroll function for the headlines:

string ScrollData() {

	if (ScrollTimer >= ScrollTimerEnd) {
		ScrollTimer = 0;
		ScrollPos++;
	}
	else {
		ScrollTimer++;
	}

	return Data.substr(ScrollPos, ScrollLen);
}

Very simple, Alan. A substring of the data fetched from the web is returned from the function. We bolt on the next letter of the data once the timer has ended (and ditch the first letter). I’m using an int to control the timer (but could use system time, if concerned with frame rate variance affecting the text scrolling speed).

ScrollTimerEnd is set to 40. ScrollLen is set to 25.

I put the Oculus Rift virtual reality headset onto Peters head and my rotund Dutch chum read out the news headlines.

‘Oh, too many shifts in world order. Take it off!’ he screamed. His blubber was shaking.

I buttered up some toast and Peters began to calm down.

Bad news

Advertisements