Rockard

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Rockard

  • Rank
    Member
  1. I'm currently making a rendering system for many types of objects using the VBO method. The objects may have varying numbers of vertices/object, and may also use different primitive types. If the primitive type is triangle or quad, rendering lots of these as some sort of 2d-sprite is not o problem since the start and stop-vertice is always assumed by this type of primitive type. But, when using any other type, like trianglestrip, I can't render a lots of these without them all being glued toghether. I can't sort them up in a batch of primitives since I can't specify the start and stop of each primitive object. So, did I miss something, or may this be possibly? Can I somehow tell the rendering system when using glRenderelements/glRenderArrays where the start and stops of the primitive type - like lines/trianglestrip/trianglefan - will be?
  2. Wow! Incredibly great responses and lots of valuable discussions! I will try out the approach of first making a big VBO, then keep inserting vertices until some of the gl-options differ - by then, I draw and start over again. This approach will work great with my current problem with loads of bullets of the same type. Right now, I can put out about 3000 with 4 vertices each with vsync at 60 fps - more bullets and the fps will drop. I think it is the enormous amount of openglcalls that kills the performance. This approach of collecting vertices dynamicly will probably also work wonders for a tilesystem I will insert later. I was first thinking about making this stupid solution about sorting stuff manually in groups using bit-settings... man that would have been a waste of time! Hohooo I'm so excited! I will begin coding my new system right away. I'm really hoping I will break that 3000 bullets barrier. I'll will report my results.
  3. I am developing a 2d-like graphics system for games, using lots of different algoritms for creating nice dynamic graphics. Up till now, I have always used glBegin and so forth for the rendering, and learned fairly recently that this was not the way to go for optimal performance. So, I learned about VBO, and just now got it working - but it was wayyy slower, probably because am I not doing it right. My current approach is this: * creation Create VBO for all objects (if may be thousands) I use GL_STREAM_DRAW_ARB setting because I will update the data each frame. No matrix transformations is used. I put data for vertice, color and texture coords next to each other in the vbo for each object. * update I use glBindBufferARB and glMapBufferARB to get the gpu pointer, and then iterate the datavalues for vectors, colors and texturecoordinates and insert them into the pointer, then glUnmapBufferARB. * draw glEnableClientState for GL_VERTEX_ARRAY, GL_COLOR_ARRAY and GL_TEXTURE_COORD_ARRAY, specify pointers for them with the correct offset and then glDrawArrays. DisableClientState and BindBuffer to id 0. --- now, this was very slow compared to my usual approach using glBegin/glEnd. What am I doing wrong? Since I have seperate opengl drawing/blending settings for each gfx-object, I can't just put out all VBO-s at the same time using one large VBO.( can I? ) Does the gpu choke because of my large number of VBOs? I have another idea (based on how I THINK things work). I create _one_ VBO with the largest amount of data I think I will use for each gfx-object (usually about 20 vertices). Then, I use the same VBO all the time when inserting data and rendering, instead of thousands of small ones because I will not render them all at once anyway. Is the VBO-aproach suitable for loads of small objects with different opengl-settings? thanks for any help and suggestions!
  4. Augh! I was using the wrong examples. :S Using the GL2 ones everything works fine! Thanks V-man and Moomin!
  5. My setup: Notebook Amilo XA2528 with win vista Geforce 8600M GS, 256 mbyte After having programmed my opengl 2dengine for a long time, I felt it was time to dig into gpu programming to get better performance and for some nice effects! I found out about Rendermonkey and tried it out just to test some features and so on. I loaded up some examples and they compiled just fine with no errors, but then - they all turn up blank! The preview-window shows nothing, it's just totally black. I can turn on the boundingbox and triad and stuff, but there is no content. I have not tested all examples, but I have tested most of them, and only the FUR demo I can get to work... somehow? I don't think it looks right. It seems like some functions is missing from it, as there is no smoothness to it. look: I fired up glew, and it tells me that OpenGL version 2.1.1 is supported and the shader stuff looks fine. Any ideas? =(
  6. Stretching algoritm in 2d

    Heh, thanks, but that won't help either. Its the same solution that both I and Deathray submitted. It can only handle scaling, not distortion of the object. I want to be able to stretch only one corner and have the vertices change according to it. Just like stretching out a texture by pulling a single vertice, but have the actual algoritm for the calculations of the pixelpositions. Any other suggestions? =(
  7. Stretching algoritm in 2d

    thanks, but that won't work with rotations. I cannot distort the image, just resize it. I want to be able to change the vertices around like, for example, the distort-tool in macromedia flash.
  8. Stretching algoritm in 2d

    Say I have a some vertices defining an objekt. I then select the objekt with a rectangular tool with four corners. When I pull a corner of this marking tool, the vertices stretch out accordingly. Can anyone help with a suitable algoritm for this? My first try was like this: vertice+ = (the movement of the four selectioncorners/ number of selectioncorners) This works with resizing of X and Y, but nothing else. Some ideas I have is use squareroot to find the length between all vertices and selectioncorners, and adjust the vertices relative to the distance to the corners. I guess most drawing programs have a function like this, but I simply can't find a suitable and fast algorithm anywhere. Any ideas? I also plan to use this for my 2d cameraclass. Think of the selection as the camera. The selection will project at the screen and some weird foolery will be accomplished while dragging the selectioncorners around. Thanks for any help!
  9. Look at this example: --------------------------- class Dummy; class Bagel { public: Bagel(Dummy* _dummy){ aDummy=_dummy; aDummy->output(); /// ERROR! } private: Dummy* aDummy; }; class Dummy { public: Dummy(){} void init(){ aBagel=new Bagel(this); } void output(){ cout<<"dumb"<<endl; } private: Bagel* aBagel; }; void main(){ Dummy blaj; blaj.init(); } --------------------------- So, there is two classes, and both classes have eachother as members. Now, I want Bagel to have Dummy output "dumb". Unfortunately, Bagel don't know about Dummys classmembers, only about Dummys existance. How can I make Bagel recognice Dummys members? In C you can write a function header, and implement it later. Can I somehow make something similar to functions in a class? Simply writing void Dummy::output(); would seem logical, just below "class Dummy;", but nope, didn't work. Any suggestions? Thanks!
  10. Thanks for answering! Well, I am already using the first option. I have converted some very small pics to characters and loaded them directly into opengl, but I stopped just there as I figured other options might exist. The zipfile solution is kind of messy. Isn't there another solution to just add the files as they are without invoking some external algoritms? In theory it seems easy to just have pointers to data that I easily can access during runtime, located in the exe. I searched around with winres.exe as reference, and the results was a bit overwhelming. Anyone care to give me some pointers at some more specific instructions and/or tools? Any feedback is appreciated.
  11. How can I include a PNG file in my executable, and how do I access it in my sourcecode? I'm programming in C++, using mvs and codeblocks. I have searched around a bit, and found out about .rc files. But there doesn't seem to exist any good tutorials that deals with different platforms, since its implementation seems very compilator specific. The filetypes available also seems very pre-set. All tutorials found only handle ICO or gui-elements, and I can't find any information about defining my own, or how to actually use the included resources. Maybe these rc-files isn't the way to go? In the end, I plan to include ALL my own datafiles, sounds, and images into my executable somehow, at least for smaller games. thanks for any help! I'm totally lost..
  12. Thanks! But, it didn't work as expected. The carrot is red, but the details of the texture is still on it. I want it plain red! You know, it should look like a 2 color texture with alpha. =)
  13. Say I have loaded a texture with alphavalues. Let's say it is a picture of a carrot. The carrot has alpha around it's edges so that it can fly around in 2d nicely above a background. I active GL_BLEND and then use glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) to make it display properly. Now, for a specific effect I'm after, I need this carrot to display in a specific plain color, with the alpha intact. I can only get the carrot to display in plain white, or giving it a hint of other colours. Gaahh.. :( Does anyone have a smart solution for this? Well, just a solution is nice also. =) Thanks for any help!