I feel like a Noob C++ GL 4.1 and GLSL 3.3 help please!

Started by
12 comments, last by mynameisnafe 10 years, 1 month ago

Next step, get an importer/exporter system for 3D models instead of programmatically making geometry. Should be first thing on your todo list.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Advertisement

From the original post you seem to have specified the quad verts as botRight -> botLeft -> topLeft -> topRight, but the quad texcoords were

topLeft -> topRight -> botRight -> botLeft so the order didnt match.

This is exactly my problem! I've been doing some testing with my 3 shaders.

- The basic coloured one always works on models and on the quad.
- The coloured phong shader on models works (does it..?) - the models appear blue and shiny, like the cube there. But it doesn't work on my quad - until
- The textured phong shader works on the quad - when I set all the normals to (0.0, 0.0 -1.0) - so does the coloured phong shader.

I haven't tried a texture on a mesh.. though obviously I want to. So my quad is wound all wrong! And my texturing stuff works.

So what order is the most used or correct way to wind a quad? I'm always worrying about triangles recently.

I would imagine it should be top right, bottom right, top left, bottom left? Or do you do them counter/clockwise, like a tri, - something like bottom right, top right, top left, bottom left? I'm guessing this is important for rendering meshes that are quads?

Using your texture coordinates, and making x0 negative and x1 positive, y0 negative and y1 positive (that was poor mistake I admit), and setting my normals to -Z, I get this with the textured phong shader. Is my Quad wound the wrong way?


Winding and texture coord order is important for everything, I use CCW = front, but it doesnt matter you just have to make sure its consistent with your cull winding.

If your vertex winding is not what you intended then your triangles will have their front faces culled when backface culling is enabled. You see this in poorly created models that have missing triangles when view from the outside, its because the winding on all the triangle is not consistent

If your texture coordinates dont fall where they should your texture might be distored, flipped horzontally or vertically. With textures like rocks with no obvious up/down left/right it can make it difficult to notice these problems. Make a basic texture for testing. Say with a capital L on the left of the image, colored red, T at top for top another color, Bottom, Right, etc. Give it a 1 pixel border, place a circle dead center. This will help you notice flips, stretches, and tiling better. Use a white background so you can notice any strange color changes.

Im not sure if what Im seeing is wrong, because If have no way to gauge if that texture looks wrong or not, Its features dont say right or wrong.

I know about winding in general, I guess I meant which corner do I start from? - I am using GL_QUADS.

Im going to check my culling settings, pretty sure I'm using using counter clockwise and culling back faces.. Ill edit this post when I find out, just cooking

PS that texture has some text on it, its just a random sample.

This topic is closed to new replies.

Advertisement