Jump to content
  • Advertisement
Sign in to follow this  

Textures are not showing up on all computers

This topic is 2914 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

Hi guys. I have found myself running into a nasty little bug. When I run my game on my computer, all the graphics show up correctly. However on some cards, especially ATI cards, only the textures I use to texture a d3dx mesh shows up. Any texture that I use to texture a quad, doesn't show up. So I guess that I am probably not building my quads in the correct way. Could you DirectX gurus take a look at my code. All this code does is create a quad and texture it. Do you see any issues? Thanks!

#pragma once
#include "stdafx.h"
#include "SkyBox.h"
#include <vfw.h>

CSkyBox::CSkyBox(LPDIRECT3DDEVICE9 dev) : m_pDev(dev)
this->m_pDev = dev;

float fZ = 1.0f;
m_rect.left = 0;
m_rect.right = 800;
m_rect.top = 0;
m_rect.bottom = 600;

DWORD color = D3DXCOLOR(1.0f,1.0f,1.0f,1.0f);

m_pTex = CGameResourceManager::loadTexture(dev, "level1.dds", LEVEL_RESOURCE);

CDataLogger::getInstance()->addEntry("Failed to create CSkyBox vertex buffer", MESSAGE_TYPE_ERROR);

alert("Out of Video Memory!");
else if(hr == E_OUTOFMEMORY)
alert("EOUTOF memory");
else if(hr == D3DERR_INVALIDCALL)
alert("INVALID CALL!");

if(!SUCCEEDED(m_pVertexBuffer->Lock(0,0,(void **)&m_pVerts, NULL)))
CDataLogger::getInstance()->addEntry("Failed to lock CSkyBox vertex buffer", MESSAGE_TYPE_ERROR);
m_pVerts[0].fX = float(m_rect.left);
m_pVerts[0].fY = float(m_rect.top);
m_pVerts[0].fZ = fZ;
m_pVerts[0].clrColor = color;
m_pVerts[0].fRot = 0.0f;
m_pVerts[0].fU = 0.0f;
m_pVerts[0].fV = 0.0f;

m_pVerts[1].fX = float(m_rect.right);
m_pVerts[1].fY = float(m_rect.top);
m_pVerts[1].fZ = fZ;
m_pVerts[1].clrColor = color;
m_pVerts[1].fRot = 0.0f;
m_pVerts[1].fU = 1.0f;
m_pVerts[1].fV = 0.0f;

m_pVerts[2].fX = float(m_rect.right);
m_pVerts[2].fY = float(m_rect.bottom);
m_pVerts[2].fZ = fZ;
m_pVerts[2].clrColor = color;
m_pVerts[2].fRot = 0.0f;
m_pVerts[2].fU = 1.0f;
m_pVerts[2].fV = 1.0f;

m_pVerts[3].fX = float(m_rect.left);
m_pVerts[3].fY = float(m_rect.bottom);
m_pVerts[3].fZ = fZ;
m_pVerts[3].clrColor = color;
m_pVerts[3].fRot = 0.0f;
m_pVerts[3].fU = 0.0f;
m_pVerts[3].fV = 1.0f;
CDataLogger::getInstance()->addEntry("Failed to unlock CSkyBox vertex buffer", MESSAGE_TYPE_ERROR);


void CSkyBox::updateTexture(HBITMAP hBmp)


void CSkyBox::draw(D3DCOLOR color)

m_pDev->SetRenderState(D3DRS_LIGHTING, FALSE);

m_pDev->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(SVERTEX));

m_pDev->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);

m_pDev->SetTexture(0, NULL);
//m_pDev->SetRenderState(D3DRS_LIGHTING, TRUE);



//delete m_pVertexBuffer;
//alert("UnlockingVertex buffer");
//alert("Releasing Vertex buffer");
//alert("Releaseing texture buffer");
//alert("Deleteing Vertex buffer");
//delete m_pVerts;

Share this post

Link to post
Share on other sites
Do the directx debug runtimes give you any error messages?

Does the texture exceed the maximum size that the ati card can handle? Is the texture non-power of 2 in size? Is the texture of a format that the ati card can handle? If you use that same texture on the mesh, does it show up there?

Share this post

Link to post
Share on other sites
You only showed the skybox code, and isn't that the code that works well? By the way, use the 'source' tag instead of 'code'. It looks better, in particular for large chunks of code.

What result do you get on the reference device?

My guess would be that you're not setting some state which works due to a default on some cards and doesn't on others, but that's just a guess.

Share this post

Link to post
Share on other sites
ET3D, thanks for the heads up about the source tag.

Actually the skybox code doesn't work correctly on some cards. This class doesn't make a real skybox. All it does is create a vertex buffer quad and texture it. But it doesn't show up on some cards.

Share this post

Link to post
Share on other sites
Run the application using PIX on the platform in which the textures do not show up. Do an F12 D3D call capture.

Then ensure that the Draw*Primitive call is correctly called and the vertices make it to the screen.

Next ensure that a SetTexture call precedes that Draw*Primitive call and view the texture to ensure it is the expected one.

Then debug down to the pixel level by right-clicking on the render target (likely the framebuffer) anywhere you would expect the texture should have been and choose to debug the pixel there. This should let you know why the pixel remains not colored with your texture.

At any time, right-click on the device address and review the Pixel/Vertex states to see if they are appropriate.

If you actually do any of this, it should completely remove any doubts from your mind about why the image looks wrong on a particular platform.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!