PDA

View Full Version : Introducing ClanLib 2.0 GL1 target



rombust
06-17-2009, 02:52 PM
The ClanLib 2.0 SVN now contains a new target called "GL1"

The minimum OpenGL requirement is 1.3, and the target only contains the OpenGL 1.3 bindings

At the moment the target still creates the best opengl context it can (OpenGL 3.0 on latest cards)

The Basic2D and Pacman examples work.

CL_Material_GL1, CL_LightSource_GL1 and CL_LightModel_GL1 have been resurrected. To use these classes, you need to construct CL_GraphicContext_GL1 as follows

CL_GraphicContext gc = ...get_gc();
CL_GraphicContext_GL1 new_gc(gc);
new_gc.set_light(0, light);

CL_FrameBuffer does not work, so the GUI example "texture window mananger" will not work

You can run the GUI example in the "system window manager" by changing in GUI.cpp - GUI::GUI()
from: current_manager = manager_texture;
to: current_manager = manager_system;

But for an unknown reason, it does not display correctly.

rombust
06-18-2009, 10:06 AM
A test for the GL1 target has been placed into SVN

Tests/Display/CubeGL1

See Attached Image

rombust
06-19-2009, 12:21 PM
I have partially implemented CL_FrameBuffer for the GL1 target (using pbuffers)

However it still has some problems:

The canvas example works, if you replace
void on_mouse_down(const CL_InputEvent &key, const CL_InputState &state)
with:

void on_mouse_down(const CL_InputEvent &key, const CL_InputState &state)
{
if(key.id == CL_MOUSE_LEFT)
{
gc.set_frame_buffer(fb_ground);

CL_Draw::fill(gc, (float) mouse_pos.x, (float) mouse_pos.y, (float)mouse_pos.x + 16.0f, (float)mouse_pos.y + 16.0f, CL_Colorf(1.0f, 0.0f, 0.0f, 1.0f));
gc.reset_frame_buffer();
}
}
See attached image.

Also it crashes on exit.
Also on linux, the framebuffer flips with each mouse press! (okay on win32)

I would be very grateful if someone could fix it ...

Magnus Norddahl
06-22-2009, 12:58 AM
Does the canvas example work with the normal targets? I'm not really the canvas example is particular good an example, since it was originally made for 0.8 and then ported to 2.0

rombust
06-22-2009, 06:50 AM
The Canvas uses CL_FrameBuffer (thus works with the normal targets) ... maybe the example should be renamed to FrameBuffer :D

rombust
06-22-2009, 03:03 PM
The GUI example under the System Manager now renders using the GL1 target (See attached image)

... next to fix the framebuffer...

rombust
06-23-2009, 10:51 AM
Framebuffer for GL1 (OpenGL 1.3) target now works :)

See attached...

vladimirdlc
06-27-2009, 07:32 PM
a little tricky for a newbie to make it work, hope it will be included soon in a new oficcial version precompiled, but even thought thank you, it was just what I'd been looking for, love ya all <3

kthakore
07-02-2009, 05:47 PM
I am confused so if I want the opengl 1.3 support I need to do.

make GL1 (which doesn't work)

or

change each class like CL_GraphicContext gc = ...get_gc();
to CL_GraphicContext_GL1 ?

rombust
07-02-2009, 07:50 PM
No

Much simpler than that

Change: #include <ClanLib/gl.h>
To: #include <ClanLib/gl1.h>

And Change: CL_SetupGL setup_gl;
To: CL_SetupGL1 setup_gl;

It's as simple as that :D

Only if you want to do advanced stuff (that is not portable between targets), do you need to create CL_GraphicContext_GL.

But most of the time, you should never need to. Except when you want to use OpenGL 1.3 Lighting effects.

kthakore
07-02-2009, 09:40 PM
When I compile the SVN targets I get errors like this:


In file included from draw_image.cpp:8:
/usr/lib/gcc/i486-linux-gnu/4.3.2/include/emmintrin.h:34:3: error: #error "SSE2 instruction set not enabled"

I can compile the official clanlib 2.0.2 fine.

kthakore
07-02-2009, 09:55 PM
Also I looked at simple2d example in clanlib 2.0.2 official release and saw that it has
#ifdef USE_SDL

in it. How do I trigger this in the make for the examples? My idea is I can compile and check if my computer can handle atleast SDL.

rombust
07-03-2009, 07:40 AM
For the ClanLib 2.0.2 release,
Look at the Basic2D makefile - It adds "-DUSE_SDL" when you do "make sdl"

For the future:-
I am thinking of removing the "#ifdef USE_SDL" in basic2d. It looks horrible, and is confusing (and noone should need to use SDL!). Then make the example use the GDI target (clanlib software renderer).

I will try to fix the "SSE2 instruction set not enabled" error.
What CPU have you got, does it support SSE2 instructions?

If it does, you may need to update GCC to the latest version.

kthakore
07-03-2009, 08:44 AM
My cpu is intel pentium 4 1.8 GHZ. How do I find out if these instructions are supported?

sphair
07-03-2009, 09:26 AM
SSE2 was launched together with the P4 in 2000. So your CPU does support it, but probably not the compiler.

kthakore
07-03-2009, 10:01 AM
I am using G++


Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)