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

Pages: [1] 2 3 ... 6
1
DotNet / Re: OpenGL Bind() deprecated?
« on: May 10, 2013, 03:38:02 am »
Thanks for the help, FRex. It works great now.

Here's how the code ended up looking:
Texture.Bind(myTexture);

2
DotNet / OpenGL Bind() deprecated?
« on: May 10, 2013, 01:59:45 am »
I'm trying out dotnet SFML2, and am running into an OpenGL issue. Do Textures no longer have a "bind()" call? I'm attempting to call "myTexture.bind();", but "bind()" seems to no longer exist.

Is this a change in the API, or is the dotnet binding perhaps missing this call?

3
Graphics / Re: Rendering .ttf text on OpenGL polygon
« on: November 25, 2012, 09:02:12 pm »
I wrote a minimal example of getting the glyph data - perhaps I'm accessing it incorrectly. Here's the output, that displays TextureRect and Bounds values: http://blendogames.com/dev/glyph2.png

Here's the sample program's code (C#):
using System;

using SFML;
using SFML.Window;
using SFML.Graphics;

using Tao.OpenGl;

namespace WindowTest
{
    public class Game1
    {
        static void Main()
        {
            const uint FONTSIZE = 48;
            RenderWindow appWindow;
            Font myFont;
            Texture myTexture;
            Glyph myGlyph;

            appWindow = new RenderWindow(new VideoMode(640, 480, 32), "Window test");
            myFont = new Font(@"arial.ttf");

            //set up the glyphs.
            for (uint i = 65; i < 68; i++)
            {
                //65 = A, 66 = B, 67 = C, etc.

                myGlyph = myFont.GetGlyph(i, FONTSIZE, false);
                Console.WriteLine("Letter unicode: {0}   TextureRect left: {1} top: {2} width: {3} height: {4}   Bounds left: {5} top: {6} width: {7} height: {8}",
                    i, myGlyph.TextureRect.Left, myGlyph.TextureRect.Top, myGlyph.TextureRect.Width, myGlyph.TextureRect.Height,
                    myGlyph.Bounds.Left, myGlyph.Bounds.Top, myGlyph.Bounds.Width, myGlyph.Bounds.Height);
            }            

            //bind the font texture.
            myTexture = myFont.GetTexture(FONTSIZE);
            myTexture.Bind();            

            //setup opengl.
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F);
           
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glColor4f(1.0F, 1.0F, 1.0F, 1F);
            Gl.glEnable(Gl.GL_BLEND);
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);

            //render the opengl cube.
            while (appWindow.IsOpen())
            {
                appWindow.DispatchEvents();

                appWindow.Clear(new Color(255,128,128));                
                Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);
                Gl.glMatrixMode(Gl.GL_MODELVIEW);
                Gl.glLoadIdentity();
                Gl.glTranslatef(0.0F, 0.0F, -120.0F);


                //draw a background border square.
                Gl.glDisable(Gl.GL_BLEND);
                Gl.glColor4f(1.0F, 0.6F, 1.0F, 1F);
                Gl.glBegin(Gl.GL_QUADS);
                Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, -50.0F, 49.0F);
                Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, 50.0F, 49.0F);
                Gl.glTexCoord2f(1, 0); Gl.glVertex3f(50.0F, 50.0F, 49.0F);
                Gl.glTexCoord2f(1, 1); Gl.glVertex3f(50.0F, -50.0F, 49.0F);
                Gl.glEnd();
                Gl.glEnable(Gl.GL_BLEND);

                // Draw the letters square
                Gl.glColor4f(1.0F, 1F, 1.0F, 1F);
                Gl.glBegin(Gl.GL_QUADS);
                Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, -50.0F, 50.0F);
                Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, 50.0F, 50.0F);
                Gl.glTexCoord2f(1, 0); Gl.glVertex3f(50.0F, 50.0F, 50.0F);
                Gl.glTexCoord2f(1, 1); Gl.glVertex3f(50.0F, -50.0F, 50.0F);
                Gl.glEnd();
               
                appWindow.Display();
            }
        }
    }
}

4
Graphics / Re: Rendering .ttf text on OpenGL polygon
« on: November 25, 2012, 08:18:48 am »
I managed to generate a glyph texture sheet, and now have them being rendered on my polygons.

However, I'm now having a problem getting the correct UV coordinates. I assumed the glyph's TextureRect would give me 0-1 UV coordinates on the texture sheet, but I'm ending up with values such as these:

Left 0
Top 2.802597E-45
Width 1.821688E-44
Height 6.726233E-44

I'm not sure how to read that - any suggestions?

5
Graphics / Rendering .ttf text on OpenGL polygon
« on: November 24, 2012, 08:30:25 pm »
I have an OpenGL GL_Quad, and I'd like to render some truetype text onto it. I'm not sure what is the best way to do this, and was hoping to get some tips.

