Textured quad colors are off

hurley

Active member
I'm trying to draw a textured quad in viewport space using LWCustomObjAccess but the output color does not match the input.

Here's the code I'm using to produce a white quad in the viewport and below is what I get ..... 255, 255, 193 instead of 255, 255, 255.

Anybody know if I'm doing something wrong or if this is a LW bug?

Code:
void drawTexturedQuad(const LWCustomObjAccess * const drawer)
{
	int w = 256;
	int h = 256;
	int comp = 4;
	int totalBytes = w * h * comp;
	uint8_t * image = new uint8_t[totalBytes];
	std::memset(image, 255, totalBytes);

	// uvs
	Vector2d a(1, 1);
	Vector2d b(0, 1);
	Vector2d c(1, 0);
	Vector2d d(0, 0);
	drawer->setUVs(drawer->dispData, a.data(), b.data(), c.data(), d.data());

	int size = w;
	drawer->setTexture(drawer->dispData, size, image);
	
	// quad vertices
	double z = .001;
	Vector3d p1(0, 0, z);
	Vector3d p2(0, h, z);
	Vector3d p3(w, h, z);
	Vector3d p4(w, 0, z);

	drawer->quad(drawer->dispData, p1.data(), p2.data(), p3.data(), p4.data(), LWCSYS_VIEWPORT);
	
	delete [] image;
}

TexturedQuadProblem.jpg
 

creacon

creacon
I haven't used those before. But I would check first if it is really displaying your texture.
Have you tried putting noise in there? random stuff?

Have you tried to issue a setColor to see if it's not displaying an unshaded quad?

creacon.
 

Sensei

TrueArt Support
I have idea where this yellow is coming from, see
"setColor( dispData, rgba )
Set the current drawing color, including the alpha level.
Calling this is optional. By default, all drawing is done in the color set by the user in the Scene panel when the custom object isn't selected,
and in yellow when the object is selected. "
^^^^^^^^^^^^

Try calling setColor with white color first.
 

hurley

Active member
I have idea where this yellow is coming from, see
"setColor( dispData, rgba )
Set the current drawing color, including the alpha level.
Calling this is optional. By default, all drawing is done in the color set by the user in the Scene panel when the custom object isn't selected,
and in yellow when the object is selected. "
^^^^^^^^^^^^

Try calling setColor with white color first.

That was it. Here's what Jarno had to say

It draws the texture with GL_MODULATE, so it blends with the base colour of the quad. Try setting the draw colour to white.
Also don't forget the effect that colour correction has.
 
Top Bottom