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

Pages: [1] 2 3
1
Graphics / Re: Question about textures and resources in general
« on: June 14, 2018, 11:55:19 pm »
Well, the idea was to keep sprites and textures in an array anyway, so I guess that could work...
Thanks!

2
Graphics / Question about textures and resources in general
« on: June 14, 2018, 11:26:53 am »
Hello there.
It's been a long time since I used sfml and I redesigned my engine to not use pointers (at least I don't manage them manually) but I have a question. Let's say I load a texture that is used by several sprites. If I make a caching system by creating two sprites that use the same texture will it work? What I mean is will texture be deleted only when I delete all if the sprites and if at least one of them is alive and kicking the texture will be stored in memory? Or is there another better way of implementing caching?

3
Graphics / Re: RenderTarget and OpenGL?
« on: February 19, 2017, 02:16:54 am »
Thanks for the answers.
Currently I am stuck at drawing the 3d scene to the target. In the tutorial sf::RenderTexture::Draw is used, however I can't use that since I'm not deriving my classes from any SFML class. So how should I render my models to a target?

4
Graphics / Re: RenderTarget and OpenGL?
« on: February 16, 2017, 02:44:26 am »
That's the problem...
How would I use sf::Texture to render a 3D scene to it?  :-\

5
Graphics / RenderTarget and OpenGL?
« on: February 16, 2017, 12:30:10 am »
Hello there, me again.

Can someone tell me if there is a way to use RenderTargets to render OpenGL objects? I mean, I want to use them for post processing and I am rendering 3D with OpenGL (not using SFML for 3D).

6
Graphics / Re: OpenGL (3D) with transparency?
« on: August 31, 2015, 10:47:38 pm »
Yes, I use both. (glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);).
The drawing is performed by passing vertex, texture and index arrays:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMultMatrixf(camera->GetTransformationMatrix());

float position[4] = {-1,1,-1,0};
glLightfv(GL_LIGHT0, GL_POSITION, position);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(3, GL_FLOAT, 0, &vertices.at(0));
glNormalPointer(GL_FLOAT, 0, &normals.at(0));
glTexCoordPointer(2, GL_FLOAT, 0, &tcoords.at(0));
glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, &indices.at(0));

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 

7
Graphics / OpenGL (3D) with transparency?
« on: August 31, 2015, 10:14:21 pm »
Hello.
Now, this isn't exactly SFML related question but I bind textures to meshes by using sf::Texture->bind(), so...

The problem is: there is no transparency on PNG textures. Everything that is transparent draws as black color.
How do I fix it?

8
General / Re: Strange OpenGL bug thingy and problems
« on: January 02, 2015, 04:35:11 pm »
Well, obviously deltaTime goes up when FPS go down, they're inverses of each other.  It's still not a significant difference.  Like Laurent said, at FPS that high (or deltaTimes that low) these kinds of differences really don't mean anything other than you aren't drawing much yet.  Don't worry about it until you're falling below 60.

Still need minimal & complete examples for the real issues.
Okay then. Gotta stop worrying about FPS dropping from 1200 to 800 ^__^

As for examples:
bool GLManager::Render() {
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glMultMatrixf(camera->GetTransformationMatrix());

        float position[4] = {camera->GetPosition().x,camera->GetPosition().y,camera->GetPosition().z,1};
        glLightfv(GL_LIGHT0, GL_POSITION, position);

        glEnableClientState(GL_NORMALIZE);
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_NORMAL_ARRAY);
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
        std::vector<ObjectClass*>* objects = coreManager->GetObjectsManager()->GetObjectsToDraw();
        for (int i=0;i<objects->size();i++) {
                ObjectClass* object = objects->at(i);
                object->Render();
        };
        glDisableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_NORMAL_ARRAY);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
        glDisableClientState(GL_NORMALIZE);
        return true;
};

This thing ives me an error on normalization.

