Text + GL

Post Reply
LoopStan
Posts: 2
Joined: Wed Jun 15, 2011 10:14 am

Text + GL

Post by LoopStan » Wed Jun 15, 2011 10:15 am

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?

Discostew
Posts: 103
Joined: Sun Mar 08, 2009 7:24 pm

Re: Text + GL

Post by Discostew » Wed Jun 15, 2011 9:47 pm

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.

zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: Text + GL

Post by zeromus » Wed Jun 15, 2011 11:25 pm

look for relminator's easy gl2d stuff in this forum

LoopStan
Posts: 2
Joined: Wed Jun 15, 2011 10:14 am

Re: Text + GL

Post by LoopStan » Thu Jun 16, 2011 1:32 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests