Low frame rate in OpenGL [closed] - opengl

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a blender obj. file in an OpenGL application. I have also added a camera so that it will move in around that object (it's a building, so it's pretty large). The frame rate on it is awful.
Why is it slow and/or how can I make it faster?
void camera (void) {
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(yrot,0.0,1.0,0.0);
glTranslated(-xpos,-ypos,-zpos); }
This is just my simple camera class. Just in case it helps.

There are some reasons your code might be slow:
You aren't using VertexBuffer objects
You are using the fixed function pipeline and not shaders
You aren't optimizing your drawing code that only areas are rendered which are visible ( look a.e. for bsp-trees )
After all you've a lot of optimizations to do. I would start with optimizing my render pipeline and remove the fixed function pipeline and start to use shaders and vertex-buffers.

Related

Calling 2 functions in an alternating manner in display function [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a function that simply constructs a stick figure in 1 position
I have another function that builds a stick figure in another position.
I now want to call these functions alternatively so that the figure will appear to walk.
I'm not sure if I have to push and pop matrices.
For such rudimentary animation, will a boolean flag not do? (OpenGL doesn't even come into it here, it's merely logic)
I.e. in your draw method:
animate = !animate; // flip flag for 2 possible frames (boolean member variable)
if (animate) {
// draw position 1
} else {
// draw position 2
}
However, bear in mind this is just some quick sample code to get the idea across - it would result in every frame having the animation occur, which would likely occur so fast to be nauseating. You will have to apply time logic to it as well to make the simple animation not just appear as a blur.

How to add hair in OpenGL [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a 3D head model. How can I add hair? I only need to draw hair and animation is not required.
Could anyone provide some sample code? What is the simplest way to simulate hair in this case?
Edit:
I understand this is not a programming problem. But I have to implement it as my project. I searched online, which makes me more confusing. That is why I asked here.
Static hair can be rendered in a variety of ways depending on your needs:
Using a polygonal model. This gives hair that looks like what the characters from Dragon Ball or Yugi Oh! have.
Using a fur rendering algorithm. This is a very fill-rate intensive process.
Using multiple disjointed polygonal models. This works well for dreaded hair and in general hair which isn't too "fluffy".
These are just from the top of my head. There are most likely other algorithms out there. Also, as cbamber85, hair rendering is indeed a research field in itself!

How can i render a tiled map with C++/SDL [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to render tiles to the screen from a text file. I have the random terrain generator working, and I can move the data from the text file to a 2d vector. What I'm having trouble with is understanding how to give those tiles the coordinates they need to be rendered at. How would I go about assigning each tile its own coordinates relative to the camera?
I suggest checking this lua tutorial on how create a tile engine in great detail. You'll learn much more then what someone will be willing to post here on stack. Tile Engines as you will see from this tutorial, requires more then just a few lines of code. After you learn it here, it shouldn't be to hard for you to translate it to sdl/c++. Just a thought.
Its a good starting place.

How to introduce keyboard functions in Opengl code [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am new to opengl I tried to make an isosurface by reading from a text file .now I want to introdude keyboard functions in my code so that I can rotate an do all that stuffs. please tell me from where i can study that or give me a sample code
Sudhanshu
OpenGL only deals with drawing stuff. It gives you a canvas and some primitive drawing tools. Nothing more. Anything beyond that is the task of the user interface system provided by the OS.
Maybe you're using GLUT and are mislead by its name. GLUT is not part of OpenGL; it's a rudimentary framework aimed at developing simple OpenGL example programs, but that's about it.

Computing Rotation Speed In C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
Basically, In C++, how do I compute how long will it take for a car wheel to rotate 360 degrees while moving at a speed of 10 MPH? I've tried googling but nothing showed up. Any ideas?
As usual, I've searched this site for an answer but nothing showed up - unless I missed one.
Thanks.
If you know the speed of your object and the radius of the circle it moves on, then the time needed for one rotation is
rotation_time = 2*pi*radius/speed
The number of rotations per time unit is
rotation_speed = 1/rotation_time
The angular speed is
angular_speed = full_circle/rotation_time,
with the value of full_circle depending on your angular unit, e.g. 360 or 2*pi.