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 - Predator106

Pages: [1] 2 3
1
doesn't this set my sprite to be white?

2
I'm trying to draw a day sky (blue) and during the evening, I want to slowly blend in another image/texture which is the dusk (orangish blue).

How can I do this? People mentioned using mix() and lerp (which is a HLSL term). I want to adjust my opacity as it blends in, as the time changes.

3
Graphics / Rotate and translate shader output sprite
« on: December 07, 2012, 04:32:45 am »
I have an issue that i have a tilemap where i want it to be rendered only in multiples of 16, even if the screen is not as such. So as a result, i have a 4 px (900 % 16 == 4) result on the top. I wanted to move the tilemap up 4 px to hide that..how do i do this?

i tried:

    sf::Transform transform;
    transform.rotate(50.0f);
    sf::RenderStates state;
    state.shader = &m_shader;
    state.transform = transform;
    m_window->draw(m_tileMapFinalSprite, state);
 

hoping that it could rotate the result, but that doesn't work. which means that it won't be able to translate the y value either..

so, i need to move the output up. I tried moving the sprite, but this results in cutting it off, not actually moving anything..

4
oh nvm, my shader is screwed up. after a while of poking around, i think i'm just going to try it without a shader.

5
huh. my shader is working just fine, at least when i save the output to a file.. interesting.

6
I'm not sure where this is, but the only thing i can think of the problem existing in, is within the fragment shader. i pass it a row of 16x16 textures whcih are the tile_types_super_texture, and then a pixel representation of that tilemap. but my tilemap is actually visibly a couple pixels below (y) of where it should be. here's a screenshot http://wstaw.org/m/2012/12/05/plasma-desktopI21411.png

the crosshair is fine and is locked at 16x16 increments. i thought perhaps my view is off by 2 pixels or something..but that strikes me as odd as well/not possible.

i wanted to try and render the result and save that as an image, to see if the shader is in fact the issue..but i wasn't sure how to do that.

and just to make sure it wasn't my crosshair's alignment, i pushed the tilemap all the way to the top, and there's a 2px remaining from what is a tile that should be off the screen (above the top of the screen).

is there some issue here with me casting to integer, do you think? i'm kind of lost, and a bit disheartened because i thought my tile map was working perfectly, and here it's some odd problem.

i'm not even sure if it's not a driver issue..if somebody could also test this out, it probalby only builds on linux, but should be pretty easy to build there since it uses cmake. sfml 2.0 of course: https://github.com/sreich/buildarrhea

or maybe you can suggest something?

#version 130

//for a 1600x900 screen, this results in an image of 50x100 with each pixel representing a tile
uniform sampler2D tilemap_pixels;
//a runtime generated spritesheet of all tiles we know, each tile being 16x16 (so 48x16 if there are 3 tile types)
uniform sampler2D tile_types_super_texture;

//FIXME: stop hardcoding ..
ivec2 TILE_SIZE = ivec2(16, 16);

void main()
{

    ivec2 tilemap_size = textureSize(tile_types_super_texture, 0);

    ivec2 screen_coordinates = ivec2(gl_FragCoord.x, gl_FragCoord.y);

    // find the pixel (RGBA) values in the tilemap pixel representation that is what we're
    // currently interested in.
    vec4 currentPixel = texelFetch(tilemap_pixels, screen_coordinates / TILE_SIZE, 0);

    ivec2 tileCoordinate;
    tileCoordinate.x = (int(currentPixel.r * 255.0) ) * TILE_SIZE.x + (screen_coordinates.x % TILE_SIZE.x);
    tileCoordinate.y = screen_coordinates.y % TILE_SIZE.y;

    vec4 tileColor = texelFetch(tile_types_super_texture, tileCoordinate, 0);

    gl_FragColor = tileColor;
}

7
Graphics / Re: SFML 2.0 equivalent of SFML 1 Image::LoadFromPixels?
« on: December 03, 2012, 08:44:01 pm »
pft, you should get sfml 2.0 released first, you idealistic jerk ;p

8
Graphics / Re: SFML 2.0 equivalent of SFML 1 Image::LoadFromPixels?
« on: December 03, 2012, 05:09:46 pm »
ok kewl, i'll take this thread, add to it and put it into the wiki somewhere. which is where it should ultimately be, honestly.

9
SFML projects / Re: SFML Light System - Let There Be Light
« on: December 03, 2012, 04:45:45 pm »
oh yes indeed, glad it's on github as well, way easier to look at/use, and if we need to patch it..say hello to merge requests ;)

10
Graphics / Re: SFML 2.0 equivalent of SFML 1 Image::LoadFromPixels?
« on: December 03, 2012, 04:44:42 pm »
yeah, i kind of prefer to separate it as long as it doesn't get too out of hand.

speaking of which, is there a porting guide for sfml 1 -> 2?

if not, i should add these things to the wiki. obviously i'm not going to list every class change, just the not so obvious ones i run into.

11
Graphics / Re: SFML 2.0 equivalent of SFML 1 Image::LoadFromPixels?
« on: December 03, 2012, 03:36:27 am »
ah, it guess ::create(w,h, uint8*) is what i need.

12
Graphics / Re: SFML 2.0 equivalent of SFML 1 Image::LoadFromPixels?
« on: December 03, 2012, 03:18:54 am »
Is it really that hard to visit the documentation for sf::Image?

I did. I don't see it there. But apparently it is that hard to point me in the right direction in lieu of condescension.

13
Graphics / SFML 2.0 equivalent of SFML 1 Image::LoadFromPixels?
« on: December 03, 2012, 02:46:22 am »
same as my previous topic, but need a loadfrompixels equivalent. kthxbai

14
SFML projects / Re: SFML Light System - Let There Be Light
« on: December 03, 2012, 02:42:26 am »
hell yeah i'm interested in it :D

I so would like something like this for my terraria clone of a game. just please make sure it uses cmake and compiles on linux out of the box. so annoying when people use visual studio's crappy buildsystem.

15
Graphics / SFML 2.0 equivalent of SFML 1 PreserveGLStates?
« on: December 03, 2012, 02:14:59 am »
as the title says, i'm porting 1.x code to 2.x, and i ran into this amongst its opengl code and have no idea what to do with it.

Pages: [1] 2 3