Results 1 to 16 of 16

Thread: Introducing ClanLib 2.0 GL1 target

  1. #1
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default Introducing ClanLib 2.0 GL1 target

    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
    Code:
    	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.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    A test for the GL1 target has been placed into SVN

    Tests/Display/CubeGL1

    See Attached Image
    Attached Images Attached Images  

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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:
    Code:
    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 ...
    Attached Images Attached Images  
    Last edited by rombust; 06-19-2009 at 04:30 PM.

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    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

  5. #5
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    The Canvas uses CL_FrameBuffer (thus works with the normal targets) ... maybe the example should be renamed to FrameBuffer

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    The GUI example under the System Manager now renders using the GL1 target (See attached image)

    ... next to fix the framebuffer...
    Attached Images Attached Images  

  7. #7
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Framebuffer for GL1 (OpenGL 1.3) target now works

    See attached...
    Attached Images Attached Images  

  8. #8

    Thumbs up

    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

  9. #9

    Default

    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 ?

  10. #10
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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

    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.

  11. #11

    Default

    When I compile the SVN targets I get errors like this:

    Code:
    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.

  12. #12

    Default

    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.

  13. #13
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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.

  14. #14

    Default

    My cpu is intel pentium 4 1.8 GHZ. How do I find out if these instructions are supported?

  15. #15
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    SSE2 was launched together with the P4 in 2000. So your CPU does support it, but probably not the compiler.

  16. #16

    Default

    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)

Similar Threads

  1. GDI Target Draw Problems
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-01-2009, 01:21 PM
  2. The GDI Target – Rendering Pixelbuffers
    By rombust in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 02-15-2009, 09:46 PM
  3. ClanLib crashes when creating CL_DisplayWindow with target SDL.
    By Otto (Strange) Halmén in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 01-19-2008, 08:38 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •