| Author |
|
amoreira Newbie

Joined: 04 January 2010 Location: Brazil Posts: 25
|
| Posted: 17 January 2010 at 01:23 | IP Logged
|
|
|
Hi folks.
As some of you might know, I finished a Wii port of Road Fighter, which has been released for download via Homebrew Browser.
As I have already announced in the "Road Fighter" topic, my next attempt at a Wii Port would be "The Goonies".
Right now, I finished compiling and linking it (what required some work on gl2gx - the OpenGL wrapper for Wii and Gamecube). After getting past some exit() calls and segmentation faults, I can actually see something on the screen.
Well, it's just the "fade-to-blue" transition that appears right before the MSX logo, but this is at least an indication that glClearColor() and glClear() are working.
Right now, I'm trying to figure out a way to make the debugging process less "blind". For some reason, output_debug_message()'s original code leads to a segmentation fault in Wii, with the stack frame pointing to vprintf.
When this code is disabled, I can see the fade transition that I mentioned, and just get stuck in the blue screen (maybe SDL fails on loading the MSX logo, or maybe glScissor() does not work correctly - it was one of the missing functions in gl2gx).
I had the same problem with Road Fighter regarding output_debug_message(), but I was surprisingly lucky at getting the game to work in a short time (especially because it used only SDL).
Well, I think that sums up the progress for now. This is going to be a much harder task than "Road Fighter", since I am a complete noob at OpenGL, the gl2gx wrapper is incomplete and discontinued. But the opportunity to learn and contribute motivates me a lot.
If you guys have any suggestions, debugging tips, general hints on how the game deals with OpenGL, please feel free to post. Thanks in advance.
|
| Back to Top |
|
| |
Jorito Admin Group


Joined: 30 December 2002 Location: Netherlands Posts: 1869
|
| Posted: 17 January 2010 at 19:25 | IP Logged
|
|
|
Hmm, for this I think you need some help from Santi. He coded the game and know all about the OpenGL part. I mailed him about this, he will probably stop by here
As to give you a general idea: the game basically uses the 2D principles we used in Road Fighter, but now each object is an OpenGL object. IIRC, they all use the GLTile class. We don't use the Z axis, only X and Y and a bit of zooming/rotating.
First place to look would probably be if the MSX logo image is properly placed in a GLTile and can be rendered. If that works, the rest shouldn't be too hard.
However, some effects (like the water refraction effect or the lightning effect) might give some problems. I'd leave them be first and focus on the other parts of the game .
Hope this helps.
|
| Back to Top |
|
| |
Popolon Admin Group


Joined: 05 November 2002 Location: Spain Posts: 3076
|
| Posted: 18 January 2010 at 10:51 | IP Logged
|
|
|
Hi amoreira,
I Agree with Jorito that the problem has to be in loading the msx.png file.
Loading this file is made through the method get(char *) of the class GLTManager. So, let me walk you through how this happens:
- check the code in line 47 of GLTManager.cpp. This calls the get(Symbol *) method, in line 58 of the same file (which actually loads the image)
- The most scary part of this process I think is line 75: t = new GLTile(filename). This actually loads the file, creates an OpenGL texture, etc. So, it's where the problem will be, most likely. The constructor called is the one in line 59 of file GLTile.cpp
- This constructor calls the method set(char *) (line 412 of file GLTile.cpp), which does all the work
- If the file is not found, then the error will come in lines 422 or 423, which is where the IML_load call of the SDL_image library is called.
- If the problem is because of creating the OpenGL texture, then the problem sill come after calling the "createTexture" method (line 456)
- createTexture can be found in line 35 of the file SDL_glutaux.cpp and does all the OpenGL necessary stuff to create a texture out of an SDL surface
I hope this helps , let me know!
-
|
| Back to Top |
|
| |
amoreira Newbie

Joined: 04 January 2010 Location: Brazil Posts: 25
|
| Posted: 20 January 2010 at 21:56 | IP Logged
|
|
|
Hi Popolon and Jorito.
Thank you very much for the detailed information. Everything is OK with the SDL part, IMG_Load's and the related stuff return successfully.
The problem resides in OpenGL, more specifically in glGenTextures(), which is called by SDL_glutaux.cpp.
This function never writes a non-zero value in the output parameter 'tname'. Therefore, createTexture() always return zero.
The weird thing is that the implementation of glGenTextures() in gl2gx uses a plain malloc! Either Wii ran out of memory, or it failed to allocate for some other reason.
Anyway, I'll have to study a little bit deeper inside the code of gl2gx and its dependencies.
The only thing strange that I've got from the logs, pointing to the game code, is that there are several calls to createTexture()* even before the MSX logo and texts are loaded. Is this normal?
Thanks again for the help!
* Those calls also return 0 in the handle.
|
| Back to Top |
|
| |
|
|