opengl-1.x

How can I specify vertices in pixels in OpenGL?

ⅰ亾dé卋堺 提交于 2019-12-25 03:08:10
问题 I want to write a small project with OpenGL C++ and I want to use pixel instead of float value, for example like that: glVertext2f(420, 300); Instead of: glVertex2f(0.4, -0.34); Is it possible? 回答1: If you want to use pixel coordinates your rendering, it's pretty easy to do so using an orthographic matrix, which you can create using glOrtho. Assuming your window is 800x600 you could use the following code: // Set your projection matrix glMatrixMode(GL_PROJECTION); glOrtho(0, 800, 0, 600, -1,

Dashed line in OpenGL3?

╄→尐↘猪︶ㄣ 提交于 2019-12-09 06:27:16
问题 I'm currently porting an old OpenGL 1.1 application which makes use of wireframe models to OpenGL 3.0. In 1.1 following code is used to create a dashed line: glPushAttrib(GL_ENABLE_BIT); glLineStipple(1, 0x0F0F); glEnable(GL_LINE_STIPPLE); Here as usual the parameters are pushed to the stack in order to influence all following drawing operations. My question: how is this done in OpenGL3 where this stack is no longer used? How can I set up my lines to be dashed (probably before handing the

glMultMatrix doesn't work inside of glBegin()

China☆狼群 提交于 2019-12-04 05:24:47
问题 I am creating a program that allows me to plot points in 3 space, connects them using a Catmull-Rom Spline, and then draws a cylinder around the Spline. I am using GL_TRIANGLES_STRIP to connect circles of points drawn around the Spline at short intervals, to hopefully connect them all together into a Cylinder around the Spline. I have managed to draw complete circles of points at these intervals, using GL_POINTS , and orientate them correctly to the line with regards to a Frenet Frame.

Dashed line in OpenGL3?

一笑奈何 提交于 2019-12-03 08:01:41
I'm currently porting an old OpenGL 1.1 application which makes use of wireframe models to OpenGL 3.0. In 1.1 following code is used to create a dashed line: glPushAttrib(GL_ENABLE_BIT); glLineStipple(1, 0x0F0F); glEnable(GL_LINE_STIPPLE); Here as usual the parameters are pushed to the stack in order to influence all following drawing operations. My question: how is this done in OpenGL3 where this stack is no longer used? How can I set up my lines to be dashed (probably before handing the coordinates over to glBufferData()? For separate line segments, this is not very complicated at all. For

the difference between glOrtho and glViewPort in openGL [duplicate]

佐手、 提交于 2019-12-03 07:40:35
问题 This question already has an answer here : Difference between glOrthof and glViewPort (1 answer) Closed 4 years ago . I am struggling to figure out something let's say im rendering some image that has a height of 100 and a width of 100. In scenario A I am taking a glOrtho(0,100,0,100,-100,100) and glViewPort(0,0,50,50) when glOrthois defined as (left,right,bottom,top,zNear,zFar) and glViewPort is defined as (lower left corner x, lower left corner y, width, height). In scenario B I am taking a

the difference between glOrtho and glViewPort in openGL [duplicate]

一世执手 提交于 2019-12-02 21:05:22
This question already has an answer here : Difference between glOrthof and glViewPort (1 answer) I am struggling to figure out something let's say im rendering some image that has a height of 100 and a width of 100. In scenario A I am taking a glOrtho(0,100,0,100,-100,100) and glViewPort(0,0,50,50) when glOrthois defined as (left,right,bottom,top,zNear,zFar) and glViewPort is defined as (lower left corner x, lower left corner y, width, height). In scenario B I am taking a glOrtho(0,50,0,50,-100,100) and glViewPort(0,0,100,100) when glOrthois defined as (left,right,bottom,top,zNear,zFar) and