Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Cyragia

Pages: [1] 2
1
General / Re: SFML on Linux - Shared Library versions
« on: April 20, 2014, 02:01:41 pm »
That seems to be how Steam games do it as well...
Would this mean I'd have to compile all of the SFML dependencies as well, or could I just grab them from somewhere ?

2
General / SFML on Linux - Shared Library versions
« on: April 19, 2014, 08:22:14 pm »
Hello,
I'm trying to get the example program (http://www.sfml-dev.org/tutorials/2.1/start-linux.php) to compile and run on my linux box. I'm using ubuntu 13.10 btw.
I downloaded the precompiled shared libraries from here: http://www.sfml-dev.org/download/sfml/2.1/
I followed the tutorial, when I try to link my object file I get this error:
/usr/bin/ld: warning: libGLEW.so.1.5, needed by ./lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
./lib/libsfml-graphics.so: undefined reference to `__glewUniform1fARB'
./lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shader_objects'
./lib/libsfml-graphics.so: undefined reference to `__glewGetObjectParameterivARB
and a whole bunch more undefined glew references
I know I have the most recent version of glew, so it's just a version mismatch. After looking around on this forum I saw Laurent told someone to just compile SFML on their own pc to get rid of all version mismatches.
He also suggested to not distribute the shared libs along with the program, but seeing as SFML2.1 hasn't yet been incorporated in the ubuntu packages I have no other choice.

Imagine this situation:
I want to create a program with SFML and distribute it, to be used on multiple ubuntu versions or even linux distros.

As stated above I'll have to distribute the shared SFML libs along with the program, but what about the shared glew, jpeg, xlib, ... libs ? If I were to recompile SFML on my system, won't that 'lock' the binary with the versions of those libs I had on my pc at that time ? for example, if I have version 1.8 of some library, and someone tries to run my program but only has version 1.5, will it still work ? And if I compile for version 1.5, will it work for version 1.8 ?

I hope my questions are clear.

3
Graphics / Re: SFML 2.1 and GLEW
« on: October 30, 2013, 09:59:39 am »
Great !
And thanks for the help everyone !

4
Graphics / Re: SFML 2.1 and GLEW
« on: October 30, 2013, 09:53:40 am »
It got it to work with default sfml 2.1 !
I used the glew headers from the extlibs folder (from git), defined GLEW_STATIC and linked to the static sfml libs (not to glew.lib, neither glew32s.lib), and it worked !
So it was probably a slightly different version...

Maybe you should include the extlibs folder in the official 2.1 version so we can use the same glew version as sfml. (and add this to the opengl tutorial maybe ?)


5
Graphics / Re: SFML 2.1 and GLEW
« on: October 29, 2013, 09:05:55 pm »
Yes, I defined the GLEW_STATIC macro.
And I magaged to fix it by using the glew files (inlcude and lib) from the sfml folder.
This only worked with the version I compiled myself, not with the standard 2.1 version.
So i think the problem is fixed for me atm, but there should be a way to do it with the default 2.1 files, right ?
I'd like to be able to use the default files and not a homecompiled one.

6
Graphics / Re: SFML 2.1 and GLEW
« on: October 29, 2013, 08:10:00 pm »
ah, didn't know that...
is there a comprehensive list somewhere of what to link ?

Or another solution to my initial problem ?

