Julien Nadeau <ve...@...> writes:
> Typically, you would render your GL scene using the AG_GLView widget
> (http://libagar.org/man3/AG_GLView). Since you're mentioning GL matrices
> I assume you have a good reason not to use Agar's event loop or AG_GLView.
>
> Have a look at: http://wiki.libagar.org/wiki/Background_rendering
>
> You can ignore the "GK_*" functions in the sample code. The point is to
> call AG_WindowDraw() from your event loop to render the GUI elements. In
> the example, the background is drawn after AG_BeginRendering(), which
> clears the background and sets up Agar's own clipping planes, and that
> is probably not what you want.
>
> Actually, I would suggest you try the latest Agar SVN, which makes the
> process much easier with the AG_VIDEO_OVERLAY flag to AG_InitVideo() /
> AG_InitVideoSDL(). If AG_VIDEO_OVERLAY is in effect, AG_BeginRendering()
> and AG_EndRendering() will not clear the background, and your GL state
> will be fully preserved.
>
1.
I tried the example you mentionned as I am working on the same thing. I am also
experiencing trouble and think it is hard to get information from the documents
existing.
But I get the compilation error "undefined reference to AG_BindFloat".
I tried to comment the three lines using AG_BindFloat, as I think it is only
useful to change the values of the lights by the user. But I don't get any
drawing then, just a black background and the small agar windows on it. I
thought we would see a background ?
2.
Is the depth buffer activated by default when you launch an agar window ?
if (AG_InitCore("agar-glview-demo", 0) == -1) {
fprintf(stderr, "%s\n", AG_GetError());
return (1);
}
/* Pass AG_VIDEO_OPENGL flag to require an OpenGL display. */
if (AG_InitVideo(640, 480, 32, AG_VIDEO_OPENGL|AG_VIDEO_RESIZABLE)
== -1) {
fprintf(stderr, "%s\n", AG_GetError());
return (-1);
}
When I try to draw with GL functions, even if the glEnable(GL_DEPTH_TEST) is
activated, the result is as the depth buffer has not been activated. How to
activate it with Agar ? I didn't find any flag to use with AG_InitCore or
AG_InitVideo regarding this matter in the documentation.
Thanks for your help !
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html