Hey guys i couldnt exactly find a solution and the maya docs on this arent
clear at all.
I currently have the implementation working for the old viewport working and i
cant find anything on the getting the 2.0 to work.
so far heres the code i have.
in my maya scene i have a file node with a file plugged in so i can have image
data existing without it being plugged in.
now it does set the overall color when the texture doesnt exist(which is what
i have it set up to do) but i think im missing a step in setting it up or
setting to the gl or something
MHWRender::MTextureManager *textureManager =
renderer->getTextureManager();
if(textureManager){
MImage image;
MSelectionList selection;
selection.add("file1");
MObject obj;
selection.getDependNode(0, obj);
image.readFromTextureNode(obj);
image.resize(1024, 1024, false);
unsigned int width, height;
image.getSize(width, height);
MHWRender::MTextureDescription textureDesc;
textureDesc.setToDefault2DTexture();
textureDesc.fWidth = width;
textureDesc.fHeight = height;
textureDesc.fDepth = 1;
textureDesc.fBytesPerRow = 4*width;
textureDesc.fBytesPerSlice =
textureDesc.fBytesPerRow*height;
textureDesc.fTextureType = MHWRender::kImage2D;
// textureDesc.fEnvMapType = MHWRender::kEnvNone;
// Construct the texture with the screen pixels
mColorTexture.texture = textureManager->acquireTexture("",
textureDesc, image.pixels());
if(mColorTexture.texture){
mColorTexture.texture->textureDescription( textureDesc
);
fColorShaderInstance->setParameter("diffuseColor",
mColorTexture);
// textureManager->releaseTexture(texture);
cout << "got texture" << endl;
}else{
cout << "no texture" << endl;
fColorShaderInstance->setParameter("diffuseColor",
&fDiffuse[0]);
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/f1edce8e-c5e4-4824-809e-409823d0ae77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.