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

Pages: [1] 2 3 4
1
Feature requests / Message Boxes
« on: July 29, 2009, 05:41:55 pm »
I would like to see this too.
The only way to have such a thing would be to use an additional GUI library but this is way to heavyweight just for showing an error.
Showing errors in errordialog is at least on windows standard and not inconvenient on other plattforms so I think it really is the best way to inform the user that an error occured.
You could make an errorfunction in the Systemlib or wherever which shows an messagebox, logs the error and so on, I think this would fit sfml much better then adding a messagebox class since a general messagebox would be a gui element..

2
Graphics / locale error by using sf::STring
« on: February 04, 2009, 04:58:21 pm »
okay, with the svn version it works fine.

3
Graphics / locale error by using sf::STring
« on: February 04, 2009, 04:38:19 pm »
hi,
When I use sf::String in my program (just sf::String test("hi")), I get the following error:
Code: [Select]

locale::facet::_S_create_c_locale name not valid - terminating...

what does this mean and is there a way for me to fix this?

4
Graphics / mixing sf::String with OpenGL - text is always white.
« on: January 10, 2009, 12:44:10 pm »
can't see any changes, it's still white.

5
Graphics / mixing sf::String with OpenGL - text is always white.
« on: January 10, 2009, 02:57:09 am »
Any solutions?

6
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 09, 2009, 06:21:59 pm »
Well, no, the minimal example works *g* I will try to find the difference
but now I have another odd problem:
The image is a png file but when I'm trying to use it as a texture it isn't transparent.
Code: [Select]
#include <vector>
#include <sstream>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

using namespace std;
using namespace sf;

int main()
{
RenderWindow win(VideoMode(800, 600), "minimal example");
win.Show(true);

Image img;
img.LoadFromFile("/home/ankou/Pictures/001-Grassland01.png");

vector<GLshort> vertices(8);
vector<GLubyte> indices(4);

vertices[0] = 0;
vertices[1] = 0;
vertices[2] = img.GetWidth();
vertices[3] = 0;
vertices[4] = img.GetWidth();
vertices[5] = img.GetHeight();
vertices[6] = 0;
vertices[7] = img.GetHeight();
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 3;

GLfloat left(0);
GLfloat right(1);
GLfloat top(0);
GLfloat bottom(1);
vector<GLfloat> tex_coords(8);
tex_coords[0] = left;
tex_coords[1] = top;
tex_coords[2] = right;
tex_coords[3] = top;
tex_coords[4] = right;
tex_coords[5] = bottom;
tex_coords[6] = left;
tex_coords[7] = bottom;

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 800, 600, 0);

glClearColor(0, 1, 0, 0);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

while(42)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(10, 10, 0);

img.Bind();
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glVertexPointer(2, GL_SHORT, 2*sizeof(GLshort), &vertices[0]);
glTexCoordPointer(2, GL_FLOAT, 2*sizeof(GLfloat), &tex_coords[0]);

glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, &indices[0]);

win.Display();
}
}



But when I'm executing
Code: [Select]

String fps_drawable("some string", Font::GetDefaultFont(), 10);
win.Draw(fps_drawable);

before I render the rectangle the image is displayed correctly(with transparency)

edit: oh, I forgot an GLenable

7
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 09, 2009, 05:22:47 pm »
Quote
There's already a much powerful feature: you can directly use sf::Image instances as OpenGL textures (using their Bind function).

Well, that i even better :)
But how do I use it? I'm just getting a red rectangle(well, the color is a little bit odd, could you please take a look at my other thread about the textcolor?).
I tried the following code
Code: [Select]

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(x, y, layer);

/*
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_tex_name);*/
m_tex_img.Bind();
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glVertexPointer(coord_per_vertex, GL_SHORT, coord_per_vertex*sizeof(GLshort), &m_vertices[0]);
glTexCoordPointer(texel_per_vertex, GL_FLOAT, texel_per_vertex*sizeof(GLfloat), &m_tex_coords[0]);

