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

Author Topic: SFML RenderTextures and OpenGL  (Read 3254 times)

0 Members and 1 Guest are viewing this topic.

Joseph

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
SFML RenderTextures and OpenGL
« on: February 25, 2014, 05:35:12 pm »
Hello!

So I've had an idea for a game that I want to develop when I go back to university later this year and I'd like to use the SFML .net library (Because I've been using it quite a bit lately and already have plenty of nice code I can continue using).

But I'm not sure whether it is possible at the moment, so here it is: I want to make a 2d platformer, only the 2d scenes are actually on the 6 different sides of a 3D cube that can be rotated with the mouse.

So, using SFML .net and OpenGL am I able to create a 3D cube in OpenGL and then texture each face of the cube using a RenderTexture from SFML?

If that didn't make sense then I can draw you some terrible diagrams which will be equally confusing :D

Thanks!

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML RenderTextures and OpenGL
« Reply #1 on: February 25, 2014, 05:40:42 pm »
Yes, you can. When drawing the cube's vertices, bind the texture from the SFML render texture (with the RenderTexture.GetTexture() and Texture.Bind() methods, assuming they're named analogously to their C++ equivalents).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Joseph

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: SFML RenderTextures and OpenGL
« Reply #2 on: February 25, 2014, 05:55:44 pm »
Brilliant :D

It's going to be a while until I actually implement this so I might end up being a bit cheeky and asking for help somewhere down the line.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: SFML RenderTextures and OpenGL
« Reply #3 on: February 25, 2014, 07:51:56 pm »
Yes, you can. When drawing the cube's vertices, bind the texture from the SFML render texture (with the RenderTexture.GetTexture() and Texture.Bind() methods, assuming they're named analogously to their C++ equivalents).

Actually it is a property so RenderTexture.Texture is what you are after. And yes the Texture.Bind() is correct.  ;)
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything