Show glutSolidCone on its sideWhy doesn't glCopyTexSubImage2D copy my square correctly?OpenGL texture mapping on sides cube using GL_QUADSOpenGL and GLUT uncomprehensionOpenGL/glut/stdc++ build errorsOpenGL object glossy/shiny in Mac OS X 10.6, but not 10.5. Why?PyOpenGL - passing transformation matrix into shaderMy display() function only displays when it enters it the first time. Then it shows a blank windowOpenGL Plane not showing upHaving many glut errorsCreating a 3D cube with 3 sides showing at run time, no rotation to see all 3 sides
What is the name of this Allen-head furniture fastener?
Ambiguity in notation resolved by +
POSIX compatible way to get user name associated with a user ID
Which is the current decimal separator?
How are aircraft depainted?
Telling my mother that I have anorexia without panicking her
How to give my students a straightedge instead of a ruler
Can I fix my boots by gluing the soles back on?
Amortized Loans seem to benefit the bank more than the customer
What are these things that surround museum exhibits called?
The Planck constant for mathematicians
Is there a tool to measure the "maturity" of a code in Git?
Is there any benefit to riders on the front of a paceline?
New default file type?
How to write characters doing illogical things in a believable way?
Can I see Harvest moon in India?
Why the car dealer is insisting on loan instead of cash
What 68-pin connector is this on my 2.5" solid state drive?
Some Prime Peerage
ColorFunction based on array index in ListLinePlot
What exactly is a marshrutka (маршрутка)?
Why does the speed of sound decrease at high altitudes although the air density decreases?
Bit one of the Intel 8080's Flags register
How would you control supersoldiers in a late iron-age society?
Show glutSolidCone on its side
Why doesn't glCopyTexSubImage2D copy my square correctly?OpenGL texture mapping on sides cube using GL_QUADSOpenGL and GLUT uncomprehensionOpenGL/glut/stdc++ build errorsOpenGL object glossy/shiny in Mac OS X 10.6, but not 10.5. Why?PyOpenGL - passing transformation matrix into shaderMy display() function only displays when it enters it the first time. Then it shows a blank windowOpenGL Plane not showing upHaving many glut errorsCreating a 3D cube with 3 sides showing at run time, no rotation to see all 3 sides
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to look at a cone lying on its side from above. For this I wrote the following code:
void display(void)
glClear(GL_COLOR_BUFFER_BIT
int main(int argc, char **argv)
GLUT_DOUBLE
I translate to the middle of the screen and then rotate 90 degrees around the x-axis, which in my idea should produce the cone on its side. The result however is a not a cone but a line which is not tilted 90 but 45 degrees. What should I change in order for the cone to show up as I want it to?
c++ opengl glut opengl-compat
add a comment
|
I am trying to look at a cone lying on its side from above. For this I wrote the following code:
void display(void)
glClear(GL_COLOR_BUFFER_BIT
int main(int argc, char **argv)
GLUT_DOUBLE
I translate to the middle of the screen and then rotate 90 degrees around the x-axis, which in my idea should produce the cone on its side. The result however is a not a cone but a line which is not tilted 90 but 45 degrees. What should I change in order for the cone to show up as I want it to?
c++ opengl glut opengl-compat
add a comment
|
I am trying to look at a cone lying on its side from above. For this I wrote the following code:
void display(void)
glClear(GL_COLOR_BUFFER_BIT
int main(int argc, char **argv)
GLUT_DOUBLE
I translate to the middle of the screen and then rotate 90 degrees around the x-axis, which in my idea should produce the cone on its side. The result however is a not a cone but a line which is not tilted 90 but 45 degrees. What should I change in order for the cone to show up as I want it to?
c++ opengl glut opengl-compat
I am trying to look at a cone lying on its side from above. For this I wrote the following code:
void display(void)
glClear(GL_COLOR_BUFFER_BIT
int main(int argc, char **argv)
GLUT_DOUBLE
I translate to the middle of the screen and then rotate 90 degrees around the x-axis, which in my idea should produce the cone on its side. The result however is a not a cone but a line which is not tilted 90 but 45 degrees. What should I change in order for the cone to show up as I want it to?
c++ opengl glut opengl-compat
c++ opengl glut opengl-compat
edited Mar 28 at 13:37
Nicol Bolas
308k38 gold badges516 silver badges700 bronze badges
308k38 gold badges516 silver badges700 bronze badges
asked Mar 28 at 11:21
LarsLars
325 bronze badges
325 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
Where is the projection matrix?
If you don't set a projection matrix, then the coordiantes have to be set in normalize device space. In NDC all the coordinates are in range [-1.0, 1.0]:
e.g.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glRotatef(90, 1, 0, 0);
glutSolidCone(1.0, 1.0, 20, 20);
glTranslatef(-0.5, -0.5, 0);
glRotatef(-90, 1, 0, 0);
Alternatively you can setup an orthographic projection, which projects the world coordinates 1:1 to the window coordinates. The projection matrix can be set by glOrtho
:
e.g.
void display(void)
glClear(GL_COLOR_BUFFER_BIT
The projection matrix describes the mapping from 3D points of the view on a scene, to 2D points on the viewport. At Orthographic Projection, the view space coordinates are linearly mapped to the clip space coordinates. The clip space coordinates are equal to the normalized device coordinates.
The normalized device coordinates are linearly mapped to the viewport rectangle.
The viewport rectangle can be defined by glViewport
. Initially it is defined by the size of the window.
Note, that drawing by glBegin
/glEnd
sequences and the fixed function matrix stack is deprecated since decades. See Fixed Function Pipeline and Legacy OpenGL.
Read about Vertex Specification and Shader for a state of the art way of rendering.
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55396335%2fshow-glutsolidcone-on-its-side%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Where is the projection matrix?
If you don't set a projection matrix, then the coordiantes have to be set in normalize device space. In NDC all the coordinates are in range [-1.0, 1.0]:
e.g.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glRotatef(90, 1, 0, 0);
glutSolidCone(1.0, 1.0, 20, 20);
glTranslatef(-0.5, -0.5, 0);
glRotatef(-90, 1, 0, 0);
Alternatively you can setup an orthographic projection, which projects the world coordinates 1:1 to the window coordinates. The projection matrix can be set by glOrtho
:
e.g.
void display(void)
glClear(GL_COLOR_BUFFER_BIT
The projection matrix describes the mapping from 3D points of the view on a scene, to 2D points on the viewport. At Orthographic Projection, the view space coordinates are linearly mapped to the clip space coordinates. The clip space coordinates are equal to the normalized device coordinates.
The normalized device coordinates are linearly mapped to the viewport rectangle.
The viewport rectangle can be defined by glViewport
. Initially it is defined by the size of the window.
Note, that drawing by glBegin
/glEnd
sequences and the fixed function matrix stack is deprecated since decades. See Fixed Function Pipeline and Legacy OpenGL.
Read about Vertex Specification and Shader for a state of the art way of rendering.
add a comment
|
Where is the projection matrix?
If you don't set a projection matrix, then the coordiantes have to be set in normalize device space. In NDC all the coordinates are in range [-1.0, 1.0]:
e.g.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glRotatef(90, 1, 0, 0);
glutSolidCone(1.0, 1.0, 20, 20);
glTranslatef(-0.5, -0.5, 0);
glRotatef(-90, 1, 0, 0);
Alternatively you can setup an orthographic projection, which projects the world coordinates 1:1 to the window coordinates. The projection matrix can be set by glOrtho
:
e.g.
void display(void)
glClear(GL_COLOR_BUFFER_BIT
The projection matrix describes the mapping from 3D points of the view on a scene, to 2D points on the viewport. At Orthographic Projection, the view space coordinates are linearly mapped to the clip space coordinates. The clip space coordinates are equal to the normalized device coordinates.
The normalized device coordinates are linearly mapped to the viewport rectangle.
The viewport rectangle can be defined by glViewport
. Initially it is defined by the size of the window.
Note, that drawing by glBegin
/glEnd
sequences and the fixed function matrix stack is deprecated since decades. See Fixed Function Pipeline and Legacy OpenGL.
Read about Vertex Specification and Shader for a state of the art way of rendering.
add a comment
|
Where is the projection matrix?
If you don't set a projection matrix, then the coordiantes have to be set in normalize device space. In NDC all the coordinates are in range [-1.0, 1.0]:
e.g.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glRotatef(90, 1, 0, 0);
glutSolidCone(1.0, 1.0, 20, 20);
glTranslatef(-0.5, -0.5, 0);
glRotatef(-90, 1, 0, 0);
Alternatively you can setup an orthographic projection, which projects the world coordinates 1:1 to the window coordinates. The projection matrix can be set by glOrtho
:
e.g.
void display(void)
glClear(GL_COLOR_BUFFER_BIT
The projection matrix describes the mapping from 3D points of the view on a scene, to 2D points on the viewport. At Orthographic Projection, the view space coordinates are linearly mapped to the clip space coordinates. The clip space coordinates are equal to the normalized device coordinates.
The normalized device coordinates are linearly mapped to the viewport rectangle.
The viewport rectangle can be defined by glViewport
. Initially it is defined by the size of the window.
Note, that drawing by glBegin
/glEnd
sequences and the fixed function matrix stack is deprecated since decades. See Fixed Function Pipeline and Legacy OpenGL.
Read about Vertex Specification and Shader for a state of the art way of rendering.
Where is the projection matrix?
If you don't set a projection matrix, then the coordiantes have to be set in normalize device space. In NDC all the coordinates are in range [-1.0, 1.0]:
e.g.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glRotatef(90, 1, 0, 0);
glutSolidCone(1.0, 1.0, 20, 20);
glTranslatef(-0.5, -0.5, 0);
glRotatef(-90, 1, 0, 0);
Alternatively you can setup an orthographic projection, which projects the world coordinates 1:1 to the window coordinates. The projection matrix can be set by glOrtho
:
e.g.
void display(void)
glClear(GL_COLOR_BUFFER_BIT
The projection matrix describes the mapping from 3D points of the view on a scene, to 2D points on the viewport. At Orthographic Projection, the view space coordinates are linearly mapped to the clip space coordinates. The clip space coordinates are equal to the normalized device coordinates.
The normalized device coordinates are linearly mapped to the viewport rectangle.
The viewport rectangle can be defined by glViewport
. Initially it is defined by the size of the window.
Note, that drawing by glBegin
/glEnd
sequences and the fixed function matrix stack is deprecated since decades. See Fixed Function Pipeline and Legacy OpenGL.
Read about Vertex Specification and Shader for a state of the art way of rendering.
edited Mar 28 at 11:39
answered Mar 28 at 11:34
Rabbid76Rabbid76
60k13 gold badges39 silver badges71 bronze badges
60k13 gold badges39 silver badges71 bronze badges
add a comment
|
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55396335%2fshow-glutsolidcone-on-its-side%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown