Recent

Author Topic: Problems with texture  (Read 3941 times)

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Problems with texture
« on: September 16, 2021, 08:39:36 am »
Ehh. Direct3D isn't popular on this forum, but I'd try to ask my question. I have weird problem. I have old project from 2006 year, I need to modernize, i.e. port to new framework. Project itself works properly, that proves, that problem isn't with my computer. And this old project allows me to port it via just copy-pasting parts of old code to new framework. But when everything related to Direct3D was ported, problems with textures started. OpenGL works properly with the same textures, i.e. problem isn't with textures themselves.

Symptoms: when texture is enabled, it looks like it's downsampled to 1x1 one. I.e. red-blue checker board texture looks like solid pink color.

In most cases it means some problems with mipmaps. But this problems should be solved via changing filtering. And it doesn't help. Right texture "pitch" and no access violations suggest, that size and format of texture are right ones.

I tried everything. All filtering options, all texture options, all auto mipmap generation options, all rendering states, that could affect textures - nothing helps. Debugging shows, that all necessary parts of code are called. In old project there two set of options - anisotropic and no anisotropic. And both work properly. I tried them both in new project. No success.  What can be wrong?

P.S. I can't post my code here. Project is complex, full working code is big and posting some parts of it is pointless.
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

Seenkao

  • Hero Member
  • *****
  • Posts: 545
    • New ZenGL.
Re: Problems with texture
« Reply #1 on: September 16, 2021, 09:15:26 am »
Symptoms: when texture is enabled, it looks like it's downsampled to 1x1 one. I.e. red-blue checker board texture looks like solid pink color.
Эта не та самая проблема о которой вы говорите? Пробовали работать с текстурой 1x1? Точнее, если ваша текстура 512x512, то работать как 1/512x1/512.
И, возможно какие-то проблемы связаны с версией DX (я не изучал DX, потому не знаю).
Yandex translate:
Is this not the same problem that you are talking about? Have you tried working with a 1x1 texture? More precisely, if your texture is 512x512, then it will work as 1/512x1/512.
And perhaps some problems are related to the DX version (I haven't studied DX, so I don't know).
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Problems with texture
« Reply #2 on: September 16, 2021, 11:15:08 am »
I don't fully understand, what you mean. I suspected, that something might be wrong with texture coordinates. I.e., yea, my texture is 512x512 and first it seemed, like 0..1 texture coordinates were used directly instead of (0..1)x512 ones. I tested this case exaclty via making checker board texture. If it would be just blue or just red - it would show, that only one (0, 0) texel is used. But texture was solid pink!
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Problems with texture
« Reply #3 on: September 16, 2021, 11:39:58 am »
Well, the only practical route route is to make a minimal app. Then maybe people can test and see if they notice something.

I don't know @$!$ about directx, but I have done some opengl, but my initial hunches were in your initial message (the filtering bits specially)

What do you use in the way of headers, DX version etc ? Did you start with certain examples? (clootie?)

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Problems with texture
« Reply #4 on: September 16, 2021, 12:13:00 pm »
I will see, what I can do, but later. I can't provide whole framework. Initial source - is my old app. And it works properly. Headers could be updated, but I'm not 100% sure. Nothing special. Everything else works perfectly. Except textures. Only problem, I can guess for now - some alignments problems, I've already experienced in some other places. When float values aren't aligned properly, they provide some weird values, like close to 0 values instead of big ones. Problem is - I exclude possible causes one by one, but nothing helps or even affects result somehow, so I would know, that I move towards right direction.

What I ask for now - is some initial guess.
« Last Edit: September 16, 2021, 12:20:21 pm by Mr.Madguy »
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Problems with texture
« Reply #5 on: September 18, 2021, 04:48:42 pm »
Problem is solved! As always, it was completely unrelated to texture itself. It was about vertex buffer, where D3DFVF_TEX0 was used by mistake without realizing, that it's not texture stage - it's number of texture coordinates.
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

 

TinyPortal © 2005-2018