GRRLIB w/ OpenGL Compile Issue
March 14, 2009 05:51PM
Not sure if anyone has tried this, but basically what I'm doing is, the main of the program is ran in GRRLIB, but when you start the game, it's supposed call all of my OpenGL functions. But, I'm getting an odd error when I try to compile:
c:/projects/wii/game/lib\libgl2gx.a(glut.o): In function `glutGet':
c:/projects/wii/gl2gx/libogc/../source/glut.c:208: multiple definition of `fb'
GRRLIB.o:c:/projects/wii/game/source/GRRLIB/GRRLIB.c:286: first defined here
I've tried looking at both GRRLIB.c and glut.c, but the code on the specified lines does not mention 'fb'. Has anyone come across this? Perhaps it's just GRRLIB and OpenGL conflicting?
Re: GRRLIB w/ OpenGL Compile Issue
March 14, 2009 06:08PM
from glut.c
#define DEFAULT_FIFO_SIZE       (256*1024)
 
static void *frameBuffer[2] = { NULL, NULL};
GXRModeObj *rmode;

u32     fb = 0;         // initial framebuffer index

taken from GRRLIB.c
#define DEFAULT_FIFO_SIZE (256 * 1024)



u32 fb = 0;

static void *xfb[2] = { NULL, NULL};

GXRModeObj *rmode;

void *gp_fifo = NULL;
Re: GRRLIB w/ OpenGL Compile Issue
March 14, 2009 06:20PM
Okay, I see what you're talking about, however, when I try to remove the u32 fb = 0; line from either file, it causes the file it was removed from to not compile. Would it be easier to recode everything using OpenGL and drop GRRLIB completely?
Re: GRRLIB w/ OpenGL Compile Issue
March 15, 2009 01:15AM
Don't think you should be removing the fb variable.

I'd rename the one in the OpenGL lib and replace all instances of it with a new variable ... maybe gl_fb. Then recompile GL lib.



Edited 2 time(s). Last edit at 03/15/2009 01:17AM by scanff.
Re: GRRLIB w/ OpenGL Compile Issue
March 15, 2009 03:56AM
Can't you just stick an
#IFNDEF
#ENDIF
around that variable? That would probably be the easier way to do it.
Re: GRRLIB w/ OpenGL Compile Issue
March 15, 2009 09:21AM
That wouldn't do squat, since this is a linking error and not a compilation error.
Re: GRRLIB w/ OpenGL Compile Issue
March 15, 2009 12:01PM
Just declaring them as 'static' in both files should fix your problem.
Re: GRRLIB w/ OpenGL Compile Issue
March 15, 2009 11:31PM
Thanks for the replies. I'll try Scanff's method of renaming the 'fb' in glut.c first, and see if that helps. If not, I'll try changing them to static. I'll let you know how it goes.
Re: GRRLIB w/ OpenGL Compile Issue
March 16, 2009 04:36PM
Umm...those variables are for your video (framebuffers) - xfb = frameBuffer. You can't have them declared both places. Your best bet is to keep them in one, and set the other up to use them with extern:

extern void *frameBuffer;
extern u32 fb = 0;

Also you can't call the video init stuff twice (VIDEO_Init(), FIFO setup, etc).
And you probably don't want to be rendering in both places either (which it switches from xfb[0] to xfb[1] and does a GX_Flush() )

Basically, it'll take a little bit of coding to get both working nicely together.
Sorry, only registered users may post in this forum.

Click here to login