Era un problema che mi ero posto anche io per un mio progettino 3 anni fa.
Io volevo aprire una finestra opengl e mettere bottoni mui, per fare tipo un "model viewer"
Mi ricordo che mi aveva risposto Tokai, dicendomi praticamente che ti devi aprire una finestra mui, dove metti tutti i tuoi gadget, e poi ne metti anche uno di tipo bitmap(mi pare) e lì ci incolli con una rasterport (sempre mi pare) la grafica della superficie SDL o Opengl. Comunque mi aveva detto di scaricarmi i sorgenti del vice perchè lo schermo del c64 è renderizzato su una bitmap e poi "incollato" in una finestra mui.
Io all'epoca lo avevo scaricato, ma i sorgenti mi reano sembrati un bordello e ho lasciato perdere
se trovo la mail la posto, anche a "futura memoria "
Ecco trovata, in questo caso parlo di opengl, ma dovrebbe andare anche con le SDL
---------------------------------------------------------------------------------------------------------
On Sat, 31 May 2008, Andrea "Raistlin77it" Beretta wrote:
> it's possible to create a mui window with buttons and an opengl part
> of it displaing a 3d model ?
>
> something like a 3ds viewer with mui buttons ?
>
> if i remember well titler display opengl and mui on the same window,
> so what class/methods i can use to display/redirect tinygl output onto mui win?
You need an area subclass to display your GL stuff in MUI window. You only
need an offscreen bitmap which is blitted to the window in your MUIM_Draw method.
For example in Frodo 4 my TinyGL has following setup called from
MUIM_Setup:
STATIC ULONG mSetupTGL(struct Display_Data *data, ULONG width, ULONG height, ULONG depth)
{
struct Library *TinyGLBase;
TinyGLBase = OpenLibrary("tinygl.library", 0);
if (TinyGLBase)
{
data->TinyGLBase = TinyGLBase;
if ((__tglContext = GLInit()))
{
data->Texture = (GLubyte *)AllocTaskPooled(DISPLAY_X * DISPLAY_Y * 4 * sizeof(GLubyte));
if (data->Texture)
{
if (data->RastPort.BitMap)
data->RastPort.BitMap = AllocBitMap(width, height, depth, BMF_DISPLAYABLE|BMF_MINPLANES, _screen(data->ehn.ehn_Object)->RastPort.BitMap);
if (data->RastPort.BitMap && glAInitializeContextBitMap(data->RastPort.BitMap))
{
glViewport(0 , 0 , width , height);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glWindowPos2f(0, 0);
glPixelZoom(1.0f * (float)width/(float)DISPLAY_X, -1.0f * (float)height/(float)DISPLAY_Y);
#if USE_TGL_PALETTE
glColorTable(GL_COLOR_TABLE, GL_RGBA, 256, GL_RGBA, GL_UNSIGNED_BYTE, data->TGLColours);
#endif
data->GLRender = TRUE;
return TRUE;
}
}
}
}
mCleanupTGL(data);
return FALSE;
}
This is only partial example i.e. InitRastPort(&data->RastPort) is done in
other part of code! Once tinygl context is initialized you can render to
your offscreen bitmap using GL calls.
In MUIM_Draw I simply call BltBitMapRastPort() to display stuff in screen:
BltBitMapRastPort(data->RastPort.BitMap, 0, 0, rp, mleft, mtop , mwidth, mheight, 0xc0);
Please remember that some gfx boards have limitations in 3D. I recall that
old Voodoo cards cant do 32bit modes well if at all. They may also impose
restrictions on texture sizes etc.
Bigfoot or kiero (Mark Olsen and Michal Wozniak) should know more about
it...
Ilkka
---------------------------------------------------------------------------------------------
Ecco era frodo, non il vice
ed avevo chiesto ad itix, non tokai