Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Conoktra

Member Since 31 Aug 2010
Offline Last Active Aug 18 2014 03:48 PM

Posts I've Made

In Topic: Bullet Physics - Objects pass through certain triangles in mesh

03 June 2014 - 04:27 PM

Thank you to everyone the help!  It turns out it was the "sliver" problem.  Marching cubes was making some triangles that where simply too small and narrow in certain places.  Tweaking the scale was able to increase the stability.  Thanks again.


In Topic: OpenGL color interpolation not linear?

03 January 2014 - 01:07 AM

Thanks for the help!

 


Also, are you actually rendering a quad, or is it 2 triangles?

It's being rendered as two triangles.  I've read that OpenGL uses the "Barycentric coordinate system" which might cause the issue as seen here.  But that individual was rendering in 2D, so he was able to bypass the problem by generating his texture coordinates from screen space (rather then interpolating them from the vertices).

 


Maybe post some more code/explanation of what you're doing?

Drawing two quads (one red and one green) that overlay and blend together to create a linear fade from red to green (as is seen in image B).  Somehow the interpolation of the color channel is non-linear, resulting in the background bleeding through as is seen in image A.  Code:

// Draw the red quad
glBegin(GL_TRIANGLES);

glVertex3f(0, 1, 0);
glColor4f(1, 0, 0, 0);

glVertex3f(1, 1, 1);
glColor4f(1, 0, 0, 0);

glVertex3f(1, 1, 0);
glColor4f(1, 0, 0, 1);

glVertex3f(0, 1, 1);
glColor4f(1, 0, 0, 1);

glVertex3f(1, 1, 1);
glColor4f(1, 0, 0, 0);

glVertex3f(0, 1, 0);
glColor4f(1, 0, 0, 0);

glEnd();

// Draw the green quad
glBegin(GL_TRIANGLES);

glVertex3f(0, 1, 0);
glColor4f(0, 1, 0, 1);

glVertex3f(1, 1, 1);
glColor4f(0, 1, 0, 1);

glVertex3f(1, 1, 0);
glColor4f(0, 1, 0, 0);

glVertex3f(0, 1, 1);
glColor4f(0, 1, 0, 0);

glVertex3f(1, 1, 1);
glColor4f(0, 1, 0, 1);

glVertex3f(0, 1, 0);
glColor4f(0, 1, 0, 1);

glEnd();


What are the vertex colors at each of the 4 corners of the two quads?
What blend mode are you using?
Are you rendering to sRGB?

See the above for vertex colors.  The blend mode is glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). I am using sRGB. I am using Ogre3D so I can't verify that gamma correction isn't happening for sure.

 

I got Googling and added "fragColour.a = pow(outColour.a, 1.0 / 5.0);" to my shader rather then "fragColour.a = outColor.a;" and it seems to have done the trick!  Reading the OpenGL registry though says gamma correction shouldn't happen on alpha values for textures.  What about vertex colors?  That and a gamma factor of 5 is a lot bigger then the standard 2.2.


In Topic: Template specialization and class references

20 March 2013 - 07:43 PM

The point was more that its not impossible to compile classes with same name.smile.png

Even the most sound code can be broken when you throw scenarios at it that are specifically designed to break it.  My compiler doesn't mangle the class names nor do I use namespaces, hence neither is an issue.


In Topic: Template specialization and class references

20 March 2013 - 12:17 PM

typeid(T).name() + 6
W.


T.


F.

 

tolua++ needs to know the class's typename or else its treated as a void* inside lua.  The "typeid(T).name + 6" skips the "class " prefix and only passes the classes unique type name ("class MyClass" -> "MyClass") which is what tolua++ expects.  luaPushArg() has specialized template instances for all non-class types (thus avoiding the issue of instantiating the template with, say, an int).  That way I can pass any class to lua without having to define a specialized instance of luaPushArg() for each class type.  With hundreds of classes exported to lua, this saves a lot of time and code.

 

 

holy crap is that non-portable

Portability isn't an issue.  If it was fixing it would be a matter of a couple of #ifdefs.  Whoopdeedoo.

 

 

would cause serious problems if you have two classes with the same name.

Its not possible to have two classes with the same typename.  Period. Try to compile this:

 

class A { };
class A { }; // error C2011: 'A' : 'class' type redefinition

In Topic: Pay someone without PayPal

05 September 2012 - 09:13 AM

Thanks for the feedback guys, I appreciate it.

PARTNERS