Handmade Hero»Forums»Code
andre
12 posts
no textures displayed?
hi folks!

i joined HMH (pre order) a few days ago.... coming from android/libgdx... going a step further...

i have one problem: it seems like there are no textures displayed in my builds..what i have done:
- i tried various code-bases,
- i copied the assets in "data" (test, test2, test3, intro_art.hha, test.out)
- i packed the textures (after i built test_asset_builder.exe), evrything looks good

compiling works whithout errors, but there are no textures and if i take day-242 i only see a black-fullscreen

would be great if someone could point me in the right direction!?

bye
phil

by the way: is there a way to search the forums?
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
no textures displayed?
If you rewind back to a day before hardware rendering, does it work then? Just wondering if you are having OpenGL problems or if you're having art pipeline problems...

To search the forums, use the link under "Your Account" on the right side of the screen.

- Casey
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
Edited by Mārtiņš Možeiko on
I also get black screen with latest source (Windows 10 x64, Nvidia GTX 970, latest drivers).

Not sure exactly what is wrong. Pixel format is set successfully. Context created fine. And I verified that no OpenGL call generates error. Also tried turning sRGB off, didn't help.

What helped is to enable double buffering. If I set HANDMADE_STREAMING to 0, or add PFD_DOUBLEBUFFER flag to DesiredPixelFormat.dwFlags in line 476, then I get expected output with textures.

Not sure yet why screen is black without double buffering.
andre
12 posts
no textures displayed?
hi casey!

i tried various days without openGL, like 104 but no hero-textures, only coloured blocks... is it possible that all textures are transparent??

bye
phil
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
Edited by Mārtiņš Možeiko on
Software renderer works fine for me.
Are you running executable from "data" directory where all the asset *.hha files are?
andre
12 posts
no textures displayed?
mmozeiko

Are you running executable from "data" directory where all the asset *.hha files are?


yeah...that was it!
thanks!! cpu-renderer works now with textures (strange because i read itin the readme and thought i had done it that way)

but openGL still shows black fullscreen...

bye
phil
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
Try to enable double buffering flag when choosing pixel format.
andre
12 posts
no textures displayed?
mmozeiko
Try to enable double buffering flag when choosing pixel format.


thanks a lot.
that helped! now openGL works too.

but why is it?

bye
phil
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
I don't know. It shouldn't be like that. This happens also on my machine, so I'm trying to figure out why.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
no textures displayed?
I don't know for sure, but it is probably very uncommon not to specify that flag... I have never made anything with OpenGL that didn't specify that flag. The only reason we aren't specifying it at the moment is because of the streaming issue. So I do wonder if there are (lots of?) drivers out there that don't cope well without that flag being specified?

- Casey
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
Edited by Mārtiņš Možeiko on
When I put glFinish() just before SwapBuffers, then I get everything displayed correctly. Magic... SwapBuffers is optional at this point because of single buffering, but it's needed there for vsync.

So yeah, pretty weird.

According to some people on internet, this is because of composition manager on Windows, it get's you black screen with single buffering. Not sure is it a "feature" or a "bug" :)
https://www.opengl.org/discussion.../182545-Single-buffered-rendering
https://stackoverflow.com/questio...-pixelformatdescriptor-swapbuffer
Benjamin Pedersen
46 posts
Mathematician
no textures displayed?
I cannot get any textures from hha-files to display. I am running win32_handmade.exe from the same directory as intro_art.hha, but only rectangles are drawn.
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
Which day are you running?

If it is before day 324 then this can sometimes happen because of driver issues with multiple GL contexts. It was happening also on stream multiple times. Just closing & running application again helps.

Otherwise you probably are in wrong directory? How are you running exe from data folder?
Benjamin Pedersen
46 posts
Mathematician
no textures displayed?
It is day 335. I am running it through the command line within handmade\data with ..\..\build\win32_handmade.exe.
I have also tried to put intro_art.hha directly into \build and running from there.
Mārtiņš Možeiko
2559 posts / 2 projects
no textures displayed?
Hmm, not sure what can be wrong...
Could you try doing following things?

1) Put a breakpoint in AllocateGameAssets function after call to GetAllFilesOfTypeBegin and check that it finds multiple hha files (FileGroup.FileCount is > 1)

2) Put a breakpoint in LoadAssetWorkDirectly function on FinalizeAsset_Bitmap case and check for multiple bitmaps that Bitmap structure is loaded and has reasonable values for width and height members.