Jump to content
  • Advertisement
Sign in to follow this  

some questions

This topic is 4759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

1. How do I set up a clipping box? Ive tried glScissor but it still draws outside of it. 2. Is it possible to draw with absolute coordinates relative to the viewport? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
1.
Maybe you need to glEnable(GL_SCISSOR_TEST); ?

2.
I'm not sure what you mean. Do you mean that the co-ordinates should equate to pixels?

Share this post


Link to post
Share on other sites
1.
Iam new to ogl so I dont know what iam doing but here is some code.

glViewport(0, 100, 100, 100);
glScissor(0, 100, 100, 100);
glEnable(GL_SCISSOR_TEST);

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, ClientRect.right, ClientRect.bottom, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor4ub(255, 0, 0, 255);

glBegin(GL_POLYGON);
glVertex2i(-50, -50);
glVertex2i(-50, 50);
glVertex2i(50, 50);
glVertex2i(50, -50);
glEnd();

glDisable(GL_SCISSOR_TEST);

2.
if it had worked.
I want that if I write
glVertex2i(0, 0);
glVertex2i(0, 50);
glVertex2i(50, 50);
glVertex2i(50, 0);

it should draw the box it the left, top of my viewport

Share this post


Link to post
Share on other sites
I don't know much about the scissor test, but what I use for this to make like a splitscreen is just the same glViewport function. Instead of it covering the whole screen, it can be used to cover whatever portion you want. The good part is that the drawing is the same. It will be made smaller due to the view, but the perspective should be the same and the verts will be the same.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!