• Content count

  • Joined

  • Last visited

Community Reputation

178 Neutral

About Papadopol

  • Rank
  1. Qt in Maya

    Hello. Im building a Maya plugin with the QT gui library for the first time and I'm having some problems compiling. I'm using Visual Studio 2012 and Maya 2014 with included QT lib and include folder. The problem is that I didnt found any Visual Studio project with QT only a .cpp and .h files. I tryed to use an existing Visual Studio plugin project to compile with QT and I get some errors: 1>helixQtCmd.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl HelixButton::metaObject(void)const " (?metaObject@HelixButton@@UEBAPEBUQMetaObject@@XZ) 1>helixQtCmd.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl HelixButton::qt_metacast(char const *)" (?qt_metacast@HelixButton@@UEAAPEAXPEBD@Z) 1>helixQtCmd.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl HelixButton::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@HelixButton@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z) I linked all the libraries for QT and include folders. Also I'm using the helixQtCmd.h as a HEADER FILE and not Custom Build Tool with MOC.EXE I dont understand this moc system. I compiled the .h file with moc and it generated me another cpp file. What should I do with that cpp file? The helixQtCmd sample plugin should run with or without moc generation ? Thank you for your time.
  2. Alpha mapping with a .DDS, DX11

    Hello. I'm rendering a text with a DDS file texture that has Alpha enables so it can render letters as quads. Im using DDS with no compression for quality reasons.  The resulting image will be r,g,b beeing 0 and alpha the surroundings the rest of thexture that is not character body. When the imagine has r,g,b = 0 the text is back with correct Alpha but when I try to modify the r,g,b to any value it also colores the alpha zone even if I keep alpha at the same value.  The thing is that I want to make different colored characters and I dont understand why I cant modify different pixels after Sampling the texture. [source] blendStateDescription.RenderTarget[0].BlendEnable = TRUE; blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; blendStateDescription.RenderTarget[0].RenderTargetWriteMask = 0x0f; [/source]   [source]   void PS( in PixelInputType inpt , out float4 colorOut : SV_Target ) { colorOut = shaderTexture.Sample(SampleType, inpt.tex); colorOut = float4(0.7f, 0.7f,0.7f,colorOut[3]); // here I try to color the text by overwriting a given pixel that by default mapped from texture should be black (rgb 0 and custom alpha). }[/source]  
  3. DDS on openGL on 64bit

    Hello. I'm using a samplecode from to load a compressed DDS to openGL and it seems to work on 32 bit compilation but not on x64. [code]  void loadCompressedTexture( void ) { DDS_IMAGE_DATA *pDDSImageData = loadDDSTextureFile( "" ); if( pDDSImageData != NULL ) { int nHeight = pDDSImageData->height; int nWidth = pDDSImageData->width; int nNumMipMaps = pDDSImageData->numMipMaps; int nBlockSize; if( pDDSImageData->format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ) nBlockSize = 8; else nBlockSize = 16; glGenTextures( 1, &g_compressedTextureID ); glBindTexture( GL_TEXTURE_2D, g_compressedTextureID ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); int nSize; int nOffset = 0; // Load the mip-map levels for( int i = 0; i < nNumMipMaps; ++i ) { if( nWidth == 0 ) nWidth = 1; if( nHeight == 0 ) nHeight = 1; nSize = ((nWidth+3)/4) * ((nHeight+3)/4) * nBlockSize; glCompressedTexImage2DARB( GL_TEXTURE_2D, i, pDDSImageData->format, nWidth, nHeight, 0, nSize, pDDSImageData->pixels + nOffset ); nOffset += nSize; // Half the image size for the next mip-map level... nWidth = (nWidth / 2); nHeight = (nHeight / 2); } } if( pDDSImageData != NULL ) { if( pDDSImageData->pixels != NULL ) free( pDDSImageData->pixels ); free( pDDSImageData ); } }[/code]     [code] DDS_IMAGE_DATA* loadDDSTextureFile( char *filename ) { DDS_IMAGE_DATA *pDDSImageData; DDSURFACEDESC2 ddsd; char filecode[4]; FILE *pFile; int factor; int bufferSize; // Open the file pFile = fopen( filename, "rb" ); if( pFile == NULL ) { char str[255]; // sprintf( str, "loadDDSTextureFile couldn't find, or failed to load \"%s\"", filename ); MessageBox( NULL, L"loadDDSTextureFile couldn't find, or failed to load ", L"ERROR", MB_OK|MB_ICONEXCLAMATION ); return NULL; } // Verify the file is a true .dds file fread( filecode, 1, 4, pFile ); if( strncmp( filecode, "DDS ", 4 ) != 0 ) { char str[255]; // sprintf( str, "The file \"%s\" doesn't appear to be a valid .dds file!", filename ); MessageBox( NULL, L"The file \"%s\" doesn't appear to be a valid .dds file!", L"ERROR", MB_OK|MB_ICONEXCLAMATION ); fclose( pFile ); return NULL; } // Get the surface descriptor fread( &ddsd, sizeof(ddsd), 1, pFile ); pDDSImageData = (DDS_IMAGE_DATA*) malloc(sizeof(DDS_IMAGE_DATA)); memset( pDDSImageData, 0, sizeof(DDS_IMAGE_DATA) ); // // This .dds loader supports the loading of compressed formats DXT1, DXT3 // and DXT5. // switch( ddsd.ddpfPixelFormat.dwFourCC ) { case FOURCC_DXT1: // DXT1's compression ratio is 8:1 pDDSImageData->format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; MessageBox(NULL,L"DXT1",L"Compression level",NULL); factor = 2; break; case FOURCC_DXT3: // DXT3's compression ratio is 4:1 pDDSImageData->format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; MessageBox(NULL,L"DXT3",L"Compression level",NULL); factor = 4; break; case FOURCC_DXT5: // DXT5's compression ratio is 4:1 pDDSImageData->format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; MessageBox(NULL,L"DXT5",L"Compression level",NULL); factor = 4; break; default: char str[255]; // sprintf( str, "The file \"%s\" doesn't appear to be compressed " // "using DXT1, DXT3, or DXT5!", filename ); MessageBox( NULL,L"The file \"%s\" doesn't appear to be compressed", L"ERROR", MB_OK|MB_ICONEXCLAMATION ); return NULL; } // // How big will the buffer need to be to load all of the pixel data // including mip-maps? // if( ddsd.dwLinearSize == 0 ) { MessageBox( NULL,L"dwLinearSize is 0!",L"ERROR", MB_OK|MB_ICONEXCLAMATION); } if( ddsd.dwMipMapCount > 1 ) bufferSize = ddsd.dwLinearSize * factor; else bufferSize = ddsd.dwLinearSize; pDDSImageData->pixels = (unsigned char*)malloc(bufferSize * sizeof(unsigned char)); fread( pDDSImageData->pixels, 1, bufferSize, pFile ); // Close the file fclose( pFile ); pDDSImageData->width = ddsd.dwWidth; pDDSImageData->height = ddsd.dwHeight; pDDSImageData->numMipMaps = ddsd.dwMipMapCount; if( ddsd.ddpfPixelFormat.dwFourCC == FOURCC_DXT1 ) pDDSImageData->components = 3; else pDDSImageData->components = 4; return pDDSImageData; } [/code]   It seems that when I compile the code on X64 I get an MessageBox error that the texture is not compressed. Any idea why? Should I try recoding to Windows ReadFile instead of fread ?
  4. Hello. I'm trying to understand how the pipeline works before I go further. I reached the Tessellation part in the pipeline explanation in a book and are some things that I dont uderstand. Here I have an example of a simple Tessellation from Rastertek website. [source] cbuffer TessellationBuffer { float tessellationAmount; float3 padding; }; struct HullInputType { float3 position : POSITION; float4 color : COLOR; }; struct ConstantOutputType { float edges[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; struct HullOutputType { float3 position : POSITION; float4 color : COLOR; }; //////////////////////////////////////////////////////////////////////////////// // Hull Shader //////////////////////////////////////////////////////////////////////////////// [domain("tri")] [partitioning("integer")] [outputtopology("triangle_cw")] [outputcontrolpoints(3)] [patchconstantfunc("ColorPatchConstantFunction")] HullOutputType ColorHullShader(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID) { HullOutputType output; // Set the position for this control point as the output position. output.position = patch[pointId].position; // Set the input color as the output color. output.color = patch[pointId].color; return output; } //////////////////////////////////////////////////////////////////////////////// // Patch Constant Function //////////////////////////////////////////////////////////////////////////////// ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID) { ConstantOutputType output; // Set the tessellation factors for the three edges of the triangle. output.edges[0] = 6; output.edges[1] = 6; output.edges[2] = 6; // Set the tessellation factor for tessellating inside the triangle. output.inside = 6; return output; } [/source] I don't know If I understand correctly. The HULL SHADER actually takes vertices and transforms them in control point for patches that are actually still vertices. I mean in this example The hull shader takes 3 vertices and "transforms" them in a control patch that is actually a triangle that will be modified. So If I want specific control points that are invisible to the mesh I must integrate them in the Vertex buffer ? So I actually I don't understand is what the control points and patches are. An triangle is submitted to the HS and the control points are the vertices and the patch is the triangle itself ? How control patches and points are separated from the triangle ?
  5. Shader arhitecture

    I was thinking about state changes and other CPU operations that will make the shader class reliable instead of just loading some shader files like textures. Also the framework strucutre is ok even if I dont complicate the things with shader ? I mean for everything else, like initiating objects with other objects and so on.
  6. Shader arhitecture

    Hello. A n00b question about shaders,devices and other elements in DirectX 11. I'm using simple shaders to create some effects but the code got a litle ugly because I dont have a framework. I dont want something fancy I just want something that will help me in the future when I'll create more complex shaders that require additional parameters and state changes etc. So My idea was: Create a DEVICE class that has only the initiation of DirectX 11 data. Create a SHADER class that will initiate with an DEVICE objects that contains d3d11device, context, render target etc. Create a GRAPHIC class that again will initiate with DEVICE and SHADER objects and render all the geometry. Device.init(1920,1200, etc.. Shader.init(Device etc.. Graphic.Init(device, shader, input etc..) Is this a decent framework for a simple project or should I try a different approach ? Thanks.
  7. Few question about DirectX 11

    Yes, actually I didnt set the sampler state. Thank you for pointing that. Another questions: If I have a class and I want to debug to a file or to a messagebox etc is ok to do that with a define ? For exemple: [code] #define DEBUG 0 //some code that makes something //.. #if DEBUG == 1 //write debug information about the code above to a file #endif // other lines of code // .... #if DEBUG == 1 //write debug information about the code #endif [/code] I know that are many logical ways to do that but I wonder wich one is better and used by a programmer. Thanks.
  8. BMfont loader

    Thank you very much for taking your time and writing this code. I will try it soon and reply back. le: It worked as a charm thanks to your pseudocode explanation. Thanks again.
  9. BMfont loader

    I dont manage to do it. Its probably because I have quads that are not the same ? Im making gaps between characters with Xoffset but my characters are quads in the size of the UV I map. Also the character id coresponds with a letter that I create in char by substractin 32; for ex: char char[0]= 'a' - 32; char[0] will draw corectly lowercase a;
  10. BMfont loader

    So, xoffset is for spacing between characters, yoffset for moving characters down (for example j,g) and kerning to space some characters that doesnt use default offset ?
  11. BMfont loader

    Hello. I'm trying to read and render some text in DirectX using BMfont. So far I managed to load characters and render them like this: I create quads based on x,y, wifth and height. I map over the texture creating UVs based on x,y,width and height of an character. But I know know how to move up and down characters like "j" or "g" to align corectly with other characters. So far I've read the kerning are used for spacing between characters but on the X axis. What about the Y axis ? [img][/img]
  12. Few question about DirectX 11

    Also how can I display those quads in the same size even if I resize the window on change the resolution ? Assuming I dont care about about window resizing. A monitor with a native resolution of 1024x768 will display a quad in the same ratio as I see it on my native resolution of 1920x1200 ?
  13. Few question about DirectX 11

    Also witout font smothing and Dx filtering [url=""][img][/img][/url]
  14. Few question about DirectX 11

    Looks the same with any filter in the sample. [code] D3D11_SAMPLER_DESC samplerDesc; samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.MipLODBias = 0.0f; samplerDesc.MaxAnisotropy = 0; samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS; samplerDesc.BorderColor[0] = 0; samplerDesc.BorderColor[1] = 0; samplerDesc.BorderColor[2] = 0; samplerDesc.BorderColor[3] = 0; samplerDesc.MinLOD = 0; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; [/code]
  15. Few question about DirectX 11

    I managed to load the binary file but no matter how hard I try it seems that the font is blurry. I unchecked "Font Smoothing" from Bitmap font generator but it seems it goes to the other extreme. I exported the font in a big size (40) do I'll have more pixel information and after that I've created triangles sized by UV coordonated and it seems I'm mapping 1:1 to the quad. When I create the quads the values of UVs are multyplied woth 0.002f. Then I use a matrix multiplication for scaling again regarding my need. Also without the scaling the font is still kind of blurry. Any sugestion for sharpening the font? [img][/img] [img][/img]