Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: StormMesa and Picasso96  (Read 956 times)

0 Members and 1 Guest are viewing this topic.

Offline Sidewinder

StormMesa and Picasso96
« on: December 08, 2002, 09:55:24 PM »
Hello,

I'm attempting to create a StormMesa program using a P96 screen. The problem that I'm having is that the AmigaMesaCreateContext() function is throwing an exception (StormC 3 says number 8). It works fine with a normal Intuition screen so that leads me to believe it is something with the different format of the bitmaps or changes to the RastPort or Screen structures, but both P96 and StormMesa have absolutely minimal documentation. Note that I would rather not use glut, and I do not want to use a window (which works fine by the way). I would like to get this working with a screen. Does anyone have any ideas? Here is my code:

#ifdef __STORM__
#include "dos/dos.h"
#include "graphics/gfxbase.h"
#include "intuition/intuition.h"
#include "pragma/exec_lib.h"
#include "pragma/dos_lib.h"
#include "pragma/graphics_lib.h"
#include "pragma/intuition_lib.h"
#include "proto/picasso96.h"
#endif /* __STORM__ */

#include "GL/Amigamesa.h"
#include "exec/types.h"
#include "dos/dos.h"
#include "intuition/intuitionbase.h"
#include

struct IntuitionBase *IntuitionBase = NULL;
struct GfxBase *GfxBase = NULL;
struct Library *P96Base = NULL;
struct Screen *GL_Screen = NULL;
struct Window *GL_Window = NULL;
struct amigamesa_context *GL_Context = NULL;

void open_libraries(void);
void close_all(void);
void display(void);

int main(int argc, char** argv)
{
open_libraries();

if (!(GL_Screen = p96OpenScreenTags(P96SA_Width, 800,
P96SA_Height, 600,
P96SA_Depth, 16,
P96SA_AutoScroll, TRUE,
TAG_DONE)))
{
printf("Unable to open screen.\n");
close_all();
}

if (!(GL_Context = AmigaMesaCreateContextTags(AMA_Left, 0,
AMA_Bottom, 0,
AMA_Width, 800,
AMA_Height, 600,
AMA_Screen, GL_Screen,
AMA_RastPort, &GL_Screen->RastPort,
AMA_DoubleBuf, TRUE,
AMA_RGBMode, TRUE,
AMA_Fullscreen, TRUE,
AMA_DirectRender, TRUE,
AMA_TwoBuffers, FALSE,
AMA_Visual, NULL,
AMA_NoDepth, FALSE,
AMA_NoStencil, TRUE,
AMA_NoAccum, TRUE,
TAG_DONE)))
{
printf("Unable to create context.\n");
close_all()
}

AmigaMesaMakeCurrent(GL_Context, GL_Context->buffer);

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 0.0f, 0.0f);
glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);

glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();

AmigaMesaSwapBuffers(GL_Context);

Delay(500L);

close_all();
}

void open_libraries(void)
{
if (!(IntuitionBase = (struct IntuitionBase
*)OpenLibrary("intuition.library", 39L)))
{

printf("Unable to open intuition.library.\n");
close_all();
}

if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",
39L)))
{
printf("Unable to open graphics.library.\n");
close_all();
}

if (!(P96Base = OpenLibrary(P96NAME, 2)))
{
printf("Unable to open %s.\n", P96NAME);
close_all();
}
}

void close_all(void)
{
/* Destroy Context */
if (GL_Context)
AmigaMesaDestroyContext(GL_Context);

/* Close Window */
if (GL_Window)
CloseWindow(GL_Window);

/* Close Screen */
if (GL_Screen)
//CloseScreen(GL_Screen);
p96CloseScreen(GL_Screen);

/* Close Libraries */
if (P96Base)
CloseLibrary(P96Base);

if (GfxBase)
CloseLibrary((struct Library *)GfxBase);

if (IntuitionBase)
CloseLibrary((struct Library *)IntuitionBase);
}
Sidewinder