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

Pages: [1]
1
Graphics / Get texture from sf::Text object
« on: July 06, 2017, 03:49:48 pm »
I need to get a texture from a sf::Text object then mix it with another texture in a GLSL Shader. How can i do that?

2
Window / Multiple windows ,but only one receives input
« on: May 07, 2017, 03:20:40 pm »
I want to create 2 windows w1 and w2 and while w2 is open i want the program to NOT let me move or give any events to w1. Is is possible?

3
Graphics / Re: SFML with OpenGL
« on: December 08, 2016, 03:46:02 am »
You are right. I made a mistake there. What i want is to use modern opengl functions(vertex buffers) to draw the scene faster. But i want my project to use sfml for other tasks. And i dont think using a single big texture is a good idea since the maximum texture size on a graphics card is 1024x1024, 2048x2048 or something close to that.

4
Graphics / SFML with OpenGL
« on: December 07, 2016, 06:36:44 pm »
I want to create an app with a GUI in modern opengl. I want to use vertexarrays to render the sfml sprites so the program can run faster. So ill need to use a lot of small textures for drawing my GUI elements(buttons,textboxes etc.). The thing is that my GUI is being updated during runtime so i dont know exactly how many textures i have. I know in modern opengl you have a lot of ways to send textures to the shader. Which one would be the best for my problem? In the begining i wanted to use texture units but on my pc i only have 32 texture units which is not much. How do i do to have hundreds of thousands of little textures?I think have to choose between there options which i found on wikipedia but i dont even know what all of them are.
sampler2D​   GL_TEXTURE_2D
sampler3D​   GL_TEXTURE_3D   
samplerCube​   GL_TEXTURE_CUBE_MAP   
sampler2DRect​   GL_TEXTURE_RECTANGLE   
sampler1DArray​   GL_TEXTURE_1D_ARRAY
sampler2DArray​   GL_TEXTURE_2D_ARRAY
samplerCubeArray​   GL_TEXTURE_CUBE_MAP_ARRAY
samplerBuffer​   GL_TEXTURE_BUFFER   Buffer Texture
sampler2DMS​   GL_TEXTURE_2D_MULTISAMPLE
sampler2DMSArray GL_TEXTURE_2D_MULTISAMPLE_ARRAY

5
Graphics / Using sf::VertexArray to draw quads with multiple textures
« on: November 29, 2016, 12:35:45 pm »
In modern opengl, in order to draw quads fast you create a vertexbuffer and you tell the gpu how your data is organised in those bites. The code looks something like this :
void setupMesh()
{
    glGenVertexArrays(1, &this->VAO);
    glGenBuffers(1, &this->VBO);
    glGenBuffers(1, &this->EBO);
 
    glBindVertexArray(this->VAO);
    glBindBuffer(GL_ARRAY_BUFFER, this->VBO);

    glBufferData(GL_ARRAY_BUFFER, this->vertices.size() * sizeof(Vertex),
                 &this->vertices[0], GL_STATIC_DRAW); 

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, this->indices.size() * sizeof(GLuint),
                 &this->indices[0], GL_STATIC_DRAW);

    // Vertex Positions
    glEnableVertexAttribArray(0);   
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex),
                         (GLvoid*)0);
    // Vertex Normals
    glEnableVertexAttribArray(1);   
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex),
                         (GLvoid*)offsetof(Vertex, Normal));
    // Vertex Texture Coords
    glEnableVertexAttribArray(2);   
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex),
                         (GLvoid*)offsetof(Vertex, TexCoords));

    glBindVertexArray(0);


You also use texture units to tell the gpu where are your textures.
glBindTexture(GL_TEXTURE_2D, this->textures.id);

In sfml you can use sf::VertexArray to draw multiple sprites at once. But how do you tell sfml do draw those quads with diferent textures?

6
Graphics / Re: Declaring array of sprites with identical texture.
« on: November 29, 2016, 09:03:27 am »
When you call sprites = new sf::Sprite(*bulletTexture); you dont take the data from the texture and copy it into the sprite, you only create a link between the two. So if you lose the data in the texture,you cant draw the sprite. Because your pointers are local you lose them when you exit the function.make them global

7
Graphics / Re: Render text using vertexarrays.
« on: November 28, 2016, 12:23:18 pm »
Thank you for your answer.

8
Graphics / Render text using vertexarrays.
« on: November 28, 2016, 01:57:55 am »
Is there a way to create a sf::Text variable, set up its properties(font,color,fontsize) and the save this as a texture , so later i can use sf::VertexArrays to draw a sprite that has that texture?

9
General discussions / Re: Creating a interface maker using sfml
« on: November 26, 2016, 06:36:16 pm »
Yes. I want to use view for clipping. And i need to use it for buttons. Look for exemple at this webpage. It has a "HOME" button. If i scroll down the button might not appear on the screen anymore.

10
General discussions / Re: Creating a interface maker using sfml
« on: November 26, 2016, 05:56:47 pm »
It can but if do that ill just waste gpu power to draw the interface instead of using it for the actual rendering of models (i plan to work on a game engine in the future)

11
General discussions / Re: Creating a interface maker using sfml
« on: November 26, 2016, 05:10:53 pm »
Thank you for your answer but i doesnt really help me because my program creates interfaces. Think of a complex program like photoshop. For every button in photoshop i plan to create a sfml view in which a draw a sprite. So in order to draw a interface i'd have to make a draw call for every button which is awfull. The solution would be to not use sfml views. Instead i should do precalculations before the draw call in which i decide if a sprite should apear in the draw call or not(or to be drawn partially) then call the draw function. This should take me a while to figure it out. Too bad. I hoped i would a simple task.

12
General discussions / Re: Creating a interface maker using sfml
« on: November 26, 2016, 04:53:48 pm »
Oh, sorry, i understand your confusion now. I should had wrote the question better. What i want from my program is to create one vertexarray that contains 2 sprites but each sprite to be drawn in a different view. So can you show me a small exemple that does that?

13
General discussions / Re: Creating a interface maker using sfml
« on: November 26, 2016, 02:16:55 pm »
Because i dont know how you can do that. Could you please show me a small example that draws 2 sprites in 2 views using vertexarrays?

14
General discussions / Creating a interface maker using sfml
« on: November 26, 2016, 05:59:35 am »
Hi. Im currently working on a program that uses sfml to create interfaces for my future projects,kinda like how visual studio lets you create interfaces. Lets say for exemple that my program supports buttons and the ability to split the screen into regions. In order to split the screen i read that i should use sfml views and in order to draw faster i should put all of my sprites into a vertexrray. My question is: Is it possible to combine those 2? (to draw a lot of sprites using vertexarray but to draw them in different views?

Pages: [1]