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

Pages: [1] 2 3 ... 5
1
Thank you for the input!
Swapping the texture unbinding was exactly what solved the issue.

These binding/unbinding operations seem to adhere to some kind of stack behaviour.
I will unwind any binding in the exact opposite order  ;D


Thanks!

2
Tested on a GeForce GTX 970, same problems here.

Perhaps I investigate bindless textures to remove problems with texture units probably in use by SFML.

3
Hey everybody,

currently I'm trying to mix OpenGL and SFML. Used the great OpenGL 3.3 tutorials at learnopengl.com to render a cube with two textures on it. That works without problems, even when using sf::RenderWindow().
The shaders use the texture units GL_TEXTURE0 and GL_TEXTURE1.

The problems arise if I also use a sf::RectangleShape besides the pure gl-calls.

My loop is like:

window.setActive(true);

glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tex1_id);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, tex2_id);

glUseProgram(shader_id);

model = glm::rotate(glm::mat4(1.0f), clock.getElapsedTime().asSeconds(), glm::vec3(0.5f, 1.0f, 0.0f));
glUniformMatrix4fv(glGetUniformLocation(shader_id, "model"), 1, GL_FALSE, &model[0][0]);

glBindVertexArray(VAO);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, 0);

glUseProgram(0);

window.setActive(false);


window.pushGLStates();
window.draw(cell_shape); // sf::RectangleShape cell_shape(sf::Vector2f(15, 15));
window.popGLStates();


window.display();
 

If I order the window to pushGLStates it issues:
An internal OpenGL call failed in rendertarget.cpp(381).
Expression:
   glPushMatrix()
Error description:
   GL_STACK_OVERFLOW
   This command would cause a stack overflow.
 

And at popGLStates:
An internal OpenGL call failed in rendertarget.cpp(398).
Expression:
   glPopMatrix()
Error description:
   GL_STACK_UNDERFLOW
   This command would cause a stack underflow.
 

This only happens if I use both texture units. The error disappears if I don't bind GL_TEXTURE1. Only one currently bound texture seems to be no problem, two simultaneously bound textures are indeed a problem. It doesn't matter which tex units I use (GL_TEXTURE2, GL_TEXTURE3, ...), they all issue the errors.

Most disturbing is that everything is rendered correctly...


Any ideas?
I'm using SFML from repo, cloned five days ago from master, together with VS2017 and Win7-64.
Perhaps it's a problem with my graphics card; I only have the crappy Intel HD 5500. I have no other device for testing.

4
SFML projects / Re: Screenshot Thread
« on: December 19, 2016, 12:25:03 pm »
@eXpl0it3r:
Yep, SelbaWard is awesome  ;D

But this...
I created a little light engine wich is very cute :

[..]

It uses fragment shaders to create depth maps, and to render the scene. Thus, any sf::Drawable can cast light. Normal maps are used to create pseudo 3d for the background tiles.
...this is also awesome. @brunnerant, do you have any further information? Perhaps a devblog or such a thing?

5
General / Re: Help VS 2013 cannot open file
« on: October 20, 2014, 07:33:01 pm »
Just google the error code and you find:
http://msdn.microsoft.com/en-us/library/ts7eyw4s.aspx

Which implies -- more or less -- that you just didn't configure everything exactly(!) the way the instructions described, because it says that the file physically can't be found or opened.
In most cases this is due to wrong configured project settings, especially path settings.

No compatibility problems.

6
General / Re: Using SFML in our own engine dll
« on: October 14, 2014, 10:36:18 pm »
I want to create a mini engine along with my game because I want to reuse the engine later.
You can reuse the engine without going down into the "DLL hell". It is simply not necessary. Just write your engine, use a namespace and place the files in a separate directory. In your game project, just include them from that directory. With the namespace, you have a fine and nice separation without the DLL hassle.


If I setup SFML with my game project directly everything works as expected but I need to setup as mentioned before.
What do you mean by "I need to setup as mentioned before"? Where stems the necessity from? Is it necessary because you think it is or because you experienced a major obstacle that could only be solved by placing your engine in a separate dll?
In my experience, there is no possible outcome that justifies countless hours wasted with Visual Studio DLL project settings. Even more, if those hours could be used to write a great game  ;)

