forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[LTE]C++ GL Error

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Oby1Chick



Joined: 13 Feb 2010
Posts: 24

PostPosted: Fri Mar 26, 2010 4:01 am    Post subject: [LTE]C++ GL Error Reply with quote

Hey guys,

Well, I have understood how the LTE game engine works looking at the examples and I am making my own 3D homebrew.
I've tried to render on the screen all the models I've conceived for my race game (They are in .x Direct3D format and the textures are 512x512 JPG) but I got a black screen...
When I come back to XMB and connect my PSP to PC, a file named log.txt has appeared at the root of the memory stick.Inside, there is written :
Code:

*** GL error 0x0505 in __pspgl_teximg_new ***

I've tried to change the heap size allocated to my homebrew using PSP_HEAP_SIZE_KB(-1) or PSP_HEAP_SIZE_MAX(), now I still have a black screen but the log.txt file does not appear anymore.
Once again, can you help me guys ?

Thanks a lot.

PS : When I put PSP_HEAP_SIZE_KB(20000) or lower, the log.txt appears.When I put higher, like PSP_HEAP_SIZE_KB(25000) or PSP_HEAP_SIZE_KB(30000), the screen stays black but the PSP is frozen and no log.txt appears...
Back to top
View user's profile Send private message
roby65



Joined: 01 Jun 2008
Posts: 55
Location: Mid Italy

PostPosted: Fri Mar 26, 2010 7:45 pm    Post subject: Reply with quote

Are you loading too many textures?!
How many textures do you load?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
justin



Joined: 17 Oct 2007
Posts: 16

PostPosted: Fri Mar 26, 2010 9:42 pm    Post subject: Reply with quote

I've seen this when you try to load an empty image (0 width, 0 height) - it fails generating the mipmaps if __pspgl_teximg_new with a crash.
Back to top
View user's profile Send private message
Oby1Chick



Joined: 13 Feb 2010
Posts: 24

PostPosted: Sat Mar 27, 2010 12:22 am    Post subject: Reply with quote

Thanks for helping me guys.
I've fixed my problem with freeze and no log.txt, it was because one of my textures was a not 128x128, 256x256 or 512x512.
But when I load all my models and the skybox it still does not work... and I don't think I load so many textures..I've put all the textures I use in a folder its size is less than 1MB (It is 956 kb).
I will try to resize a few pictures from 512x512 to 256x256 and I will tell you if it works.If it does not work, I will try to see if I can tell to the LTE Game Engine to load my textures in the RAM instead in the VRAM.
Thanks again !
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Sat Mar 27, 2010 1:45 am    Post subject: Reply with quote

Remember that JPG is a compressed format, but in RAM the textures will be uncompressed, so the less than 1 MB it's just that good for disk space, in RAM they will be bigger, it depends on pixel count and bpp. So a 24 bpp 512x512 texture will be something like 768 KB in RAM no matter what size it has in the disk.
_________________
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
Back to top
View user's profile Send private message
roby65



Joined: 01 Jun 2008
Posts: 55
Location: Mid Italy

PostPosted: Sat Mar 27, 2010 4:24 am    Post subject: Reply with quote

Try to use only 1 model, then 2, then 3 etc.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Pihas



Joined: 25 Oct 2008
Posts: 60
Location: Lithuania

PostPosted: Sun Mar 28, 2010 3:45 pm    Post subject: Reply with quote

Try to add bolded line to your makefile

Quote:
....
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

PSP_FW_VERSION = 390
PSP_LARGE_MEMORY = 1

LIBDIR = -L ../psp/sdk/lib
LDFLAGS =
....


I don't really know what it do but maybe it will help in some cases
Back to top
View user's profile Send private message Visit poster's website
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Sun Apr 04, 2010 12:18 pm    Post subject: Reply with quote

Pihas - that is for Slim's only to utilize the 64 mb of RAM they have compared to 32 on the phats, don't use that flag unless you are making a slim exclusive executable (like an HTML Browser or soemthing).

As for this problem - the model loading is a bit picky and special to each format. Obj doesn't have to have any materials since they aren't supported. 3DS has to have atleast 1 material and the texture names are only 12 characters max including extension. 3DS and OBJ do not save normals for lighting.

DirectX also has to have atleast 1 Material AND the material must have a texture name attached, even if you dont intend to have it textured (give it some weird name, it 'll just fail to load no biggie). My terrain will be textured by me in-game so it doesn't need a texture but it wasn't loading so I gave it some bogus texture file name and now its working.

I recommend loading node by node through the code if you think your models are fine with the above.

Easiest node to get displaying is the skybox - make sure the material Clipping flag is set to true since the Skybox will be culled.
Code:
node_Skybox->setMaterialFlag(EMF_CLIPPING, true);


Also make sure the mipmap texture creation flag is off when loading the skybox textures else you'll get ugly black seams with a blurry image.
Code:
driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);

node_Skybox = ...

driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, true);


512x512 is the hardware texture limit and I highly suggest using 256x256 tops. I have experimented with 256 versus 512 in my Light Cycle 3D game and I noticed no visual improvement (the psp's screen is 480x272 after all) plus I had memory issues loading over 20 light cycles. My latest game uses 256 for skyboxes I suggest you start with the same, worst case scenario you can always go up in quality at the end.


Once you get the skybox displaying, work on the others one by one. Models with BIG triangles need clipping, software clipping is slow and should only be used for those meshes with large triangles, ie a skybox, terrain, a road, etc.

Also make sure you have a camera added to your scene otherwise you won't see anything. If you're using the Lite Mod, the FPS camera doesn't work due to the lack of an event receiver. (a lot more LTE action at the link posted in the previous post)
Back to top
View user's profile Send private message
Oby1Chick



Joined: 13 Feb 2010
Posts: 24

PostPosted: Tue Apr 06, 2010 6:37 am    Post subject: Reply with quote

Thanks a lot folks !
I can't do that Pihas, I want my homebrew to be compatible with fat psps too - I have one myself.
Thank you for helping me in this thread too SG57, I have fixed this problem though.I resized my skyboxes pictures smaller and I was able to render all my models together, this issue is solved !
I only use DirectX models with one texture per object, there are no so big triangles lol, and the camera works well so far
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group