Skip to main content
GameDev.net gamedev.net
🔒 Locked

2D Graphics

Started by dagabe14 Feb 25, 2009 at 1:55 AM 1 replies 700+ views
Original Post
dagabe14
dagabe14
so, first off I'm going to say that I'm not a graphics programmer, I'm an AI programmer, attempting to write a 2D app to test some of my AI behaviors, but I do have some basic understanding of opengl and graphics programming. So, I'm using glut to make my life easier, and I set it up with gluOrtho2D( 0, 800, 0, 600 ); The problem was that when I made a quad (for the background texture) and its dimensions is 1x1, and it covers a big part of the screen. This doesn't make sense to me since the ortho call should have made it so that the bottom left pixel is (0,0) and the top right pixel is (800,600). Is there a way to fix this so that my assumption of the ortho call is correct? Thank you very much in advance! [EDIT: well, i figured it out, i forgot to make glMatrixMode and glLoadIdentity, and that did it] [Edited by - dagabe14 on February 25, 2009 2:26:12 AM]
Wavarian
Wavarian
double RESOLUTION_X = 800.0;double RESOLUTION_Y = 600.0;void Draw(){	glMatrixMode(GL_PROJECTION);	glLoadIdentity();	glOrtho(0.0, RESOLUTION_X, 0.0, RESOLUTION_Y, -1.0, 1.0);	glMatrixMode(GL_MODELVIEW);	glLoadIdentity();	//	// Clear the screen	//	glClear(GL_COLOR_BUFFER_BIT);	//	// Render the scene	//	glBegin(GL_QUADS);		glVertex2i(100, 100);		glVertex2i(150, 100);		glVertex2i(150, 150);		glVertex2i(100, 150);	glEnd();}


EDIT: for some reason I missed your edit :(
iliak
iliak
Hi

If you want to make 2D drawing, you can test my framework (look at my signature). I'll upload a new version very soon with really big improvemnts.
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.