I still can't get it to compile, if I link with glew.lib i can't use glew, if I link with glew32s.lib sfml can't use glew.
(If i don't use SMFL/Graphics it compiles fine)

7
Graphics / Re: SFML 2.1 and GLEW
« on: October 29, 2013, 07:09:55 pm »
so, I downloaded and compiled the most recent version of sfml on git, but I still can't get my program to compile.

If I link with glew.lib (the one in included in sfml)
I still can't use glew myself and I get these errors:
1>------ Build started: Project: VoxelGame, Configuration: Release Win32 ------
1>Linking...
1>main.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glClear@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
1>main.obj : error LNK2001: unresolved external symbol __imp__glDrawElements@16
1>main.obj : error LNK2001: unresolved external symbol _glewInit@0
1>main.obj : error LNK2001: unresolved external symbol _glewGetString@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glDepthMask@4
1>main.obj : error LNK2001: unresolved external symbol _glewGetErrorString@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glCullFace@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
1>main.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
1>sfml-window-s.lib(GlContext.obj) : error LNK2001: unresolved external symbol __imp__glEnable@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glFrontFace@4
1>glew.lib(glew.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress@4
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress@4
1>glew.lib(glew.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>sfml-window-s.lib(GlContext.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>glew.lib(glew.obj) : error LNK2001: unresolved external symbol __imp__wglGetCurrentDC@0
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglGetCurrentContext@0
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglShareLists@8
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
1>sfml-window-s.lib(JoystickImpl.obj) : error LNK2001: unresolved external symbol __imp__joyGetPosEx@8
1>sfml-window-s.lib(JoystickImpl.obj) : error LNK2001: unresolved external symbol __imp__joyGetDevCapsW@12
1>sfml-system-s.lib(SleepImpl.obj) : error LNK2001: unresolved external symbol __imp__timeEndPeriod@4
1>sfml-system-s.lib(SleepImpl.obj) : error LNK2001: unresolved external symbol __imp__timeBeginPeriod@4
1>sfml-system-s.lib(SleepImpl.obj) : error LNK2001: unresolved external symbol __imp__timeGetDevCaps@8
1>C:\Users\Manu\Desktop\Coding\OpenGL\VoxelGame\Release\VoxelGame.exe : fatal error LNK1120: 25 unresolved externals
1>Build log was saved at "file://c:\Users\Manu\Desktop\Coding\OpenGL\VoxelGame\VoxelGame\Release\BuildLog.htm"
1>VoxelGame - 29 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

If I include glew32s.lib (the one from my own copy of glew)
I get these errors:
1>------ Build started: Project: VoxelGame, Configuration: Release Win32 ------
1>Linking...
1>main.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glClear@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
1>main.obj : error LNK2001: unresolved external symbol __imp__glDrawElements@16
1>main.obj : error LNK2001: unresolved external symbol __imp__glDepthMask@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glCullFace@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
1>main.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
1>sfml-window-s.lib(GlContext.obj) : error LNK2001: unresolved external symbol __imp__glEnable@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glFrontFace@4
1>glew32s.lib(glew.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress@4
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress@4
1>glew32s.lib(glew.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>sfml-window-s.lib(GlContext.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>glew32s.lib(glew.obj) : error LNK2001: unresolved external symbol __imp__wglGetCurrentDC@0
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglGetCurrentContext@0
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglShareLists@8
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
1>sfml-window-s.lib(JoystickImpl.obj) : error LNK2001: unresolved external symbol __imp__joyGetPosEx@8
1>sfml-window-s.lib(JoystickImpl.obj) : error LNK2001: unresolved external symbol __imp__joyGetDevCapsW@12
1>sfml-system-s.lib(SleepImpl.obj) : error LNK2001: unresolved external symbol __imp__timeEndPeriod@4
1>sfml-system-s.lib(SleepImpl.obj) : error LNK2001: unresolved external symbol __imp__timeBeginPeriod@4
1>sfml-system-s.lib(SleepImpl.obj) : error LNK2001: unresolved external symbol __imp__timeGetDevCaps@8
1>C:\Users\Manu\Desktop\Coding\OpenGL\VoxelGame\Release\VoxelGame.exe : fatal error LNK1120: 22 unresolved externals
1>Build log was saved at "file://c:\Users\Manu\Desktop\Coding\OpenGL\VoxelGame\VoxelGame\Release\BuildLog.htm"
1>VoxelGame - 26 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Am I soing something wrong ?

8
Graphics / SFML 2.1 and GLEW
« on: October 29, 2013, 05:50:48 pm »
Hello,
I'm making an openGL application using sfml en glew. (I'm using sfml 2.1)
I'm including my own glew headers and linking to both glew  and sfml statically.

When I try to compile my code a get tons of linker errors like this one:
sfml-graphics-s.lib(glew.obj) : error LNK2005: ___glewCopyTexSubImage3D already defined in glew32s.lib(glew.obj)

When I don't link to glew32s.lib I can't use glew myself.
main.obj : error LNK2001: unresolved external symbol _glewInit@0

I have searched the forum and found some glew related topics but none had a solution to my problem.

Any help is appreciated...

9
SFML projects / Re: [Release] Simple Pixel Renderer
« on: September 30, 2012, 05:19:00 pm »
@Haikarainen :
The main difference with a rendertexture is that this is made for 1.6 which doesn't have rendertexture, and the my class supports true circles, and sfml only supports polygons (which might look ok, if you have enough points).
It indeed isn't hardware accelerated, but it is much faster than any other way in sfml 1.6 :)
And for performance, i get ~25 fps wheni draw every pixel individually (if you were to draw overlapping shapes, it would be slower).
I get ~85 fps when i draw 100 random circles with a diameter between 1 and 50.
I'm using an Intel i3-2310M processor @ 2.1 GHz and an Intel hd3000 integrated gfx card, but it shouldn't matter as it's not hardware accelerated.

@FRex :
I don't really understand what you mean by "some algorithm to bind lines and circles down onto a grid" could you explain yourself a bit clearer ?

10
SFML projects / [Release] Simple Pixel Renderer
« on: September 30, 2012, 01:28:56 pm »
Hello,
Recently i was making something using sfml, and i had to draw lots ( 1000 + ) of little shapes ( 1 - 5 pixels).
When i tried to do this with sprites or lines of length 1, it was super laggy.
After a bit of searching on the forums, I found out that the best way to do something like this, is to render them to a pixelarray, and then loading the complete array to the video memory at once. It was indeed much faster.
So I wrote a simple class which could render induvidual pixels to a buffer. A bit later i added lines, then circles and rectangles.
I noticed quite a lot of people need something like this, so I'm releasing my class to the public :)
I'm not claiming this is the best/fastest way of doing this, neither is this code very optimized, but nonetheless i think a lot of people will find this useful.

If you have suggestions, or found a bug, feel free to tell me !


NOTE: the buffer is meant to cover the whole screen !
If you want to draw anything else, first draw this, then draw your sprites or whatever after it.

usage example :

//initialization
sf::RenderWindow Window(sf::VideoMode(WIDTH, HEIGHT, 32), "Example");
CRenderer Renderer( WIDTH, HEIGHT );

//-------------------------------------

//inside renderer loop

//clear window
Window.Clear();
//clear buffer (optional: choose a color )
Renderer.Clear();

//draw everything you want
Renderer.DrawCircle( 100, 150, 10, sf::Color( 255 ), 0, 0 ), true );
Renderer.DrawPixel( 100, 150, sf::Color( 255 ), 0, 0 ), true );

//draw the buffer to the screen
Renderer.DrawToWindow( Window );

//draw everything else: sprites, images, text, ...

//display window
Window.Display();
       
 

full class:
class CRenderer {

public:

        sf::Uint8* pixelArray;
        int width;
        int height;
        sf::Image ScreenImage;

        CRenderer( int _width, int _height)
        {
                width = _width;
                height = _height;
                pixelArray = new sf::Uint8[ width * height * 4 ];

                for( int i = 0 ; i < width * height * 4 ; i++ )
                {
                        pixelArray[i] = 0x00;
                }

        }

        ~CRenderer()
        {
                delete[] pixelArray;
        }

        void DrawToWindow( sf::RenderWindow& Screen, bool smooth = false ){
                ScreenImage.LoadFromPixels( width , height, pixelArray );
                ScreenImage.SetSmooth( smooth );
                sf::Sprite ScreenSprite( ScreenImage );
                Screen.Draw( ScreenSprite );
        }
        void DrawPixel( int x, int y, sf::Color color ){
                if( ( x >= 0 ) && ( x < width ) && ( y >= 0 ) && ( y < height ) )
                {
                        pixelArray[ (y * width + x)*4 ] = color.r;
                        pixelArray[ (y * width + x)*4 + 1 ] = color.g;
                        pixelArray[ (y * width + x)*4 + 2 ] = color.b;
                        pixelArray[ (y * width + x)*4 + 3 ] = color.a;
                }
        }
        void DrawLine( int x0, int y0, int x1, int y1, sf::Color color ){

                int dx = abs( x1 - x0 );
                int dy = abs( y1 - y0 );
                int sx = 0;
                int sy = 0;

                if( x0 < x1 ) { sx = 1; }else{ sx = -1; }
                if( y0 < y1 ) { sy = 1; }else{ sy = -1; }

                int error = dx - dy;

                while(1)
                {
                        DrawPixel(x0,y0, color);
                        if( x0 == x1 && y0 == y1){ break; }
                        int e2 = 2*error;
                        if( e2 > -dy ){ error = error - dy; x0 = x0 + sx; }
                        if( e2 < dx){ error = error + dx; y0 = y0 + sy; }
                }
        }
        void DrawCircle( int x0, int y0, int r, sf::Color color, bool filled = true )
        {
                int f = 1 - r;
                int ddF_x = 1;
                int ddF_y = -2 * r;
                int x = 0;
                int y = r;

                DrawPixel(x0, y0 + r, color);
                DrawPixel(x0, y0 - r, color);
                if( filled )
                {
                        DrawLine(x0 - r, y0, x0 + r, y0, color);
                }
                else
                {
                        DrawPixel(x0 + r, y0, color);
                        DrawPixel(x0 - r, y0, color);
                }

                while(x < y)
                {
                        if(f >= 0)
                        {
                                y--;
                                ddF_y += 2;
                                f += ddF_y;
                        }
                        x++;
                        ddF_x += 2;
                        f += ddF_x;    
                        if( filled )
                        {
                                DrawLine(x0 + x, y0 + y, x0 - x, y0 + y, color);
                                DrawLine(x0 + y, y0 + x, x0 - y, y0 + x, color);
                                DrawLine(x0 + x, y0 - y, x0 - x, y0 - y, color);
                                DrawLine(x0 + y, y0 - x, x0 - y, y0 - x, color);
                        }
                        else
                        {
                                DrawPixel(x0 + x, y0 + y, color);
                                DrawPixel(x0 - x, y0 + y, color);
                                DrawPixel(x0 + x, y0 - y, color);
                                DrawPixel(x0 - x, y0 - y, color);
                                DrawPixel(x0 + y, y0 + x, color);
                                DrawPixel(x0 - y, y0 + x, color);
                                DrawPixel(x0 + y, y0 - x, color);
                                DrawPixel(x0 - y, y0 - x, color);
                        }
                }
        }

        void DrawRectangle( int x1, int y1, int x2, int y2, sf::Color color, bool filled = true ){
                if( x1 > x2 ){
                        int temp = x1;
                        x1 = x2;
                        x2 = temp;
                }
                if( y1 > y2 ){
                        int temp = y1;
                        y1 = y2;
                        y2 = temp;
                }
                for( int x = x1 ; x < x2 ; x++ )
                {
                        for( int y = y1 ; y < y2 ; y++ )
                        {
                                DrawPixel( x, y, color );
                        }
                }
        }
        void Clear( sf::Color color ){
                for( int i = 0 ; i < width * height ; i++ )
                {
                        pixelArray[ i * 4 ] = color.r;
                        pixelArray[ i * 4 + 1 ] = color.g;
                        pixelArray[ i * 4 + 2 ] = color.b;
                        pixelArray[ i * 4 + 3 ] = color.a;
                }
        }
};
 

11
Graphics / Re: Drawing individual pixels
« on: August 31, 2012, 03:47:33 pm »
i compiled sfml myself, but i don't know which pdb files i have to copy and where to copy them.
i have the "vc90.pdb" files, "Debug DLLsfml-xxx-d.pdb" and "Release DLLsfml-xxx.pdb".

i've solved the grey area problem btw. stupid mistake on my side...

12
Graphics / Re: Drawing individual pixels
« on: August 31, 2012, 02:04:29 pm »
i can't seem to find where to disable linker warnings...
and yes, i link with the static debug libraries in debug mode.

13
Graphics / Re: Drawing individual pixels
« on: August 31, 2012, 01:56:37 pm »
sorry, i mean warnings, LNK4099 to be specific.
the one about the missing pdb files.

and when i compile my code in debug mode i'm getting a big grey area on my screen. (see attachment)
When i compile in release mode it's fine.


[attachment deleted by admin]

14
Graphics / Re: Drawing individual pixels
« on: August 31, 2012, 01:51:55 pm »
nvm, i made a stupid mistake somewhere else.
is there a way to disable linker errors btw ? (in msvs2008)

15
Graphics / Re: Drawing individual pixels
« on: August 31, 2012, 01:31:10 pm »
ok, i tried replacing this:
__int32* _pixelArray;
...
_pixelArray = new __int32[width * height * 4];
...
__int32 colorTotal = ( ( ( ( color.r ) & 0xff ) << 24 ) | ( ( ( color.g ) & 0xff ) << 16 ) | ( ( ( color.b ) & 0xff ) << 8 ) | ( ( color.a ) & 0xff ) );
_pixelArray[ y * _width + x ] = colorTotal;
 
with this:
sf::Uint8* _pixelArray;
...
_pixelArray = new sf::Uint8[width * height * 4];
...
_pixelArray[ (y * _width + x)*4 ] = color.r;
_pixelArray[ (y * _width + x)*4 + 1 ] = color.g;
_pixelArray[ (y * _width + x)*4 + 2 ] = color.b;
_pixelArray[ (y * _width + x)*4 + 3 ] = color.a;
 
but it gives different results, what did i do wrong ?

Pages: [1] 2
anything