• Advertisement


This topic is now archived and is closed to further replies.

New Graphics card and texture errors

This topic is 5055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all I just upgraded from a GeForce 4 MX to an ATI 9800 Pro and put in another 512 ram. Now my interface code is not doing so well. I have 3 textures. One is a background I am placing ove rthen entire screen. The next is a bitmap that has the widget images for the interface and the other is a bitmap that makes up the background for the interface windows. Pretty much everything is showing blue (the color I clear the screen to. However, some of the icons laid out on the widget bitmap are showing but completely black and others are showing as if they are lit from the top left corner. The rest are not showing at all. I have checked my device caps and I was only requiring the minimum caps from before. This card has those and then some to say the least. Anyone have some ideas off the top of their heads? NO matrix code or texture coordinates have changed. In fact, nothing in the code has changed since I installed the card. I have uninstalled/reinstalled the DX SDK and have created a brand new Visual C++ project and moved over my files just in case it was some strange error there but the problem persists. Can post code in snippets if anyone needs to see how I am doing certain things but otherwise it''s too darn much code to post it all. Thanks for any replies, Webby

Share this post

Link to post
Share on other sites
have you turned lighting off?
are the diffuse colors for the verticies white

check TextureStates and see if the coloroperation = modulate or something of the sort and make sure the right colorargument is set to the texture color

Share this post

Link to post
Share on other sites
Here is the way it has been set up for a few months now. It was working fine until I installed the new card last week. Is something missing that the other card would not have cared about?


GetCurrentDisplayDevice()->SetTransform(D3DTS_PROJECTION, &m_Ortho2D);
GetCurrentDisplayDevice()->SetTransform(D3DTS_WORLD, &m_Identity);
GetCurrentDisplayDevice()->SetTransform(D3DTS_VIEW, &m_Identity);

GetCurrentDisplayDevice()->SetRenderState(D3DRS_LIGHTING, FALSE);
GetCurrentDisplayDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
GetCurrentDisplayDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
GetCurrentDisplayDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

GetCurrentDisplayDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
GetCurrentDisplayDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
GetCurrentDisplayDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );

GetCurrentDisplayDevice()->SetStreamSource(0, m_pUIVB, 0, sizeof(CUSTOMUIVERTEX) );

Share this post

Link to post
Share on other sites
Have run many times in Debug mode and can''t seem to figure it out. The correct texture is getting loaded from the correct directory.

About the texture color, I am doing this
GetCurrentDisplayDevice()->SetRenderState(D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB(m_ucAlpha, 255, 255, 255) );

I''ve tried giving it an alpha value of 0 and of 255. Have also changes RGB from 0 to 255 and all 4 combinations of full/no alpha with full/no texture color.

It''s gotta be something simple since I can see some parts of the interface but not others so I know that the textures are getting loaded, just something petty isn''t correct.

Off to the debugging board.

Share this post

Link to post
Share on other sites
You have SetTextureStageStates for Alpha, but not for Colour. This isn''t a good thing.

GetCurrentDisplayDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
GetCurrentDisplayDevice()->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
GetCurrentDisplayDevice()->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_TFACTOR );

Stay Casual,

Drunken Hyena

Share this post

Link to post
Share on other sites
Thanks I''ll give it a try but I am slowly working it out.
Funny thing is, I now have some icons showing up in glorious color and others not showing up at all. Even though they are using the same path to the same texture and are rendering with the exact same function... It''s boggling. Think I might relieve some anxiety in FarCry


Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Have you tried Upgrading to that GeForce4 Mx I mean really. The Radeon seems to be doing you no good in its current ATI state.

Not trying to all you ATI users but this thread jumps out and screams ATI driver bug, didn''t they say they fixed those. Well anyway I wish you luck in you Endeavors.

Share this post

Link to post
Share on other sites
Original post by Anonymous Poster
Not trying to all you ATI users but this thread jumps out and screams ATI driver bug, didn''t they say they fixed those.
I seriously doubt this is a driver bug, since ATI''s maintains exceptional quality in their drivers nowadays. Also, if they had a bug in their texturing pipeline, I''m sure they would know about it by now. If anything, nvidia are the ones behind on their product quality (compared to ati''s) now.

Dustin Franklin
Mircrosoft DirectX MVP

Share this post

Link to post
Share on other sites
Have you checked your vertex filling code? The Radeon might be making different assumptions when you''re filling up the buffer, so your texture coords might be getting stepped on. I''ve got a Radeon 9800 XT and I''ve not seen a single driver bug in some serious out-of-the-way tests. I''m not saying they don''t exist, but this problem doesn''t seem to scream ''unique test case''...

Chris Pergrossi
My Realm | "Good Morning, Dave"

Share this post

Link to post
Share on other sites
Pretty positive that this isn''t a driver issue. I updated the drivers yesterday and the problem remains. However, after fiddling with the code last night I as able to get some color back into the program for certain icons (the ones that were previously showing in black). However, most icons still are not displaying at all. I have checked and rechecked my vertex filling code and texture coordinate code and see nothing wrong yet. Will keep looking (as if I have a choice).


