Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > Visible triangl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4796 of 5041
Post > Topic >>

Visible triangles when using GL_QUADS?

by parks <donovan.parks@[EMAIL PROTECTED] > Jun 14, 2008 at 04:09 PM

Hello,

I am having troubles correctly setting up OpenGL blending when using
an orthographic projection. The problem is that when I render a square
using GL_QUADS I can clearly see the two triangle that are used to
construct the square (see :
http://dparks.wikidot.com/local--files/file-dump/WhyCanISeeTheTriangles.jpg).
If I disable blending the problem goes away (I get a nice solid blue
square). Can one not combine blending and orthographic projection? Is
there something special about orthographic projections that cause this
problem? This is my first time using orthographic projections and have
never had this problem when using perspective projections.

My initialization code is as follows:

glClearColor(1.0f, 1.0f, 1.0f, 0.0f);		// White Background

glDisable(GL_DEPTH_TEST);	// disable depth testing since we are using
a single 2D plane
glDepthMask(GL_FALSE);		// disable depth mask to improve visual
quality of lines

// setup antialiasing and blending to optimize appearance
glShadeModel(GL_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

// setup view****t
glView****t(0, 0, GetSize().x, GetSize().y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

// use a simple orthographic projection
gluOrtho2D(0, GetSize().x, 0, GetSize().y);	// the ftgl library
expects the bottom, left corner to be (0,0)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();


I render the square using the following code:

glColor3f(0.2f, 0.2f, 1.0f);
glBegin(GL_QUADS);
  glVertex2i  (25, 25);
  glVertex2i  (75, 25);
  glVertex2i  (75, 75);
  glVertex2i  (25, 75);
glEnd();


Any and all help is greatly appreciated. I've been banging my head
against this one for a day now and am not sure what to do except turn
off blending (which I had hoped to use!).

Cheers,
Donovan
 




 3 Posts in Topic:
Visible triangles when using GL_QUADS?
parks <donovan.parks@[  2008-06-14 16:09:06 
Re: Visible triangles when using GL_QUADS?
fungus <openglMYSOCKS@  2008-06-14 16:18:17 
Re: Visible triangles when using GL_QUADS?
parks <donovan.parks@[  2008-06-14 17:58:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 0:04:41 CST 2008.