odd representation of textures - EDIT - I is dumb, disregard

Started by
1 comment, last by Cyntalan 15 years, 8 months ago
I have a triangular shaped object, flat on both sides, to where I want a solid color texture on one flat side, and a scribing on the opposite. To do this, I made my textures as necessary, loaded, mapped them accordingly, but this is where things go awry. My first problem might be simple and actually solve my real problem, or maybe that's just how it's done and I have to figure something else out. I've noticed that my texture mapping has actually mapped the texture on both sides, one side a mirror of the other. I know that happens with some setting not in place, but I'm not sure if that's actually what's causing my real problem. I actually built this in half originally so when I began, it looked fine. The scribe was showing fine, rotated it around, noticed the mirror, "meh"d past it thinking when I place the other half in place, I'd never see it anyway. However, when I did place the other half, I was able to see directly through the texture, as if it weren't there, to the other half's texture. Upon rotation, I was able to see through the solid side to the mirrored scribe. Now I'm totally confused. My understanding (from my experience in 3D modelling) is that the normals are backwards. My understanding of openGL is that to draw a triangle with the correct normals, you draw the vertices in counter-clockwise order facing the direction you intend on it being visible. Am I totally missing something? Also, is this explanation of my problem too vague and requiring source code help? [Edited by - Cyntalan on July 25, 2008 3:38:53 PM]
Advertisement
I'm not sure I fully understand your problem. Some screenshots and probably some code would help (at least me [smile]).

In OpenGL you can define whether counter clockwise or clockwise winding describes the front face. You can also define that backface culling should be disabled and that one side should be drawn filled and the other as a wireframe.

You can't define distinct textures for both sides of a triangle (except when using shaders and calculating the side yourself or setting the texture accordingly before drawing the triangle). The driver will draw the triangle and use whatever texture is set, which means due to the "mirroring" of the vertices (including texture coordinates) one side will show the "mirrored" texture.

Drawing two triangles using the same vertices (at least positions) but different winding should work, if you have backface culling enabled. If not, you might suffer from z-fighting, i.e. the driver finds fragments with equal depth and might decide to reject the new ones (if the z-pass condition is GL_LESS), i.e. the triangle drawn first would always prevent the second triangle to show up. Try glEnable(GL_CULL_FACE);
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
EDIT: Boy is my face red. Stupidity on my part was proven by enabling culling. Normals were being drawn EXACTLY how I told 'em.... which was absolutely wrong. Please disregard this waste of disk space and bandwidth. ^^;

This topic is closed to new replies.

Advertisement