PDA

View Full Version : OpenGL only textures half of a Quad



Exaxis
10-01-2011, 04:51 PM
I'm having a very strange issue with something that is very simple. I'm only trying to draw a texture onto a quad - something I've been able to do successfully several times before. Unfortunately, OpenGL is only texturing the bottom-right half of a quad. Instead of one rectangular texture, I'm getting a triangle. Here is the relevant code:

<div class="ubbcode-block"><div class="ubbcode-header">Click to reveal.. <input type="button" class="form-button" value="Show me!" onclick="toggle_spoiler(this, 'Yikes, my eyes!', 'Show me!')" />]<div style="display: none;">

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-2.0f, -4.0f, -7.0f); //Bottom-left vertex
glTexCoord2f(1.0f, 0.0f);
glVertex3f(2.0f, -4.0f, -7.0f); //Bottom-right vertex
glTexCoord2f(1.0f, 1.0f);
glVertex3f(2.0f, 4.0f, -7.0f); //Top-right vertex
glTexCoord2f(0.0f, 1.0f);
glVertex3f(2.0f, 4.0f, -7.0f); //Top-left vertex
glEnd();
[/QUOTE]</div>

I can not for the life of me figure out what it is I'm doing wrong - I was able to render a full texture to a quad before using almost exactly the same code.

What am I doing wrong?

Exaxis
10-01-2011, 05:22 PM
Nevermind. I discovered my mistake - I had not plotted out the final vertex of the quad correctly. Copy and paste got the better of me.