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

Pages: [1]
1
Graphics / Re: Too big textures...
« on: August 06, 2013, 10:50:42 pm »
If I were you I`d implement a streaming system on a separate thread, and implement the offscreen big texture essentially like a queue, so what`s needed would replace the one that`s not, if this is possible in your context then it would be a nice addition in terms of memory, and perhaps speed. :)

2
Graphics / Re: Too big textures...
« on: August 06, 2013, 08:28:08 pm »
What about chopping that big texture that`s becoming a problem into smaller ones, like 1024*1024 or whatever works for you? And have some sort of container besides those containing what is where, then referencing that through it? Just my 2 cents tho.

3
Graphics / Re: SFML Text rendering in a deferred context
« on: August 06, 2013, 08:25:01 pm »
I guess I`m the classic RTFM case. :) Thanks for the clarification!

4
Graphics / Re: Using pure openGL is super slow?
« on: August 06, 2013, 06:40:30 pm »
Those coordinates are simple cartesian coordinates ranging from -1 to 1, and such are the quarters distributed (so ++ is the first quarter, +- is the second, -- is the third and -+ is the fourth). You are filling the first quarter here with your quad, that`s why the entire top right quarter of the screen is filled.

Of course once you set up a MVP matrix enviroment this changes, and your camera code handles these transformations from world space to view space.

5
Graphics / Re: SFML Text rendering in a deferred context
« on: August 06, 2013, 06:31:53 pm »
A few, for my FBOs, although I thought that pushing/popping states or reseting them would mean that they aren`t interfering with this, and I`d like to keep them active. :) Although every other rendering (sprites, shapes, etc.) works, so I guess I`ll just integrate libRocket now. Thanks for the help. :)

6
Graphics / Re: SFML Text rendering in a deferred context
« on: August 06, 2013, 06:18:38 pm »
Thanks for the quick reply! Unfortunately that doesn`t solve my problem, or I`m doing something wrong. :( It`s funny though how I can render stuff like shapes without any problem.

7
Graphics / SFML Text rendering in a deferred context
« on: August 06, 2013, 05:43:54 pm »
I have managed to implement a very simple deferred renderer by going through the interwebs, but it seems to kill my text rendering, which worked well in a forward rendering context. I don`t know what could be causing it, if anyone could give me any insight on this, I would really appreciate it. :) I`m pretty sure it has to do with one or more GL state, but I can`t seem to figure out which one.

It goes something like this . . .

And here`s how I try to draw my string :

glBindBuffer(GL_ARRAY_BUFFER, 0);
                glUseProgram(0);
                (*window).pushGLStates();
                (*window).resetGLStates();
                (*FPSText).setString("FPS : " + int2Str((int)FPS));
                (*window).draw(*FPSText);
                (*window).popGLStates();

Any ideas?

8
Graphics / Re: GLSL Texture mapping problems
« on: August 06, 2013, 05:38:06 pm »
Nope, I wrote myself a class to handle shaders manually, I really feel like SFML`s shader class was intended for pure SFML applications (quite obvious and rational choice). I still use SFML for other purposes though. :)

9
High quality work, voted. Good luck with the development and the marketing. :D

10
Graphics / GLSL Texture mapping problems
« on: August 02, 2013, 11:49:20 am »
Hello there! I`m trying to implement texture mapping on a 3D object in OpenGL based on the tutorials at http://ogldev.atspace.co.uk/. I got stuck at the texture mapping part, I`m sure I missed core concepts since I`m a beginner with OpenGL/GLSL, but I can`t seem to find where, I was hoping you could help me out a bit. :) I`m getting a GL_INVALID_OPERATION error when I try to run my code, I can`t seem to manage to put the texture in the right place. Here is my revelant code :

[EDIT] I still don`t know what the problem was, but after writing my own shader reader/compiler everything works just fine. :)

int _tmain(int argc, char** argv)
{
/// ...
window.setActive();

        glewInit();

    glViewport(0, 0, window.getSize().x, window.getSize().y);
        glClearColor(0.4f, 0.6f, 0.9f, 0.0f); // cornflower blue :)
        glFrontFace(GL_CW);
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);
       
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glClearDepth(1.f);

        CreateVertexBuffer();
        CreateIndexBuffer();
        sf::Shader shader;
        shader.loadFromMemory(pVS, pFS);

        sf::Texture test2;
        test2.loadFromFile("test.png");
        shader.setParameter("gSampler", test2);

// ... in the game loop
Render(shader, test2);

                glBindBuffer(GL_ARRAY_BUFFER, 0);
                window.pushGLStates();
                FPSText.setString("FPS : " + int2Str((int)FPS));
                window.draw(FPSText);
                window.popGLStates();

                window.display();
}
 

Here is the render function

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        sf::Shader::bind(&shader);

        static float Scale = 0.0f;

    Scale += 0.1f;

        glm::mat4 ProjectionMatrix = getProjectionMatrix();
        glm::mat4 ViewMatrix = getViewMatrix();
        glm::mat4 ModelMatrix = glm::mat4(1.0);
        glm::mat4 MVP = ProjectionMatrix * ViewMatrix * ModelMatrix;

        glUniformMatrix4fv(gWVPLocation, 1, GL_TRUE, glm::value_ptr(MVP));

        glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)12);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);

        sf::Texture::bind(&test);
    glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);

    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);

        sf::Texture::bind(NULL);
        sf::Shader::bind(NULL);
 

And finally the shaders (Which are identical with the ones the tutorial provides but meh)
static const char* pVS = "                                                          \n\
#version 330                                                                        \n\
                                                                                    \n\
layout (location = 0) in vec3 Position;                                             \n\
layout (location = 1) in vec2 TexCoord;                                                                                         \n\
                                                                                    \n\
uniform mat4 gWVP;                                                                  \n\
                                                                                    \n\
out vec2 TexCoord0;                                                                 \n\
                                                                                    \n\
void main()                                                                         \n\
{                                                                                   \n\
    gl_Position = gWVP * vec4(Position, 1.0);                                       \n\
    TexCoord0 = TexCoord;                                                                                                                       \n\
}"
;

static const char* pFS = "                                                          \n\
#version 330                                                                        \n\
                                                                                    \n\
in vec2 TexCoord0;                                                                                                                                      \n\
out vec4 FragColor;                                                                 \n\
uniform sampler2D gSampler;                                                                 \n\
                                                                                    \n\
void main()                                                                         \n\
{                                                                                   \n\
        FragColor = texture2D(gSampler, TexCoord0.st);                                          \n\
}"
;
 

I can`t seem to see my error, could you help me out? :)

Pages: [1]
anything