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.


Topics - Clairvoire

Pages: [1]
1
Window / How to lock cursor to window?
« on: April 30, 2016, 12:07:30 pm »
Is there a way to lock the mouse cursor to the window with SFML, such that when the mouse is about the exit the window's border, it is stopped?  Setting the mouse location isn't very reliable, as it fails when the mouse's movement is great enough (or if the program hangs briefly and delays the reset) allowing the mouse to escape and the window to lose focus.




2
I am trying to #include extlibs/headers/GL/glew.h that came with SFML, but haven't quite got it to work out. 

If I link against glew.lib and run my program, I get warnings for
Commons.lib(Shader.obj) : warning LNK4049: locally defined symbol ___glewCreateProgram imported
And after creating the SFML render window instance, if the program uses glCreateProgram(), it'll get an access violation for trying to access a NULL address.

I've read that this may be because I am not calling glewInit(), but I have also read that I should not do this when using SFML because it already does it. 

I guess my question is, is there anything special I must do to use both GLEW and SFML, while statically linking to both of them?


3
When inspecting a 'text entered' event, the integer I get from sf::Event::TextEvent::unicode is 13, for carriage return.  I would've expected this to be 10, or '\n' for newline. 

Is this intended, or is something going wrong here?  (I've never encountered a carriage return before, so this took me a bit by surprise)

4
Hello!  I wrote a program to print out the maximum size of a texture I can create, so I can get a rough idea of what a good lower limit is when programming.  (so far, I've yet to see a value below 8192). 

It prints a reasonable number at first.  But if I run the function a second time, it'll return a different, and insanely large, number.  This occurred on my laptop as well.  I'm using the latest version, fresh from the git repo.

For me, the first time, it gave me 16384.  Every time after that though, it was "11457127" which isn't even a power of 2 (or even for that matter)

Here's the code I used, it's relatively small.  The check occurs on the first line of "queryOpenGL()." I left in the other tests in case they may have had something to do with it.  This should compile I think. 

#include <cstdio>
#include <SFML/Graphics.hpp>


void queryOpenGL(){
        printf("\nMaximum texture size is %u\n", sf::Texture::getMaximumSize());
        bool modeTest = sf::VideoMode(640, 480).isValid();
        printf("A fullscreen mode of 640 by 480 is %s\n", modeTest ? "VALID" : "NOT VALID what???");
        sf::RenderWindow window(sf::VideoMode(50, 50), "Test Window", 7U, sf::ContextSettings(24, 8, 0));
        printf("Framebuffer depth/stencil format: %u:%u\n", window.getSettings().depthBits, window.getSettings().stencilBits);
        printf("Shaders are... %s\n", sf::Shader::isAvailable() ? "VALID" : "NOT VALID aawwww");
        sf::RenderTexture texture;
        bool success = texture.create(1024, 1024, true);
        printf("Attempting to create a Framebuffer Object ... %s\n", success ? "SUCCESSFUL!" : "FAILURE OH NO");
        printf("Concluding test\n");
        printf( " (\\_/)\n"
                        "(@' <'@)  Thanks bebe~\n\n");
}

int main(int argc, char * argv[]){
        char * initialMessage =
                "What tool to use?  (enter the digit)\n"
                "  0: Quit\n"
                "  1: Query SFML to see some things\n"
                ">>";
        int choice;
        do{
                printf(initialMessage);
                scanf("%i", &choice);
                switch(choice){
                case 1:
                        queryOpenGL();
                        break;
                }
                printf("\n-----\n");
        }while(choice);
        return 0;
}

5
General / unresolved references to glut/jpeg/gl stuff
« on: January 25, 2014, 01:00:58 am »
I'm in a bit of a pickle... I updated to the lastest version of SFML from source, and have been getting linker errors no matter what I do.

I'm using VS2010, telling cmake to generate static SFML libraries (SFML_STATIC is defined).  Everything compiles fine for SFML, but when I include them into my project, things don't go so well... This is the build output it's throwin' at me:

1>  All outputs are up-to-date.
1>sfml-window-s.lib(GlContext.obj) : error LNK2001: unresolved external symbol __imp__glEnable@4
1>sfml-graphics-s.lib(RenderTarget.obj) : error LNK2001: unresolved external symbol __imp__glEnable@4
1>sfml-window-s.lib(GlContext.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>sfml-window-s.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4

...

1>sfml-graphics-s.lib(Shader.obj) : error LNK2001: unresolved external symbol ___glewUniform4fARB
1>sfml-graphics-s.lib(Shader.obj) : error LNK2001: unresolved external symbol ___glewUniformMatrix4fvARB
1>sfml-graphics-s.lib(Texture.obj) : error LNK2001: unresolved external symbol __imp__glDeleteTextures@8

...

1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_finish_compress
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_write_scanlines
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_start_compress
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_set_quality
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_set_defaults
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_stdio_dest
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_CreateCompress
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: unresolved external symbol _jpeg_std_error
1>sfml-graphics-s.lib(RenderTextureImplFBO.obj) : error LNK2001: unresolved external symbol ___GLEW_EXT_framebuffer_object
1>sfml-graphics-s.lib(RenderTextureImplFBO.obj) : error LNK2001: unresolved external symbol ___glewDeleteFramebuffersEXT

...

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>F:\Sealark\Tools\Tools.exe : fatal error LNK1120: 95 unresolved externals

I've tried everything, including reacquiring and compiling the source.   I'm at a total loss...  Am I just forgetting to link or include something?  Any help would be immensely appreciated! 

6
Graphics / Requesting a Stencil Buffer on sf::RenderTexture?
« on: January 13, 2014, 12:35:59 am »
Hello!  I use stenciling a lot for lighting effects.  I can request a stencil buffer through sf::RenderWindow by passing it a ContextSettings instance (8bits stencil, 24bits depth).  However, this same functionality doesn't seem to be present with sf::RenderTexture, unless I'm mistaken of course! 

I was wondering if there was any work around?

RenderTextures do allow requesting a depth buffer, though only as a boolean (can't specify the bitplane count).  Took a look to see if I could easily add a stencil request myself, but it lead me into 2 difference -Impl.cpp type files, which I'm hesitant to mess with, aha...

7
Graphics / [solved] Disable y-flip to use mathematical model?
« on: October 13, 2011, 02:03:59 am »
Hello!  I'm trying to use opengl rendering, while at the same time using SFML in spots to control the windows and texture loading.

However, the difference between openGL and SFML's coordinate systems, specifically the fact that y rises is different directions, is causing all sorts of subtle problems.  

Is there any way to isolate and disable the parts of SMFL that performs the y-flip conversion in the first place?

8
General / gl***() functions aren't defined after including sfml(fixed)
« on: September 21, 2011, 06:42:34 am »
This is probably something silly I'm doing wrong, but the tutorial says I need only include SFML/Window.hpp to be able to use raw OpenGL code, like glBegin() and such.

However, it lists all the openGL code as being undefined.  Everything under SFML itself works fine though.  Am I forgetting to do something?

This is with VS2010, linked against static libraries, SFML_STATIC defined.

Thank you in advance~

9
General / Can SFML operate with C++ Exceptions disabled
« on: September 19, 2011, 11:25:38 pm »
Does SFML depend on C++ exceptions in such a way that if I disable them, it will hinder it's ability to work?  I went over the code and found no place where they were used, but I wanted to make sure.

10
Graphics / sf::Texture and MaskFromColor?
« on: September 16, 2011, 11:43:26 am »
Hello!  I have not updated SFML since March, when you changed from SVN to GIT.  (Could have put a warning in the commit log, thought the project died!)

My Question: I have a .png where the black colour in the image should be transparent, and setting the colour of the sf::Sprite determines the colour of the internal sprite.  (monochrome colour for font, this used to work)

sf_image->CreateMaskFromColor(sf::Color::Black);
sf_sprite->setImage(sf_image);
sf_sprite->setColor(some color);

How would I do this with textures now?  When I do the above, but with textures instead.  (the sf::Texture is created from the masked sf::Image) all it produces is a solid rectangle of whatever colour I set the sprite to.

Thanks in advance!

11
Graphics / Changing Sprite Hue, Saturation, Brightness
« on: November 12, 2010, 02:45:44 am »
I'd want to make it so I can edit these values with my sprites.  sf::SetColor and sf::SetBlendMode seem to affect the sprites at a point where this sort of thing would be possible, but I cannot pinpoint where they take place in the source code.

Basically, I just want to know how I can take source_pixel.red, and apply a formula I made to it, before it's wrote to screen_pixel.red

Or maybe that ability already exists.  Would be awesome if it did!  It's the only thing I've missed from SDL, the ability to take control at the pixel level.

12
Graphics / Sprite::Scale() throws off position
« on: November 03, 2009, 11:01:27 pm »
With smoothing turned off, which I do for almost all my images since they're all sprites, scale() will offset the (x, y) coordinates of my sprite by "scalefactor * imagesize * ~0.4"

Luckily, I knew about the offset trick in Sprite's Render() function, "GLCheck(glTranslatef(0.375f, 0.375f, 0.f));".  Commenting this out solves my problem.  

I didn't see it mentioned anywhere, so I thought I'd give a heads up~

13
Feature requests / Greater Pixel Access in sf::Image
« on: October 25, 2009, 02:24:26 am »
Hello!  Long time user, first time poster.  

I switched to SFML from SDL quite a while ago, and it was a great move up!  But there has always been something of SDL's that I really miss sorely, and that's the ability to perform pixel level modifications efficiently.

I'm aware of SetPixel(), but it has more overhead than I'm sure anyone would care for in a function whom will be called more than a million times a second.  (500 x 500 image, at 60 frames a second, is 15,000,000, so 'a million' is actually a modest accessment.  xD)

What I'm doing right now to circumvent much of that, is this:

Code: [Select]
sf::Uint8 * p = const_cast<sf::Uint8*> (image->GetPixelsPtr());

// ... mess with the pixels here ...

image->SetPixel(0, 0, image.GetPixel(0, 0));


A const cast, and a backwards function call at the end simply for the sake of setting Image::myTextureUpdate to true.  It's not very pretty, even if it works.


Maybe perhaps providing for, say... a public 'Finalize()' function in Image that would set myTextureUpdate to true (and anything else that'd have to be done, in the future), and perhaps another function that returns a non const pointer into the pixel array, that would require Finalize() be called for the image to be valid for rendering?  

It could be done with a boolean flag, that'd be set to false in the pointer retrieving function, set to true in Finalize(), and if it's not true, it can set off an Assert or something if someone attempts to render it.  I'm sure you'd think of a more elegant way, but that's probably how I'd implement it.  


This can't be the first time this has come up, but if it counts at the very least as a vote in the hat, then I'm happy~  Thanks for the awesome library!

Pages: [1]
anything