bool SkinnedMeshClass::Render() {
        if (!visible) return true;
        msModel* mesh = static_cast<SkinnedMeshDataClass*>(meshData)->GetMesh();
        glPushMatrix();
        glMultMatrixf(transformationMatrix);
        std::vector<SkinnedMeshGroup*>* groups = static_cast<SkinnedMeshDataClass*>(meshData)->GetGroups();
        for (int i=0;i<groups->size();i++) {
                sf::Texture* texture = groups->at(i)->texture;
                ms3d_material_t* material = groups->at(i)->material;
                bool hasTexture = (texture!=NULL);
                bool hasMaterial = (material!=NULL);
                if (hasTexture) {
                        sf::Texture::bind(texture);
                };
                if (hasMaterial) {
                        if (material->mode & HASALPHA) {
                                glEnable(GL_BLEND);
                                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                        } else {
                                glDisable(GL_BLEND);
                        };
                };
                std::vector<sf::Vector2f>* texCoords = &groups->at(i)->texCoords;
                std::vector<unsigned short>* indices = &groups->at(i)->indices;
                glVertexPointer(3, GL_FLOAT, 0, groups->at(i)->vertexArray);
                glNormalPointer(GL_FLOAT, 0, groups->at(i)->normalArray);
                glTexCoordPointer(2, GL_FLOAT, 0, &texCoords->at(0));
                glDrawElements(GL_TRIANGLES, indices->size(), GL_UNSIGNED_SHORT, &indices->at(0));
        };
        sf::Texture::bind(NULL);
        glPopMatrix();
        return true;
};

This thing gives me 1280 error.

9
General / Re: Strange OpenGL bug thingy and problems
« on: January 02, 2015, 04:20:55 pm »
Show code and exact error messages. A vague description of your problems won't help anyone to solve them.

Quote
And the third is not an error but some strange bahaviour. When I'm far away from a mesh it gives nive 1200 FPS. When I'm very close FPS drops down to 800.
More pixels are shown on screen, so it takes "longer". But a drop from 1200 FPS to 800 FPS is negligible, don't measure performances with FPS, especially when they are high, because FPS are not a linear scale (remember, they are 1/x).
Ah, that would be the logical case, yes, but I have another "room" mesh that already takes the whole screen. Also, it happens when I'm REALLY close to the first mesh, when its single triangle takes the whole screen.
And delta time gets bigger as well, not only FPS.

10
General / Strange OpenGL bug thingy and problems
« on: January 02, 2015, 03:32:44 pm »
I just hope anyone here uses SFML as a framework to make 3D games.
There are few problems I have.
First when I try to bind a texture with sf::Texture::bind, it gives me errors on the console. The texture gets binded anyway but that kinda bugs me since errors are bad.
Second is when I try to set normalization. It says "OpenGL error 1280".
And the third is not an error but some strange bahaviour. When I'm far away from a mesh it gives nive 1200 FPS. When I'm very close FPS drops down to 800. It's noticable on integrated Intel HD video chip. On GeForce 860M it drops down for 40 FPS.
Your thoughts on that?

11
General / Re: SFML 2.1 doesn't receive events
« on: November 21, 2014, 10:42:05 am »
Seems like it would take quite a lot of restructuring the source to make it minimal.
Anyways, theproblem was solved by not adding a loop and instead polling events every tick. I'm still interested in what actually happens but alas no problems now.
Thanks to everyone who replied.

12
General / Re: SFML 2.1 doesn't receive events
« on: November 20, 2014, 07:47:32 pm »
Can you actually post a complete and minimal code sample so we can test it ourselves?
Sure. But not today, unfortunately :c

13
General / Re: SFML 2.1 doesn't receive events
« on: November 20, 2014, 06:43:33 pm »
Quote
How do you check
I set a breakpoint and se if it ever breaks. I doesn't. Ever.

Quote
How do you check, if the program even gets to the "inputManager->Update()" line?
This is my own input manager, it doesn't need a parameter. Event pointer is given to it when it's being created.

Quote
So if you are debugging in your IDE, your renderWindow won't get any events.
I tried it in release build as well.

14
General / Re: SFML 2.1 doesn't receive events
« on: November 20, 2014, 04:09:27 pm »
Oh yeah, forgot I need to at least provide a piece of code. Sorry >__>

Ahem.
This piece of code is where the problem occurs:
char CoreManager::Update() {
        while (renderWindow.isOpen()) {
                CalculateDeltaTime();
                while (renderWindow.pollEvent(inputEvent)) {
                inputManager->Update();
};
                if (inputManager->GetKeyPressed(sf::Keyboard::Escape)) GameEnd();
                if (gameIsEnded || ManagerClass::Update()==3) {
                        renderWindow.close();
                        return true;
                };
                Render();
        };
        return true;
};

The problem is that whenever I check if the program even gets to the "inputManager->Update()" line, it shows that it doesn't. Obviously because the condition returns "false" in the loop.

The OS I use is Windws 8.1, I use VS 2010 Pro and SFML 2.1.

15
General / SFML 2.1 doesn't receive events
« on: November 20, 2014, 03:07:23 pm »
This is strange since it's been working before. Suddenly it stopped receiving events when FPS is above 120 or so. And even when it's below it stopps doing it sometimes, completely random. The fun thing is that mouse position is still updated...

Pages: [1] 2 3
anything