Page 1 of 1

Text + GL

Posted: Wed Jun 15, 2011 10:15 am
by LoopStan
Hello, I am trying to render text onto a quad, or on top of, and I can't find out how to do this anywhere. this is my code for drawing so far:

Code: Select all

glBegin(GL_QUAD);

			glColor3b(53,149,216);
			glVertex3v16(inttov16(-1), inttov16(-1),0);

			glColor3b(92,188,255);
			glVertex3v16(inttov16(1), inttov16(-1), 0);

			glColor3b(73,169,236);
			glVertex3v16(inttov16(1), inttov16(1), 0);

			glColor3b(33,129,196);
			glVertex3v16(inttov16(-1), inttov16(1), 0);

		glEnd();
Where and how can I draw text into that so it will be manipulated along with the rest of the things in my matrix functions?

Re: Text + GL

Posted: Wed Jun 15, 2011 9:47 pm
by Discostew
Textures are the way go for this imo. Look to the texture examples to get you started. Then, once you understand that, it's as simple as using textures that have the ASCII characters on them.

You'd basically take what you have now, do some prior initialization and texture loading, bind the texture (ASCII character) you want to use, then applying it with using texture coordinates before each vertex.

Re: Text + GL

Posted: Wed Jun 15, 2011 11:25 pm
by zeromus
look for relminator's easy gl2d stuff in this forum

Re: Text + GL

Posted: Thu Jun 16, 2011 1:32 am
by LoopStan
Thank you very much for your help. With East GL2D I should be able to have that code inside my glPushMatrix(); and pop so it will transform it with the shape or will it work sort of the same as the textures like what Discostew said.