Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: 3d  (Read 6996 times)

0 Members and 1 Guest are viewing this topic.

Golddiggerth

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
3d
« on: December 22, 2012, 12:09:17 am »
3d would be nice other ways you need more libarys opengl and dan maybe on a simpeler method.

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: 3d
« Reply #1 on: December 22, 2012, 12:16:27 am »
3d would be nice other ways you need more libarys opengl and dan maybe on a simpeler method.

I believe this fine fellow meant:

"I do say, I believe that 3D would be a great idea for SFML. It allow the user to make it easier for themself, lowering the requirement of other dependencies like OpenGL, and also, maybe allow for a simpler method of use than said dependencies."

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: 3d
« Reply #2 on: December 22, 2012, 12:18:47 am »
 ;D

Please search before post, the topic 3D has been discussed numerous times and the answer will never change... ::)
SFML only provides 2D functionality period.

Also OpenGL is always needed with SFML but you don't have to explicitly link it, except if you were going to do some custom drawing.
If you want 3D you can use some other simple libraries like Irrlicht or do everything on your own with SFML as window 'creator' and OpenGL. (Same answer as in the other thread of yours)

Also it seems you've no idea what exactly lies behind 3D programming and just want to use it because it looks cool etc. Game programming is quite complex even in 2D but with 3D you need to take care of a lot and it's not just adding a few more lines of code....
« Last Edit: December 22, 2012, 12:22:57 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
Re: 3d
« Reply #3 on: January 19, 2013, 09:02:33 pm »
3D is easy with OpenGL && SFML;
SFML integrates OpenGL to the heart's content  ;D

Game programming is quite complex even in 2D but with 3D you need to take care of a lot and it's not just adding a few more lines of code....

Heres your few more lines of code  ???
C++ rendering with OpenGL:
void RenderWindow::BufferObject(DisplayedBeing3D *mesh){
        if (mesh->_Culling){
                glEnable (GL_CULL_FACE);
                glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 0);//cull lighting
        }else{
                glDisable (GL_CULL_FACE);
                glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1);
        }
       
        if (!mesh->_Anchored){
                ApplyGravity(mesh,_TimeBetweenFrames);
                ApplyVelocity(mesh,_TimeBetweenFrames,0,_LengthOfMeter);
        }
        glBindTexture(GL_TEXTURE_2D, *mesh->GetTexture());
        glColor4f(1.f, 1.f, 1.f, 0.f);
        if (mesh->_SmoothShading){
                for (unsigned int i=0;i<mesh->GetFaces()->size();++i){
                        if (mesh->GetFace(i)->GetSize() == 3){
                                glBegin(GL_TRIANGLES);
                                        for (unsigned int j=0; j<3; ++j){
                                                glNormal3f( mesh->GetVertNormal(mesh->GetFace(i)->GetVert(j)).x, mesh->GetVertNormal(mesh->GetFace(i)->GetVert(j)).y, mesh->GetVertNormal(mesh->GetFace(i)->GetVert(j)).z );
                                                glTexCoord2f( mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).x, mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).y);
                                                glVertex3f( mesh->GetVert(mesh->GetFace(i)->GetVert(j)).x, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).y, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).z);
                                        }
                                glEnd();
                        }else{
                                glBegin(GL_QUADS);
                                        for (unsigned int j=0; j<4; ++j){
                                                glNormal3f( mesh->GetVertNormal(mesh->GetFace(i)->GetVert(j)).x, mesh->GetVertNormal(mesh->GetFace(i)->GetVert(j)).y, mesh->GetVertNormal(mesh->GetFace(i)->GetVert(j)).z );
                                                glTexCoord2f( mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).x, mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).y);
                                                glVertex3f( mesh->GetVert(mesh->GetFace(i)->GetVert(j)).x, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).y, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).z);
                                        }
                                glEnd();
                        }
                }
        }else{
                for (unsigned int i=0;i<mesh->GetFaces()->size();++i){
                        sf::Vector3<float> normal = mesh->GetFace(i)->GetNormal();
                        glNormal3f(normal.x,normal.y,normal.z);
                        if (mesh->GetFace(i)->GetSize() == 3){
                                glBegin(GL_TRIANGLES);
                                        for (unsigned int j=0; j<3; ++j){
                                                glTexCoord2f( mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).x, mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).y);
                                                glVertex3f( mesh->GetVert(mesh->GetFace(i)->GetVert(j)).x, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).y, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).z);
                                        }
                                glEnd();
                        }else{
                                glBegin(GL_QUADS);
                                        for (unsigned int j=0; j<4; ++j){
                                                glTexCoord2f( mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).x, mesh->GetTexVert(mesh->GetFace(i)->GetTexVert(j)).y);
                                                glVertex3f( mesh->GetVert(mesh->GetFace(i)->GetVert(j)).x, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).y, mesh->GetVert(mesh->GetFace(i)->GetVert(j)).z);
                                        }
                                glEnd();
                        }
                }
        }
        std::vector<DisplayedBeing3D*> c = mesh->GetChildren();
        for (unsigned int i=1; i < c.size();i++){
                BufferObject(c[i]);
        }
}
 
Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: 3d
« Reply #4 on: January 21, 2013, 02:08:37 pm »
glBegin? No thanks. :P

HKei

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: 3d
« Reply #5 on: February 02, 2013, 05:53:50 pm »
glBegin? No thanks. :P

Also, glLightModel, glColor, glNormal and other unpleasant things from the dark ages.

 

anything