|
From: Svilen K. <kru...@go...> - 2008-10-06 23:07:41
|
// StipplingPolygons.cpp : Defines the entry point for the console application.
// Ercan Polat: 02/04/2008
// Note: This program is an example of "OpenGL Programming Guide (Third Edition)". I did
// add a stippling part with my initials (EP).
// Project Description: This project creates a simple OpenGl window using GLUT library.
// The program is an example of stipple patterns used on rectangle polygons.
//#include "stdafx.h"
#include <GL/glx.h>
#include <GL/gl.h>
#include <GL/glut.h>
// function that creates the stipple patterns and rectanguale polygons.
void display(void)
{
// Stipple pattern of my initials (EP)
GLubyte myInitial[] = {
0xff, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0xff, 0x01, 0xff, 0x01, 0x00, 0x01, 0x01, 0x01,
0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01,
0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01,
0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01,
0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01,
0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01,
0xff, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,};
// A stipple pattern of a fly
GLubyte fly[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60,
0x04, 0x60, 0x06, 0x20, 0x04, 0x30, 0x0C, 0x20,
0x04, 0x18, 0x18, 0x20, 0x04, 0x0C, 0x30, 0x20,
0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xC0, 0x22,
0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22,
0x66, 0x01, 0x80, 0x66, 0x33, 0x01, 0x80, 0xCC,
0x19, 0x81, 0x81, 0x98, 0x0C, 0xC1, 0x83, 0x30,
0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0,
0x03, 0x31, 0x8c, 0xc0, 0x03, 0x33, 0xcc, 0xc0,
0x06, 0x64, 0x26, 0x60, 0x0c, 0xcc, 0x33, 0x30,
0x18, 0xcc, 0x33, 0x18, 0x10, 0xc4, 0x23, 0x08,
0x10, 0x63, 0xC6, 0x08, 0x10, 0x30, 0x0c, 0x08,
0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08};
// Another stipple pattern
GLubyte halftone[] = {
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55};
// Clear the Color Buffer
glClear(GL_COLOR_BUFFER_BIT);
glColor4f(1.0, 1.0, 1.0, 0.5); // Set the color to white
// draw one solid, unstippled rectangle
glRectf(25.0, 25.0, 120.0, 120.0);
glEnable(GL_POLYGON_STIPPLE); // Enable POLYGON STIPPLE
glPolygonStipple(fly); // Pass the stipple arrray
glColor3f(0.0, 1.0, 0.0); // Set the color to white
glRectf (130.0, 25.0, 220.0, 120.0); // draw the first rectangle with the first stipple
glColor3f(1.0, 0.0, 0.0); // Set the color to white
glPolygonStipple(halftone); // pass the second stipple array
glRectf(230.0, 25.0, 320.0, 120.0); // draw the rectangle
// My own code starts here
glColor3f(0.0, 0.0,1.0); // Set change the color to red
glPolygonStipple(myInitial); // Pass the stipple my initial (EP)
glRectf(25.0, 130.0, 325.0, 220.0); // Draw a bigger rectangle
glDisable(GL_POLYGON_STIPPLE); // Disable the POLYGON STIPPLE
glFlush();
}
void init (void)
{
glClearColor(0.0, 0.0, 0.0, 0.0); // Clear the backround set it to black
glShadeModel(GL_FLAT); // set the shading model to FLAT
}
// Function that resets the window, each time when the window size is changed
void reshape(int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h);
}
// Main entry point of the program
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(350, 250); // set up the window size
glutCreateWindow(argv[0]); // create the window
init(); // initiliaze the window
glutDisplayFunc(display); // call the display to draw the rectangles
glutReshapeFunc(reshape); // call the reshape function (each time when the window size is changed)
glutMainLoop();
return 0;
} |
|
From: Brian P. <bri...@tu...> - 2008-10-07 13:25:40
|
Svilen Krustev wrote: > Hi, > > I can't get a polygon stipple to work on Fedora core 9. Please see the > example - it is not mine - I just picked it up from the net at random. I > have the same effect myself in a "slightly" bigger application. > > The latest mesa in fc9 is 7.1. I'm with ATI card. > > Your help will highly appreciated guys! I'd suggest filing a bug in bugzilla. Please indicate which driver you're using (see glxinfo). Maybe one of the ATI developers will be able to help you. -Brian |
|
From: Svilen K. <kru...@go...> - 2008-10-07 13:36:27
|
OK Brian, I'll do that On Tue, Oct 7, 2008 at 2:24 PM, Brian Paul <bri...@tu...>wrote: > Svilen Krustev wrote: > >> Hi, >> >> I can't get a polygon stipple to work on Fedora core 9. Please see the >> example - it is not mine - I just picked it up from the net at random. I >> have the same effect myself in a "slightly" bigger application. >> >> The latest mesa in fc9 is 7.1. I'm with ATI card. >> >> Your help will highly appreciated guys! >> > > I'd suggest filing a bug in bugzilla. Please indicate which driver you're > using (see glxinfo). Maybe one of the ATI developers will be able to help > you. > > -Brian > > |
|
From: Svilen K. <kru...@go...> - 2008-10-07 22:37:23
|
Brian,* * I filled-up a bug - here is the link* *http://bugs.freedesktop.org/show_bug.cgi?id=17957 The amazing thing is that there is a quite similar bug filled-up 3 years ago and still unassigned. I truly hope that this one will be luckier. I'm ready for a release (toped), but this is really stopping me, because my packages on fc9 will not be fully functional. It seems that all distros are affected, but fc9 currently has to stick to DRI drives and Mesa for ATI. There is no alternative there. I'll appreciate your help! Even if it is simply a link to appropriate people... Regards Svilen On Tue, Oct 7, 2008 at 2:32 PM, Svilen Krustev < kru...@go...> wrote: > OK Brian, > > I'll do that > > > On Tue, Oct 7, 2008 at 2:24 PM, Brian Paul < > bri...@tu...> wrote: > >> Svilen Krustev wrote: >> >>> Hi, >>> >>> I can't get a polygon stipple to work on Fedora core 9. Please see the >>> example - it is not mine - I just picked it up from the net at random. I >>> have the same effect myself in a "slightly" bigger application. >>> >>> The latest mesa in fc9 is 7.1. I'm with ATI card. >>> >>> Your help will highly appreciated guys! >>> >> >> I'd suggest filing a bug in bugzilla. Please indicate which driver you're >> using (see glxinfo). Maybe one of the ATI developers will be able to help >> you. >> >> -Brian >> >> > |
|
From: Brian P. <bri...@tu...> - 2008-10-07 22:29:38
|
You're probably most likely to get help by posting to the mesa3d-dev list and hoping one of the r300 developers can help you. I don't have a r300 card. -Brian Svilen Krustev wrote: > Brian,* > * > I filled-up a bug - here is the link* > *http://bugs.freedesktop.org/show_bug.cgi?id=17957 > > The amazing thing is that there is a quite similar bug filled-up 3 years > ago and still unassigned. > > I truly hope that this one will be luckier. I'm ready for a release > (toped), but this is really stopping me, because my packages on fc9 will > not be fully functional. It seems that all distros are affected, but fc9 > currently has to stick to DRI drives and Mesa for ATI. There is no > alternative there. > > I'll appreciate your help! Even if it is simply a link to appropriate > people... > > Regards > Svilen > > On Tue, Oct 7, 2008 at 2:32 PM, Svilen Krustev > <kru...@go... <mailto:kru...@go...>> > wrote: > > OK Brian, > > I'll do that > > > On Tue, Oct 7, 2008 at 2:24 PM, Brian Paul > <bri...@tu... > <mailto:bri...@tu...>> wrote: > > Svilen Krustev wrote: > > Hi, > > I can't get a polygon stipple to work on Fedora core 9. > Please see the example - it is not mine - I just picked it > up from the net at random. I have the same effect myself in > a "slightly" bigger application. > > The latest mesa in fc9 is 7.1. I'm with ATI card. > > Your help will highly appreciated guys! > > > I'd suggest filing a bug in bugzilla. Please indicate which > driver you're using (see glxinfo). Maybe one of the ATI > developers will be able to help you. > > -Brian > > > |