Link to home
Start Free TrialLog in
Avatar of jsbsudha
jsbsudhaFlag for Germany

asked on

scaling objects in opengl

I have drawn a cube  and  a square in opengl window using c++ and glut .... I have a button to scale the objects in the opengl window.....They both scale uniformly.......

But I want to  have different scaling factors for these two objects.....the default scaling size for cube and square  is when I run the application they both are scaled  to 1.0...then after pressing the scaling button I could increase or decrease the size of both.......But I want to have the scale  of the cube to be 1.0 and scale of  square to be 0.5 by default in the when I press the scaling button while running the application they both should scale but different scaling factors........

Avatar of ikework
Flag of Germany image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
all you have to do is changing scaleObjectA & scaleObjectB in your button-press-code
Avatar of jsbsudha


I will try and reply you......... Actually I had tried this way.....some how I could not get exact result........may be i could try it again and reply you......
ok, if for any reason it does not work, post the actual code here and we take it from there .. ;)
I had forgot  to add PUSHMatrix and POPmatrix....... when I tried before.....Now it I will  accept your solution......I have another question can you help me.? I want to display 3d bitmap picture in the opengl window......I have displayed 2D piocture.....Is there any  sample code or ideas for that.....
what do you mean by:

>> I want to display 3d bitmap
>> I have displayed 2D piocture

the normal bitmap is always 2D (width and height) .. there are two ways to do that:

1) bind a texture to polygons/triangles:

2) copy pixel-data(i.e. from a bitmap) to framebuffer/screen using glDrawPixels

>> I have another question

if it was once .. no problem .. but in all your questions i participated you did that .. honestly, looks like salami tactic ..
and you have a lot open-questions. if they are solved, can you close it please? if it was not solved, try to explain there which problem you have with the provided solutions and we will help you further ..

its a give and take from both sides .. ;-)