Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

155 Neutral

About gatofedorento

  • Rank
  1. gatofedorento

    Render text in openGL

    That's what i intend to do, by doing that the only performance hit my application will take is creating the textures, though that ain't a real problem because they will usually only be created on an init function thanks for help, I will try that tomorrow.
  2. gatofedorento

    Render text in openGL

    tried it and doesn't seem to change the font size, and if i don't even call "FaceSize" it doesn't even renders any text. Thanks for help, maybe i need to dig a bit more the library, though, the tutorial isn't the best...
  3. gatofedorento

    Render text in openGL

    With a string of somewhat 150 characters the framerate goes around 14 fps. Its the library that draws it.
  4. gatofedorento

    Render text in openGL

    I will let you with two captions from my application, in the first one I have a window where I draw a button, one of my windows and a scroll bar, in the second one I draw the same components adding that "my text", and you can see the differences on the command line prompt in the left. I think this was what you wanted me to show you... http://i45.tinypic.com/2818owi.jpg http://i50.tinypic.com/30ddt2p.jpg
  5. gatofedorento

    Render text in openGL

    Hey there. I'm currently developing a GUI library from scratch, and after making the classes for buttons, windows, scrollbars etc I think its time to make them more user friendly by adding some text. Today i tried to use the FTGL to draw some text, but the performance was very bad, just by drawing a window i got somewhat around 1300 fps, but if I drew it and a string ,with something like 20 characters, the framerate got around 200 fps using FTBitmapFont, it got even worse if I used FTPixmapFont. I tried to use this library to avoid writting my own FreeType wrapper, basing myself on nehe's code that i saw here http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/ , though I think I could get a better performance from it. Is there a better way to avoid these performance hits using FTGL? Are there better text rendering APIs to use just to render some simple text on my GUI components? I don't really need anything complex, just some simple 2D text. Cumpliments.
  6. gatofedorento

    Tips for a better GUI architecture, pros and cons

    You're right, I was really overdesigning this one, with some simple point-rectangle collision I can make it work without the need of such trouble. Thank you for replying.
  7. Hello, this week I had to reimplement my picking system for the GUI library I'm working on, and I will explain why later in the post, I would like to receive some feedback about what I'm doing to see if there's better ways to implement the GUI. My GUI system follows the composite pattern, elements can be added to elements, and the transformations applied to the parent element will be applied to the child elements, this way the rendering would be made like this: ->parent-element translates to his position ->parent-element renders ->child-element translates to his position, in addition to the parent's translation ->child-element renders ->child-element untranslates ->parent-element untranslates With this pattern I can move my parent without needing to set anything to the child elements, I think this is pretty good, since I can create independent infrastructure elements without the need of them knowing about each other if they are added. Now comes the septical part, in my last GUI version I was using the opengl picking system, the problem was when I wanted to add and element to a panel, and the element was widther than the panel, like this: [attachment=9689:panelwithbutton.jpg] I know it's hard to understand, since this is just for debugging, but the yellow square is a panel, and the red one is a button, the button is widther than the panel, so it gets clipped in the right side, you can notice that on the right the red square doesn't have the black contour line. With opengl picking this was a problem, since even if the button was clipped a hit was generated and I could click it outside the panel, that behavior wasn't desired, so I implemented a color picking system for the GUI, until now it's working flawless, though, creating a new GUI element needs some more code Here is the interface of the object that makes the color picking [source lang="cpp"]class PGIIColorPicker{ public: virtual bool testComponent(PGIComponent* component, PGIColor3ub color)=0; virtual int getPickCount()=0; virtual int getCurrentIndex()=0; virtual bool next()=0; virtual PGIColor3f current()=0; virtual void resetIndex()=0; virtual void clear()=0; virtual void setPickCoordinates(int x, int y)=0; };[/source] Here is the interface for my GUI elements [source lang="cpp"]class dllexport PGIComponent { public: virtual void draw()=0; virtual void draw(PGIColor3ub color)=0; virtual void pickElement(PGIIColorPicker* picker)=0; virtual void activate(GLuint* idx) =0; virtual void drag(GLuint* idx, float draggedX, float draggedY) = 0; virtual float getWidth()=0; virtual float getHeight()=0; virtual float getXPosition()=0; virtual float getYPosition()=0; virtual void setCoordinates(float topLeftX, float topLeftY, float width, float height)=0; virtual void setState(State state)=0; virtual void assignParent(PGIComponent* parent)=0; virtual PGIComponent* getParent()=0; virtual int getChildCount()=0; virtual PGIComponent* getChild(int idx)=0; };[/source] Like this my GUI manager would iterate through all the GUI root elements, calling the picker's testComponent function, this function basically calls the component's draw function with the desired color, and makes some setups too. If an element is hit the color picker instance stores the element index based on its color, and the manager calls PGIComponent's pickElement function passing the picker, and all this process repeats itself inside the parent component (in this case the panel) and there are no problems with clipping, since the process is based on the colors, and the parents transformations can still be applied to the child elements. This design decision seems a bit weird, but I couldn't find any better ideas, since with this i can emulate the opengl picking mechanism, without the need of passing through all the elements in the chain, just those that are really picked, still looks flexible, but I would like to hear some feedback about it, since I'm not too sure.
  8. gatofedorento

    GUI Architecture

    So, before rendering, you have an evaluation step where, for example, the mouse was over Button1 and now it's over Button2, what your controller does is change the state in Button1 to normal and Button2 to highlighted, right? This is pretty easy to implement in my GUI, I can use the same mechanism as I'm using for picking, and when I have to highlight multiple elements, like in a toolbar, my composite pattern will know how to solve these multiple highlights. Thanks a lot, I will think about this option, for now it's good because I just need to add something like 2 functions, instead of rewritting almost all my GUI code.
  9. gatofedorento

    GUI Architecture

    Hey there. I'm coding a GUI using C++ and openGL, but my problem is more design specific than API related. Right now I'm using classes that derive from a base GUI class, and some of them use a composite pattern, such as Windows for example, I can add buttons, scrollbars, etc to it. The GUI is functional as it is, but sometimes, from a more user point of view it might not work very well, for an example I would like to have my buttons shine everytime my mouse cursor is over them. Since I have a composite pattern I start from one element from my GUI and after it draws itself it calls the drawing function of the elements attached to it, all this starts in a GUIManager class. To make things like the button shine I would need to pass to the draw functions the required data for the elements to know which element the mouse is over and make a different draw, but i really wouldn't like to give this kind of task to my GUI elements. Another way I had in mind would be my elements having a function that returns a list of their children elements, and the drawing functions would be called from my GUIManager class in which it would know what element a "special effect" should be applied, this seems more reasonable to me, the only requirement would be that the elements had to have an extra function where they would return their children. Are there better options to do this?
  10. gatofedorento

    IO completion port

    I made a work for my Operative System class using IOCP for a server, at first it was pretty hard to understand, but when you get the idea of how it works you love it. To learn a bit more about IOCP I used the book "Windows via C/C++", it has some good pages about it and why it is so good, and of course, an example with comments. What you said about IOCP is correct, when I did my workd there was no need for a threadpool api, but I'm not really an expert in the windows API, so I can't really help you on that one. One more thing that's very good about IOCP is that it can manage the number of threads running so you don't have to waste context switches and it tries to maximize the the workd made by the threads, instead of wasting processor time context switching between them.
  11. gatofedorento

    Deprecated matrixes

    Skeletal animation is in my plans indeed, I already wrote some modules for it and I conclued that I need to calculate a lot of matrices and pass them to my shader to positionate my vertexes, seeing from that point of view I think leaving the openGL matrix stack will be something that will come naturaly, but maybe it's best to solve that problem early, than later change a lot of code
  12. gatofedorento

    Deprecated matrixes

    Then I think I will continue using the matrix stack openGL provides, since I don't have the needs to use openGL 4.0 functionalities. Thanks for the opinions, helped a lot!
  13. Hello, I was reading some posts across the internet and it seems the the modelview and projection matrix, along all they're modification functions, such as glTranslate, rotate, etc became deprecated and removed in the most recent openGL versions. I'm still using opengl 3.0 version, so I don't get compilation errors using them, but seeing that they are no longer in use in current openGL versions I would like to follow that philosophy. Since this is Computer Graphics the matrixes will still be needed, even if it's not in the openGL matrix stack. After some more reading seems that the general idea is to implement the functions by myself (or using someone elses library), and pass the matrix to my shaders. The thing is, I don't plan to use shaders everytime I want to render something, so my question here is: -Should I start using shaders everytime I want to render something, even though it's just making simple calculations as would be done without my shader implementation, or in these particular cases I should pass my own calculated matrixes to openGL? I'm doing this thinking from a performance point of view.
  14. gatofedorento

    Lock states in openGL

    I think you misunderstood ( or maybe I misunderstood your explanation, sorry =( ) part of what I wrote. But I got your point, it is indeed a bad design choice, and what you told me is a better way to do things, but anyway i will try to explain what I wanted to do in pseudo code and compare to your design: Renderer -> disableTextures Renderer -> disableColor Renderer -> renderWireframe Renderer -> lockTexturesState Renderer -> lockColorState //at this point the wireframes will be ready to use without color and textures, now let's see what happens in the draw function of one of my object, let's say a terrain Terrain -> enableTexture //this won't take effect because of the lock Terrain -> setTexture //the texture will be set, but it won't do anything, because the texture is disabled Terrain -> draw the mesh //which will be a wireframe //now that the terrain is drawn I can unlock the states for the other elements in my screen to draw normally, let's say GUI for example Renderer-> unlockTextures Renderer -> unlockColor GUI -> enableTextures GUI -> setTexture GUI -> draw //now everything will be draw normally Instead of what I did up here every object in my scene could have a function that sets the states and another function that draws the mesh, and depending of the mode I have only the renderer would know what to do, and the code would be somehting like this: if(state == FILL){ Renderer -> setFillMode foreach(Element in Elements){ Element -> setupState Element -> drawMesh } } else if(state == WIREFRAME){ Renderer -> setWireFrameMode foreach(Element in Elements){ Element -> drawMesh } } I think the last piece of pseudo code seems indeed more clean and I wouldn't need the locks, which would avoid the programmer of causing state bugs. Thanks for the help and sorry for the long post, I want to make sure I make good design choices, so I don't have the need to make huge refactorings later.
  15. Hello, I'm making a level editor and I came across a design doubt. Like in UDK, I want my editor to change from fill the polygons to wireframes or to points in real time with just the press of a button, that's easy to do in openGL, the problem is that when i change to wireframes I want to be able to disable textures, color, etc. In my implementation when the draw function of an object is called first it sets all the states it needs to (textures, color, etc) and then draws, I want to be able to lock these states so even though the draw functions calls them nothing happens, it's easy to do, I just need to cover the openGL functions with some of my own. My questions are: is there a better way to do this? Am I falling in other things in my design about each draw functions sets up the states?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!