Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


lucaswrk

Member Since 05 Aug 2012
Offline Last Active Dec 19 2014 07:54 AM

Posts I've Made

In Topic: How does "DXUTGetGlobalResourceCache().CreateTextureFromFile" correctly?

19 December 2014 - 07:57 AM

 

Hi,

thank you all for repley!

 

Yes it is possible to use a other method to handle texturs! 

 

In the DXUT folder of my project in Visual Studio 12, i cant find DDSTextureLoader and WICTextureLoader. So i loaded from 

your link and copyed&pasted WICTextureLoader.h und WICTextureLoader.cpp in my projektfolder. After that i included WICTextureLoader.h

and tried the example from: https://directxtk.codeplex.com/wikipage?title=WICTextureLoader&referringTitle=Home

 

Now i have two variant:

1:

 

hr = CreateWICTextureFromFile( pd3dDevice, L"Holz.jpg", nullptr, &g_pRV, 0 );
 
Here the compiler returns three error, from "c:\program files (x86)\windows kits\8.0\include\shared\dxgi1_2.h(1274)".
I think the errors are in my code and not in dxgi1_2.h !!
 
2:
ComPtr<ID3D11ShaderResourceView> srv;
hr = CreateWICTextureFromFile( pd3dDevice, immContext.Get(), L"Holz.jpg", nullptr, srv.GetAddressOf() );
 
Here i have trouble with immContext, because i dont know what variable it is!?
 
Have somebody a idea?
Thanks again!
 
Meho
 
p.s.: I dont have permission to upload a fil, so i uploaded it here: https://mega.co.nz/#!sMMw0ZYA!RuoDX6uDX0ULm2302h28wF21FDlS97EdaQT54aAN-Ik

 

 

Make sure you are calling CreateWICTextureFromFile from the WICTextureLoader.h you have just created. I can't read your code right now, so here is an simplified example of how I call this function (note the DirectX namespace; TextureMgr is my class that holds this function; md3dDevice is a raw pointer to a ID3D11Device):

#include "WICTextureLoader.h"

ID3D11ShaderResourceView* TextureMgr::CreateTexture(std::wstring filename)
{
	ID3D11ShaderResourceView* srv = 0;

	DirectX::CreateWICTextureFromFile(md3dDevice, filename.c_str(), nullptr, &srv);

	return srv;
}

In Topic: How does "DXUTGetGlobalResourceCache().CreateTextureFromFile" correctly?

17 December 2014 - 05:34 AM

This Toolkit is a bit complex solution, it is possible to use DDSTextureLoader, which is a part of the new DXUT also.

Actually, DirectXTK has DDSTextureLoader and WICTextureLoader. Again, it is possible to rip these files to your own project.


In Topic: How does "DXUTGetGlobalResourceCache().CreateTextureFromFile" correctly?

16 December 2014 - 11:21 AM

Hello Meho, maybe the ID3D11DeviceContext *pContext parameter is missing on the call? Also, I recommend you to use DirectX Tool Kit for a more "modern" texture loading, you can get more info here and here is the source (you can copy the .h and .cpp files to your project, there is no need to use the entire DirectXTK library).


In Topic: C++ vector/matrix size question

10 August 2012 - 05:32 AM

so, in an abstract way, it works like this (?):

int array[5][5];

0x0001
0x0002
0x0003
0x0004
0x0005
0x0006
0x0007
0x0008
0x0009
0x000A
0x000B
0x000C
0x000D
...

int* value = array+1..5	   //for looking up a column value from line 1
int* value = array+6+1..5   //for looking up a column value from line 2
//and so on.

?

thank you.

In Topic: Random glClearColor values

05 August 2012 - 01:57 PM


glClearColor(rand()%256, rand()%256, rand()%256, 1.0);

Your alpha value is 1.0. You probably meant 255 Posted Image.

Edit: It's also possible that glClearColor expects floats clamped to 1.0, in which case it's highly likely you're always getting white since rand()%256 will usually be nonzero. Try dividing the results of that calculation by 255.0f to find out. (Or check the documentation... either way, don't mix clamped floats and integer formats.)


yeah, that was the problem! x >= 1.0 will be the color max value, that's why my screen was getting white every time. Exactly as you said.
heres the correct code (with jouley's hint), if someone is interested..

float r = rand()%256 / 255.0f;
float g = rand()%256 / 255.0f;
float b = rand()%256 / 255.0f;
glClearColor(r, g, b, 1.0);

thank you @jouley!

PARTNERS