If I understand correctly, I can create a Font object, then export that out to a glyph texture sheet for OpenGL to use?  I was also looking at the Text object and RenderTexture, but wasn't sure if that was a viable route. Are there other alternatives I'm missing?

6
SFML projects / Project Black Sun - commercial game - demo available
« on: October 20, 2011, 02:18:04 am »
That looks beautiful. Those detailed animations reminds me a lot of Metal Slug.

I'd love to hear how your mobile porting work goes. I've been meaning to port my work to mobile devices and I'd love to hear how other SFML devs do it.

7
Window / Joystick enumeration
« on: September 26, 2011, 07:39:11 pm »
I was doing some tests with SFML2 and noticed my Xbox controller always appears as joystick #0. My Logitech controller always appears as joystick #2.

This is not a problem, I was just curious: how does joystick enumeration work? That is, what determines what joystick becomes joystick #0 and joystick #1?

8
Window / SFML2 - desktop mouse vs. renderwindow mouse [SOLVED]
« on: September 25, 2011, 09:20:04 pm »
Thanks all, that solved the problem. I was grabbing the mouse relative to the desktop and not relative to the renderwindow.

My mouse code was:
Code: [Select]
this.mousePosX = SFML.Window.Mouse.GetPosition().X;
this.mousePosY = SFML.Window.Mouse.GetPosition().Y;


And the correct way to do it is:
Code: [Select]
this.mousePosX = SFML.Window.Mouse.GetPosition(myRenderWindow).X;
this.mousePosY = SFML.Window.Mouse.GetPosition(myRenderWindow).Y;

9
Window / SFML2 - desktop mouse vs. renderwindow mouse [SOLVED]
« on: September 25, 2011, 08:37:04 pm »
I'm currently updating my project to the latest SFML2. In the new input system, I noticed my desktop mouse and renderwindow mouse are located at two different locations:



Moving one cursor also moves the other. Cosmetically, I don't mind. But functionally, I have a problem in that left-clicking will de-focus the renderwindow and select the underlying desktop.

Has anyone experienced a similar problem, or does my input code need some massaging?

10
DotNet / Problem displaying Chinese/Japanese/Korean characters
« on: September 25, 2011, 05:25:03 pm »
@philongxp - you're right - thanks! I was using SFML2 from June 2011. I downloaded the dlls from your link and now my test works fine.

Slight hijack - just so I stay up to date with the builds, are there precompiled SFML2 + .Net libraries in the GIT repository, or do we currently build them ourselves via Cmake?

11
DotNet / Problem displaying Chinese/Japanese/Korean characters
« on: September 25, 2011, 03:28:55 am »
Thanks, Laurent-

I got the same font from a different place. Interestingly, the one I have is 1.2 mb, and the one you linked is 67 kb. I replaced my font with yours, but the same issue is appearing.

I'm guessing the problem is something with my code or my compiler.  Can you possibly post the source code for your quick test? I'm guessing it's not very different from mine, but I'd like to verify my code isn't doing anything differently.

12
DotNet / Problem displaying Chinese/Japanese/Korean characters
« on: September 23, 2011, 09:08:03 am »
To the best of my knowledge, my source file is unicode. I'm using Visual Studio 2008.

I ran some tests with the direct unicode values.
  • Standard characters (a-z, 1-0) work fine, i.e. /u0057 "W" is correctly displayed as "W"
  • Some symbols work fine, i.e. /u00AE "®" works fine.
  • Non-standard characters act strange, i.e. /u0165 "ť" is displayed as "t" (no accent).
  • Exotic characters become question marks, i.e. /u01B1 "Ʊ" and /u4EEE "仮" both are displayed as "?"

13
DotNet / Problem displaying Chinese/Japanese/Korean characters
« on: September 22, 2011, 11:25:55 pm »
I'm trying to display Japanese characters with .Net SFML2.  But instead of printing the characters, I'm just getting question marks ("????"). The font contains the necessary characters, and entering English characters works fine.

Anyone have any experience with displaying Japanese characters, or have any tips? The code seems fairly straight-forward.

Code: [Select]
//initialization
Font font = new Font(@"mplus-1p-medium.ttf");

string japanese = "練習モド";
Text text = new Text(japanese, font, 64);
text.Position = new Vector2(80, 200);
text.Color = Color.Black;

...

//rendering
renderWindow.Draw(text);
renderWindow.Display();

14
SFML projects / Galaxy
« on: September 10, 2011, 11:10:28 pm »
Good stuff!

I love how the little fighter ships buzz around you. Do they move around randomly, or is there some sort of behind-the-scenes spline system?

Also, I was curious about how you did the booster-trails behind the ships. Is that done via raw OpenGL calls?  It looks great.

15
DotNet / Use OpenTK instead of Tao in examples.
« on: September 10, 2011, 10:23:32 pm »
@zombiekiller222 -

I'm not familiar with OpenTK - can you tell me a bit over what it offers over Tao? Tao is pretty low level - does OpenTK give some higher-level calls to OpenGL?

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