Share this post

Link to post
Share on other sites
Here is the all inclusive "skinny"
I have commented out all window rendering calls except the call to render my mouse cursor. It, of course, does not show up on the screen. Keep in mind that the other render calls are pretty much identical and some parts of the interface renders while other parts do not. This same code was working just before I replaced video cards.

//In DoFrame

GetCurrentDisplayDevice()->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );

GetCurrentDisplayDevice()->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);

GetCurrentDisplayDevice()->Present(NULL, NULL, NULL, NULL);

//The RenderGUI function without all the other calls to render

//other windows

hr = GetCurrentDisplayDevice()->SetTransform(D3DTS_PROJECTION, &m_Ortho2D);
hr = GetCurrentDisplayDevice()->SetTransform(D3DTS_WORLD, &m_Identity);
hr = GetCurrentDisplayDevice()->SetTransform(D3DTS_VIEW, &m_Identity);

hr = GetCurrentDisplayDevice()->SetRenderState(D3DRS_LIGHTING, FALSE);
hr = GetCurrentDisplayDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
hr = GetCurrentDisplayDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
hr = GetCurrentDisplayDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

hr = GetCurrentDisplayDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
hr = GetCurrentDisplayDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
hr = GetCurrentDisplayDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );

hr = GetCurrentDisplayDevice()->SetVertexShader(NULL);
hr = GetCurrentDisplayDevice()->SetStreamSource(0, m_pUIVB, 0, sizeof(CUSTOMUIVERTEX) );
hr = GetCurrentDisplayDevice()->SetIndices(m_pUIIB);
hr = GetCurrentDisplayDevice()->SetFVF(D3DFVF_CUSTOMUIVERTEX);


D3DXMatrixTranslation(&m_matCursorPosition, m_poMouseCursorPosition.x, m_poMouseCursorPosition.y, 0.0f);
if(m_CursorTexture != NULL)
hr = GetCurrentDisplayDevice()->SetTexture(0,
hr = GetCurrentDisplayDevice()->SetTransform(D3DTS_WORLD,
hr = GetCurrentDisplayDevice()->SetRenderState
(D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB(255, 255, 255, 255) );
hr = GetCurrentDisplayDevice()->DrawIndexedPrimitive
(m_iCursorStartIndex+(iWhichCursor*4)), 4,
(m_iCursorStartIndex+(iWhichCursor*6)), 2);

m_CursorTexture is not NULL. I have checked and it is indeed using the file path and is associated with the file name "pointer.bmp". Other textures loaded appear correct as well. This code should produce a blue screen and a mouse pointer at the location of the mouse coordinates (defaulted to 0,0 on program startup).

Any ideas?

Share this post

Link to post
Share on other sites
No clues or has the post fallen by the wayside?
Need to see some other piece of code?

Need help. Over a week and still can''t figure this one out


Share this post

Link to post
Share on other sites
It''s time to reinvent the wheel. Start with a basic skeleton code shell, get things working 1 line/routine at a time until you end up where you were before the card change. Looks like it''s time to give up thinking about the 1 line fix. Good luck!

Share this post

Link to post
Share on other sites
I would try to do this with DrawPrimitive instead of using indices, at least to verify there''s nothing wrong with the vertex data. Indicies can get confusing. I can''t see enough of your code to know if it looks right or not, but in my case most of the problems I ran into were with indices, until I became very familiar with them. If drawing simple quads doesn''t work right, non-indexed, then it''s a lot easier to track the problem down.


Share this post

Link to post
Share on other sites
Well early this am before I headed off to work I did some more investigating and found something interesting. My code is set up to query the main display adapter and for display modes and I found this:

if((uiModeCount = m_pD3D->GetAdapterModeCount(iAdapter,
m_ppFullscreen.BackBufferFormat)) ==0)
//This adapter has NO display modes or the call failed

MessageBox(g_cApp.GethWnd(), "GetViableFSAdapterModes",
"Direct3DCreate9", MB_YESNO);
return false;

The code above is returning false (the Message box is new) when iAdapter is 0 or 1. It is not finding any display modes for my device. Further digging and I realized that the ATI 9800 pro supports dual monitors -- found this when I saw Device Manager had 2 display adapters installed, wondered about this and guy at work told me about the dual monitor support. So I am now pretty sure that this will be the root of the problem though I haven''t had time to try and solve it yet. If not the problem, it is A problem and at least it''s something else that won''t bite me in the buh-hind later on.

Will post final results when I can confirm them, I''m sure this is something others are likely to run into with these cards. The dual monitor support isn''t exactly touted in bold print and the card itself doesn''t have to monitor plugs, it uses a dongle for the extra hookup (not sur ewhy they didn''t just put two regular monitor connections on it...

Anyway, I''m beat. Goodnight all,

Share this post

Link to post
Share on other sites
Can anyone see what''s wrong with this? It''s the code I use to set up my vertex and index buffers and initialize a mouse cursor quad and a root window quad. I start with 0 vertices or indices. The mouse cursor would be the first 4 verts and 6 indices and the root quad would be verts 4-7 and indices 6-11.
These numbers are correct while in debug mode. However, when I initialize both quads neither show up. If I comment out the initialization and rendering on either one, the other shows up.
Note, it is not the rendering code because commenting that out doesn''t help. Besides, they render fine when they are alone. I''m getting annoyed with this. All of this code was working before the new video card.

hr = GetCurrentDisplayDevice()->CreateVertexBuffer
VOID* pVertices;
hr = m_pUIVB->Lock( 0, sizeof(CUSTOMUIVERTEX) * NUM_VERTS_IN_UI,
(void**)&pVertices, 0);
memcpy( pVertices, m_VB, sizeof(m_VB));

hr = GetCurrentDisplayDevice()->CreateIndexBuffer
VOID* pIndices;
hr = m_pUIIB->Lock(0, sizeof(DWORD) * NUM_INDICES_IN_UI,
(void**)&pIndices, 0);
memcpy( pIndices, m_IB, sizeof(m_IB));


int iXOrigin = (g_cGraphicsManager.GetGameWidth()/2) * -1;int iYOrigin = (g_cGraphicsManager.GetGameHeight()/2) * -1;

InitCursor(m_VB, m_IB, m_NumVertsUsed, m_NumIndicesUsed,
20, 20, //size of the cursor

"..\\..\\Artwork\\pointer.bmp", "pointer");

m_NumVertsUsed += 4;
m_NumIndicesUsed += 6;

UpdateCursor(iXOrigin, iYOrigin);

//Initialize root window to size of total screen

m_pRoot = new cGUIBaseWindow;
m_pRoot->Init(m_VB, m_IB,m_NumVertsUsed, m_NumIndicesUsed,
GetGameWidth(), GetGameHeight(),
0,0, //Root should always be 0,0

NULL, true,
"..\\..\\Interface Artwork\\env.bmp", "env");

m_NumVertsUsed += 4;
m_NumIndicesUsed += 6;


m_pParent = NULL;
m_iNumWindows = 0;

m_iStartIndex = StartIndex;
m_pParent = pParent;

SetGUIAbsolutePos(AbsoluteX, AbsoluteY);

SetGUIWindowSize(Width, Height);

SetGUIWindowTexture(sTextureFilePath, sTextureName, INTERFACE_TEXTURE);

m_ucAlpha = 255;

ptrVertexBuffer[StartVertex + 0].x = 0;
ptrVertexBuffer[StartVertex + 0].y = 0;
ptrVertexBuffer[StartVertex + 0].z = 0.0f;
ptrVertexBuffer[StartVertex + 0].color = D3DCOLOR_ARGB(255, 255, 255, 255);
ptrVertexBuffer[StartVertex + 0].u = 0.0;
ptrVertexBuffer[StartVertex + 0].v = 0.0;

ptrVertexBuffer[StartVertex + 1].x = Width;
ptrVertexBuffer[StartVertex + 1].y = 0;
ptrVertexBuffer[StartVertex + 1].z = 0.0f;
ptrVertexBuffer[StartVertex + 1].color = D3DCOLOR_ARGB(255, 255, 255, 255);
ptrVertexBuffer[StartVertex + 1].u = 1.0;
ptrVertexBuffer[StartVertex + 1].v = 0.0;

ptrVertexBuffer[StartVertex + 2].x = 0;
ptrVertexBuffer[StartVertex + 2].y = Height;
ptrVertexBuffer[StartVertex + 2].z = 0.0f;
ptrVertexBuffer[StartVertex + 2].color = D3DCOLOR_ARGB(255, 255, 255, 255);
ptrVertexBuffer[StartVertex + 2].u = 0.0;
ptrVertexBuffer[StartVertex + 2].v = 1.0;

ptrVertexBuffer[StartVertex + 3].x = Width;
ptrVertexBuffer[StartVertex + 3].y = Height;
ptrVertexBuffer[StartVertex + 3].z = 0.0f;
ptrVertexBuffer[StartVertex + 3].color = D3DCOLOR_ARGB(255, 255, 255, 255);
ptrVertexBuffer[StartVertex + 3].u = 1.0;
ptrVertexBuffer[StartVertex + 3].v = 1.0;

ptrIndexBuffer[StartIndex + 0] = StartVertex + 0;
ptrIndexBuffer[StartIndex + 1] = StartVertex + 1;
ptrIndexBuffer[StartIndex + 2] = StartVertex + 2;
ptrIndexBuffer[StartIndex + 3] = StartVertex + 2;
ptrIndexBuffer[StartIndex + 4] = StartVertex + 1;
ptrIndexBuffer[StartIndex + 5] = StartVertex + 3;

m_bIsShown = bShown;
m_bDragging = false;

Thanks for any help,

Share this post

Link to post
Share on other sites

  • Advertisement