glDrawElements(GL_QUADS, vertices_per_square, GL_UNSIGNED_BYTE, &m_indices[0]);

9
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 09, 2009, 04:52:19 pm »
of course not with this function but it may be usefull to have an additional function which returns pixeldata which can be used with OpenGL.
You are already providing functions to use sf::Images as texture (sf::Image::GetTexCoords, sf::Image::GetValidTextureSize) why not having a function which returns pixeldata which can be used for texturing?
It would be a nice addition and if you are drawing images with OpenGL you will already have this somewhere internally?

10
SFML website / SFML 1.4 Documentation no link to source?
« on: January 09, 2009, 04:49:34 pm »
Hi,
I miss the direct links from the documentation of SFML 1.4 to the implementation of a function.
They may have been removed because they aren't necessary but even if they aren't necessary I found them really usefull not only to learn something about the usage of sfml but also to learn something in general.
(Of course I can still view the sources but the links in the documentation were usefull).

11
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 09, 2009, 01:39:09 pm »
Isn't this a bit inconsistent?
You are providing a function to calculate the correct texels, a function to calculate the next valid texture size dependant on the existing extensions so you already provided functions to use sf::Image with OpenGL. Wouldn't it be good to also have a method which returns valid pixeldata (which doesn't need to be converted if there's no npot?)

12
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 09, 2009, 01:21:39 am »
because I'm also using SFML for creating the window, handling input and audio, so it would be better to use sf::Image in order to not have to add an additional dependency.

13
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 08, 2009, 11:49:50 pm »
But I don't want to use SFML to draw the image, I just want to use SFML to load the image and give me the pixeldata, so that I can use it as a texture in OpenGL. What I want to know if the pixeldata is pot, if it is needed (so if there is a 15*15 texture and an sf::Image containing the image and the OpenGL Implementation only supports pot textures, would GetPixelPtr() return an array of size 15*15*4 or of size 16*16*4?)

14
Graphics / GetPixelsPtr() power of two it pot is not allowed?
« on: January 08, 2009, 08:40:00 pm »
Hi,
I'm using sf::Image to load an image from a file and I'm using GetPixelsPtr() to get the pixeldata. The documentation states that the size of the image is GetWidth() * GetHeight() * 4 but is this always true? For example if there's no GL_ARB_texture_non_power_of_two is GetPixelsPtr NPOT?
And is there an easy way to get a pot pixel data with sfml(I mean sfml has to do this somewhere so...)

15
Graphics / mixing sf::String with OpenGL - text is always white.
« on: January 06, 2009, 07:46:40 pm »
Hi, I want to use SFML to create a window and handle input for OpenGL but I also want to use SFML for drawing strings(because it seams easy to me and I don't want to search for another OpenGL textlibrary).
Now I have a code to draw an image(with texturemapping) but when I execute the function, no matter if it is before or after the textdrawing, the drawn string is always white.
That's the relevant codepart:
Code: [Select]

img->draw(); // if I comment this line out the text is red as it should be

if(m_show_fps)
{
static int i(0);
stringstream fps("");
fps << "fps: " << static_cast<int>(1/m_window->GetFrameTime()) << endl;
sf::String fps_drawable(fps.str(), Font::GetDefaultFont(), 10);
fps_drawable.SetColor(Color::Red);
m_window->Draw(fps_drawable);
}

And image::draw
Code: [Select]

void image::draw() const
{
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, m_tex_name);

glVertexPointer(coord_per_vertex, GL_SHORT, coord_per_vertex*sizeof(GLshort), &m_vertices[0]);
glTexCoordPointer(texel_per_vertex, GL_FLOAT, texel_per_vertex*sizeof(GLfloat), &m_tex_coords[0]);

glDrawElements(GL_QUADS, vertices_per_square, GL_UNSIGNED_BYTE, &m_indices[0]);
glFlush();
}

Pages: [1] 2 3 4