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

Pages: [1]
1
Graphics / Re: SFML with openGL: SFML does not render (but openGL does)
« on: February 11, 2016, 07:56:39 pm »
Seems like its only laborious.
(At least within a small test)

2
Graphics / Re: SFML with openGL: SFML does not render (but openGL does)
« on: February 09, 2016, 05:55:55 pm »
ok thanks :)
Would you please add this to the tutorial?
http://www.sfml-dev.org/tutorials/2.3/window-opengl.php
This could be helpful; thank you!

I want to use SFML for the 2D user interface.
Whis way is faster?
Rendering SFML into a RenderTexture, getting its texture and binding it to openGL and rendering two trianglas forming a plane over the window with them,
oder switching the contexts using window.push/pop glStates?

3
Graphics / Re: SFML with openGL: SFML does not render (but openGL does)
« on: February 08, 2016, 07:02:54 pm »
Does
window.pushGLStates();
window.draw(rect);
window.popGLStates();
 
maybe not do enough?


Adding
glBindVertexArray(GL_NONE);
glBindBuffer(GL_ARRAY_BUFFER, GL_NONE);
 
makes it work:

// end of main loop

glBindVertexArray(GL_NONE);
glBindBuffer(GL_ARRAY_BUFFER, GL_NONE);

window.pushGLStates();
window.draw(rect);
window.popGLStates();
 

4
Graphics / Re: SFML with openGL: SFML does not render (but openGL does)
« on: February 08, 2016, 04:27:24 pm »
I do not get any errors.
My video card: ATI Mobility Radeon HD 5850

glGetError() returns 0.
It just looks like
                window.pushGLStates();
                window.draw(rect);
                window.popGLStates();
 
is beeing ignored.


On Intel(R) HD Graphics:
window.draw(rect);
throws exception at 0x101290D7 (ig4icd32.dll)
access violation reading at position 0x066AEC70

5
Graphics / SFML with openGL: SFML does not render (but openGL does)
« on: February 07, 2016, 11:42:48 am »
Hi

I am trying to get through these openGL-Tutorials combining them with openGL: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

The program draws a triangle on the screen, but the SFML rectangle does not draw. Why?
Is there a problem using glew?

Thanks in advance



Edit:
Rendering on a sf::RenderTexture and binding it to an openGL-Object and then rendering the object with the texture with openGL seems to work. Is this a possible workaround or stupid?


Everything before the main loop:
(click to show/hide)



main loop:
        while(window.isOpen())
        {
                Event event;
                while(window.pollEvent(event))
                {
                        if(event.type == Event::Closed)
                                window.close();
                        if((event.type == Event::KeyPressed) && (event.key.code == Keyboard::Escape))
                                window.close();
                        if(event.type == Event::Resized)
                                glViewport(0, 0, event.size.width, event.size.height);
                }

                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

                // Use our shader
                glUseProgram(programID);

                // Send our transformation to the currently bound shader, in the "MVP" uniform
                // This is done in the main loop since each model will have a different MVP matrix (At least for the M part)
                glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &mvp[0][0]);

                // 1rst attribute buffer : vertices
                glEnableVertexAttribArray(0);
                glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
                glVertexAttribPointer(
                        0,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
                        3,                  // size
                        GL_FLOAT,           // type
                        GL_FALSE,           // normalized?
                        0,                  // stride
                        (void*)0            // array buffer offset
                        );
                // Draw the triangle !
                glDrawArrays(GL_TRIANGLES, 0, 3); // Starting from vertex 0; 3 vertices total -> 1 triangle
                glDisableVertexAttribArray(0);



                window.pushGLStates();
                window.draw(rect);
                window.popGLStates();

                window.display();
        }

 


Simple shaders:
(click to show/hide)


Pages: [1]
anything