Results 1 to 4 of 4

Thread: Textured quad colors are off

  1. #1
    Super Member
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    1,105

    Textured quad colors are off

    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;
    }
    Click image for larger version. 

Name:	TexturedQuadProblem.jpg 
Views:	67 
Size:	57.4 KB 
ID:	136595

  2. #2
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,272
    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.

  3. #3
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,217
    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.

  4. #4
    Super Member
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    1,105
    Quote Originally Posted by Sensei View Post
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •