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

Pages: [1] 2 3 ... 5
1
General / Re: How to draw a simple sprite with OpenGL?
« on: February 16, 2015, 06:07:09 pm »
If you just want to quickly "see stuff", why don't you just use a sf::texture with a sf::sprite and draw that?
I'm guessing your reason is that you want to learn raw OpenGL, but in case it's not then there's no need to mess with it just to draw something.

 :-\ ....

I know how to do it with sprites in sfml. But right now, i just want to put a texture on, because im lost. And if i learn on how to put a texture on a triangle, then i get a better overview and understanding so i can continue my work and learn things easier.

I just need this one step.

2
General / Re: How to draw a simple sprite with OpenGL?
« on: February 16, 2015, 05:54:30 pm »
Thanks for pointing the link out exploiter.
But is there a chance that you/anyone could show me the code i need to put in? Because right now im totally lost because in the sfml tutorial, there stand i shall use the sf::texture::bind() which is not directly opengl stuff.

So right now, i just want to put a texture on my triangle to get started (just quickly getting my "hands dirty" of opengl with sfml and see stuff).

Sorry for bothering so much on the forums, but i just need this last simple step to get going.

3
General / Re: How to draw a simple sprite with OpenGL?
« on: February 16, 2015, 04:11:02 pm »
You have no UV co-ordinates for your vertices.

Ok :-)
So how can i apply my uv coordinates?
For example, i just want the whole texture put on my triangle

4
General / Re: How to draw a simple sprite with OpenGL?
« on: February 16, 2015, 02:10:43 pm »
Ahh, ok.

But right now, i just want to put a super simple texture on my triangle.
Do you know how to do it the old way then?

glClearColor(1,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBegin(GL_TRIANGLES);
sf::Texture::bind(&texture); //This doesn't seem to work  :-(
glVertex2d(-0.5f, -0.5f);
glVertex2d(0, 0.5f);
glVertex2d(0.5f, -0.5f);

glEnd();

window.display();

Do i need to call something else for the Texture::bind() to work? It doesn't seem to work atm.
I appreciate your help though!  :)

5
General / Re: How to draw a simple sprite with OpenGL?
« on: February 16, 2015, 02:39:44 am »
Oh, i have no idea it was legacy or modern. But the example link, is that the modern way to do it?

6
General / How to draw a simple sprite with OpenGL?
« on: February 14, 2015, 08:34:16 pm »
Hello, im new to OpenGL, and so far, i am able to draw a triangle with this simple code:

glClearColor(1,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBegin(GL_TRIANGLES);

glVertex2d(-0.5f, -0.5f);
glVertex2d(0, 0.5f);
glVertex2d(0.5f, -0.5f);

glEnd();

window.display();

But how do i put a texture on it? I have read the tutorial here at the bottom of the page
http://www.sfml-dev.org/tutorials/2.2/graphics-sprite.php

I have created a texture, loaded it, and then call
sf::Texture::bind(&texture);

But my triangle is still white.

7
DotNet / Re: How do i load a font correctly?
« on: December 10, 2013, 01:26:05 pm »
Yes, i have set it to "Copy always", but it still doesn't show up  :-\

8
DotNet / How do i load a font correctly?
« on: December 09, 2013, 11:55:07 pm »
Hi.

When i deploy my project in VS2012 Professional, the content in my game will get generated into .DEPLOY files, however, the ttf files for fonts will not get generated. So im getting an error when i try to install and play my game. (See the Attachments).

Right now in my code, i just write something like

                       
Font arial = new Font(@"Content\arial.ttf");
Text text = new Text("Hello", arial);
 

Also, in my project, i have deleted the Output path so it will look and load from the bottom of the project.
Everything works fine, its just when i deploy, it will give me an error about the missing ttf file.

I hope somebody knows how to solve it :-)

Thanks

9
General / Re: Is it okay to have two pollevent() on one event?
« on: February 02, 2013, 01:59:33 pm »
How can i pass polled events through functions and use them in other functions?
Write functions with a sf::Event parameter.

By the way, avoid global variables, especially with types from SFML. They will cause issues with initialization/destruction order sooner or later. Apart from that, maintenance will become much easier if you keep dependencies local. Even if it's just a test example here, I thought I'd mention it ;)

Ahh ok. But is it okay to make my renderwindow global? i mean... its gonna be ridiculous tedious to pass my renderwindow into almost every function and classes.

10
General / Re: Is it okay to have two pollevent() on one event?
« on: February 02, 2013, 02:34:10 am »
Not really, since you're calling world1 from within the other event handling. It might "work" but it's not advised. But you can easily just poll the events in one location and then pass the polled event to different functions, where you can further process it.

How can i pass polled events through functions and use them in other functions?

btw thanks for help :)

11
General / Is it okay to have two pollevent() on one event?
« on: February 02, 2013, 01:58:39 am »
ex:

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"test");
sf::Event ev;
void world1();

int main()
{
        while(mywindow.isOpen())
        {
                while(mywindow.pollEvent(ev))
                {
                        switch(ev.type)
                        {
                        case sf::Event::Closed:
                                mywindow.close();
                        case sf::Event::KeyPressed:
                                if(ev.key.code == sf::Keyboard::Space)
                                        world1();
                        }
                }
                mywindow.clear(sf::Color(0,200,0));
                mywindow.display();
        }
}

void world1()
{
        bool go = true;
        while(go)
        {
                while(mywindow.pollEvent(ev))
                {
                        switch(ev.type)
                        {
                        case sf::Event::KeyPressed:
                                if(ev.key.code == sf::Keyboard::Left)
                                        go = false;
                        }
                        mywindow.clear(sf::Color(200,0,0));
                        mywindow.display();
                }
        }
}
 

here, the ev variable is polled by two different pollevents, deppending on where the loop is executing, is that okay?

12
http://sfgui.sfml-dev.de/guide/getting_ … rom_source

I barely understand 1 single line

What is building from source?
What is binary releases?
I have also tried to look at what Cmake is... is it a building tool or wtf?... :S

Its my first time trying out a GUI, so i have no experience with it what so ever...

Man... i wish somebody was next to me and could show me how to get this done in 3 mins, instead of i have to look around 5 hours and trying to figure it out myself... and fail anyway.

Need some damit help >_< i really want to get started with this gui... it looks so awesome.
Thanks in advance!!

(Btw, i also posted this on the sfgui forums.)

13
General / Re: What GUI should i use for SFML?
« on: December 12, 2012, 12:15:49 pm »
ahh ok, thanks man  ;D

14
General / What GUI should i use for SFML?
« on: December 12, 2012, 02:01:49 am »
Hey man  :D

And what GUI's do you recommend me to use that is compatible with the SFML renderwindow?

I want a GUI that has some documentation and tutorials on how to set up the thing and easy to use, because its first time im trying out a GUI in c++. So i have absolute no experience with GUIs.

Thanks in advance  :)

15
Graphics / Re: how do i draw lines/polygons?
« on: December 11, 2012, 12:13:31 am »
Thanks alot man.
Just what i needed :)

Pages: [1] 2 3 ... 5
anything