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

Pages: [1]
1
Graphics / Render to texture
« on: February 06, 2015, 06:49:21 pm »
Hello, i would like to render normals into texture. This texture then use in another render cycle and then show result on screen. But i don't know how to handle it with mix of sfml and opengl.

Prep:
To do this, i will need: sf::RenderWindow to display result, sf::RenderTexture to save normal texture and two sf::shaders (normalShader and renderShader).

First: How should the code look like? I couldn't find any source on this :-/
normalTexture.activate(true);
normalShader.bind();

glBindVertexArray(vertexArrayID);
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, 0); // this line will throw exception*
glBindVertexArray(0);

normalTexture.display();
normalTexture.activate(false);

Second: If i would like to render into multiple textures at once, is it possible? Theres no place to select it.

*because this renderTarget was not active when i created VAOs and BOs. So do I have to create these things twice?

As long as everything happens in the same OpenGL context, you shouldn't have to call glFlush. sf::RenderTarget calls it because the target has its own separate context...
Well that explains why i cant use VAOs there.

2
Graphics / Re: [solved] Error 1282 when glBindVertexArray
« on: January 14, 2015, 12:12:10 am »
Thanks very much for the explanation. Although i understand that this is documented and i should just rtfm, theres no way i would ever find it. I would never look into documentation for functions with names like this.

3
Graphics / Re: Error 1282 when glBindVertexArray
« on: January 13, 2015, 11:41:53 pm »
Great call, it became inactive after loadFromImage call. I have class that handles shader, which is called after creating window. LoadFromImage makes window inactive and forcing it active after loading image seems like bad idea. It was deactivated surely for some reason. Can i actually use sf::Shader and handle OpenGL calls myself?

(click to show/hide)

4
Graphics / [solved] Error 1282 when glBindVertexArray
« on: January 13, 2015, 10:28:17 pm »
Hello, what is RenderWindow::display() doing to my VAO?

glBindVertexArray(vao);
glGetError(); // OK

glDrawArrays(GL_TRIANGLES, 0, ms->g_vertex_buffer_data.size() / 3);
glBindVertexArray(0);
glGetError(); // OK

window.display(); // WITHOUT THIS CALL, IT'LL BE OK
glGetError(); // OK

// NEXT LOOP

glBindVertexArray(vao);
glGetError(); // ERROR 1282
 

(here is exactly same problem, http://www.gamedev.net/topic/645689-invalid-operation-error-on-glbindvertexarray/)

Pages: [1]
anything