7
SFML projects / Re: Thor 2.0
« on: August 29, 2014, 10:33:52 pm »
When is Thor2.0 going to be done, sorry but I been watching it for years and still nothing is final? This sucks... Please finish it so one can use it in 2.0 final state...
That's gross! Nexus does this in his spare time, without compensation and gives it to you for FREE and you DEMAND that he should speed up the process?

Unbelievable...

8
Graphics / Re: Angle between 2 points
« on: August 21, 2014, 02:05:46 pm »
It's mapPixelToCoords:
http://sfml-dev.org/documentation/2.1/classsf_1_1RenderTarget.php#a2b0cab0e4c6af29d4efaba149d28116d

Why didn't you read in the API-docs? They are there for a reason...



'EDIT: Laurent was faster.

9
Graphics / Re: when to open new rendervindow?
« on: August 21, 2014, 02:03:34 pm »
This
Why don't you use the same window? :p
and that
split code in few functions?
are totally unrelated!

Why do you think you need more than one window? Please be a bit more elaborate than "split code in few functions"!

10
General / Re: Switching 'scenes'
« on: August 20, 2014, 07:46:08 pm »
Okay fine, thanks for not even helping me anymore. Jesus, what a community...
What goes around comes around. You come here and demand help without giving necessary information. That is very bold, to say the least.

11
General / Re: Very High CPU Usage.
« on: August 20, 2014, 11:19:08 am »
Why don't you just try the method Gobbles suggested instead of asking for more?

Asides, the code you showed will exploit every single bit of CPU time it gets. Why is that a problem for you? Seems to look like premature optimization...

12
General / Re: SFML 2.1 Visual Studio Tutorial not working
« on: August 07, 2014, 11:35:11 pm »
warning LNK4099: PDB 'sfml-main-d.pdb' was not found with 'sfml-main-d.lib(SFML_Main.cpp.obj)'
BTW: This is clearly no error. Instead, it's a warning for your debug build that the debug symbols can't be found. Won't be there in release, though.

13
SFML projects / Re: Objex
« on: August 06, 2014, 10:57:57 pm »
Someone once said that -- as an computer graphics developer -- a milestone in your career is when you wrote your own OBJ loader  ;)


Just one comment: Why are you using that much std::vectors<>, filled with redundant data? Just use std::getline for reading a line from the file and directly parse it. If you want to cache the lines first, just parse them after you read all lines to memory. IMHO there is no point in using an additional stage of vectors before the real(!) parsing takes place.

14
General / Re: Help installing THOR and SFGUI.
« on: July 31, 2014, 12:22:38 pm »
The main problem is IMHO that beginners don't familiarize themselves properly with the tools they use. The forum is full of threads about linking problems and stuff like that.

With an exotic tool chain it's even more important to know your tools and the associated workflow.
(OSX is indeed an exotic tool chain, compared to the main competitors).

I don't want to sound disrespectful or condescending, but I think you need to take a closer look at your tools before using some third-party libraries!
I had the same (or similar) problems at the beginning of my programming career, but at those times, there where no forums or even google to solve my problems. Just me and the compiler's manual  ;)

Don't give up, but also don't be snappish if you don't succeed directly.

Good luck!

15
Graphics / Re: Help with input and sprites
« on: April 24, 2014, 09:22:59 am »
Why should it stay? You only call the draw() method inside the if block. That means that the sprite is only drawn when the key is pressed. You want something like a boolean that keeps track if the key has been pressed in the past:

bool drawSprite = false;
Cross.setPosition(0,0);
// ...
while(window.isOpen())
{
        // .. poll the events
        while (window.pollEvent(event))
        {
                if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Numpad7)
                {
                        drawSprite = true; // only draw it if the key has been pressed
                }
        }       // ... end polling events

        window.clear(sf::Color::Black);
        window.draw(Grid);

        if (drawSprite)
        {
                window.draw(Cross);
        }

        window.display();
}
 


EDIT: Nexus was faster ;)

Pages: [1] 2 3 ... 5